@openfn/language-fhir-4 0.4.2 → 0.5.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/configuration-schema.json +52 -59
- package/dist/index.cjs +11 -7
- package/dist/index.js +11 -7
- package/package.json +4 -4
|
@@ -2,63 +2,56 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"type": "object",
|
|
4
4
|
"properties": {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"examples": [
|
|
56
|
-
"the-long-access-token-from-your-auth"
|
|
57
|
-
]
|
|
58
|
-
}
|
|
5
|
+
"baseUrl": {
|
|
6
|
+
"title": "Base Url",
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The baseUrl",
|
|
9
|
+
"examples": ["https://hapi.fhir.org"]
|
|
10
|
+
},
|
|
11
|
+
"apiPath": {
|
|
12
|
+
"title": "API Path",
|
|
13
|
+
"anyOf": [
|
|
14
|
+
{
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"type": "null"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"placeholder": "R4",
|
|
22
|
+
"description": "FHIR api path",
|
|
23
|
+
"minLength": 1,
|
|
24
|
+
"examples": ["baseR4", "R3", "R4"]
|
|
25
|
+
},
|
|
26
|
+
"username": {
|
|
27
|
+
"title": "Username",
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Username",
|
|
30
|
+
"examples": ["openfn_test"]
|
|
31
|
+
},
|
|
32
|
+
"password": {
|
|
33
|
+
"title": "Password",
|
|
34
|
+
"type": "string",
|
|
35
|
+
"description": "Password",
|
|
36
|
+
"writeOnly": true,
|
|
37
|
+
"examples": ["@some(!)Str0ngp4ss0w0rd"]
|
|
38
|
+
},
|
|
39
|
+
"access_token": {
|
|
40
|
+
"title": "Access Token",
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "Your FHIR access token",
|
|
43
|
+
"writeOnly": true,
|
|
44
|
+
"minLength": 1,
|
|
45
|
+
"examples": ["the-long-access-token-from-your-auth"]
|
|
46
|
+
},
|
|
47
|
+
"authorization": {
|
|
48
|
+
"title": "Authorization Header",
|
|
49
|
+
"type": "string",
|
|
50
|
+
"description": "Custom Authorization header value",
|
|
51
|
+
"writeOnly": true,
|
|
52
|
+
"minLength": 1,
|
|
53
|
+
"examples": ["custom 12345"]
|
|
54
|
+
}
|
|
59
55
|
},
|
|
60
|
-
"required": [
|
|
61
|
-
|
|
62
|
-
"apiPath"
|
|
63
|
-
]
|
|
64
|
-
}
|
|
56
|
+
"required": ["baseUrl", "apiPath"]
|
|
57
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -92,15 +92,19 @@ function assertValidResourceId(id2) {
|
|
|
92
92
|
}
|
|
93
93
|
function addAuth(options) {
|
|
94
94
|
var _a;
|
|
95
|
-
if ((_a = options
|
|
95
|
+
if ((_a = options.headers) == null ? void 0 : _a.Authorization) {
|
|
96
96
|
return;
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
}
|
|
98
|
+
const { username, password, access_token, authorization } = options.configuration;
|
|
99
|
+
if (authorization) {
|
|
100
|
+
return { Authorization: authorization };
|
|
101
|
+
}
|
|
102
|
+
if (access_token || authorization) {
|
|
99
103
|
return { Authorization: `Bearer ${access_token}` };
|
|
100
|
-
}
|
|
104
|
+
}
|
|
105
|
+
if (username && password) {
|
|
101
106
|
return { ...(0, import_util.makeBasicAuthHeader)(username, password) };
|
|
102
107
|
}
|
|
103
|
-
return {};
|
|
104
108
|
}
|
|
105
109
|
var prepareNextState = (state, response) => {
|
|
106
110
|
const { body, validationErrors, ...responseWithoutBody } = response;
|
|
@@ -131,15 +135,15 @@ var request = (method, path, options) => {
|
|
|
131
135
|
(0, import_util.assertRelativeUrl)(path);
|
|
132
136
|
const { configuration, ...otherOptions } = options;
|
|
133
137
|
const fullPath = import_node_path.default.join(configuration.apiPath ?? "/fhir", path);
|
|
134
|
-
const headers = addAuth(options);
|
|
135
138
|
const opts = {
|
|
136
139
|
...otherOptions,
|
|
137
140
|
headers: Object.assign(
|
|
138
|
-
|
|
141
|
+
{},
|
|
139
142
|
{
|
|
140
143
|
accept: "application/fhir+json",
|
|
141
144
|
"content-type": "application/fhir+json"
|
|
142
145
|
},
|
|
146
|
+
addAuth(options),
|
|
143
147
|
options.headers
|
|
144
148
|
),
|
|
145
149
|
baseUrl: configuration.baseUrl,
|
package/dist/index.js
CHANGED
|
@@ -50,15 +50,19 @@ function assertValidResourceId(id2) {
|
|
|
50
50
|
}
|
|
51
51
|
function addAuth(options) {
|
|
52
52
|
var _a;
|
|
53
|
-
if ((_a = options
|
|
53
|
+
if ((_a = options.headers) == null ? void 0 : _a.Authorization) {
|
|
54
54
|
return;
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
}
|
|
56
|
+
const { username, password, access_token, authorization } = options.configuration;
|
|
57
|
+
if (authorization) {
|
|
58
|
+
return { Authorization: authorization };
|
|
59
|
+
}
|
|
60
|
+
if (access_token || authorization) {
|
|
57
61
|
return { Authorization: `Bearer ${access_token}` };
|
|
58
|
-
}
|
|
62
|
+
}
|
|
63
|
+
if (username && password) {
|
|
59
64
|
return { ...makeBasicAuthHeader(username, password) };
|
|
60
65
|
}
|
|
61
|
-
return {};
|
|
62
66
|
}
|
|
63
67
|
var prepareNextState = (state, response) => {
|
|
64
68
|
const { body, validationErrors, ...responseWithoutBody } = response;
|
|
@@ -89,15 +93,15 @@ var request = (method, path, options) => {
|
|
|
89
93
|
assertRelativeUrl(path);
|
|
90
94
|
const { configuration, ...otherOptions } = options;
|
|
91
95
|
const fullPath = nodepath.join(configuration.apiPath ?? "/fhir", path);
|
|
92
|
-
const headers = addAuth(options);
|
|
93
96
|
const opts = {
|
|
94
97
|
...otherOptions,
|
|
95
98
|
headers: Object.assign(
|
|
96
|
-
|
|
99
|
+
{},
|
|
97
100
|
{
|
|
98
101
|
accept: "application/fhir+json",
|
|
99
102
|
"content-type": "application/fhir+json"
|
|
100
103
|
},
|
|
104
|
+
addAuth(options),
|
|
101
105
|
options.headers
|
|
102
106
|
),
|
|
103
107
|
baseUrl: configuration.baseUrl,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-fhir-4",
|
|
3
3
|
"label": "FHIR r4",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.1",
|
|
5
5
|
"description": "OpenFn FHIR r4 adaptor",
|
|
6
6
|
"author": "Open Function Group",
|
|
7
7
|
"license": "LGPLv3",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"@swc/core": "^1.10.9",
|
|
19
19
|
"@types/fhir": "^0.0.41",
|
|
20
20
|
"fhir": "^4.12.0",
|
|
21
|
-
"lodash-es": "^4.
|
|
21
|
+
"lodash-es": "^4.18.1",
|
|
22
22
|
"swc-loader": "^0.2.6",
|
|
23
23
|
"tsx": "^4.19.2",
|
|
24
|
-
"@openfn/language-common": "3.
|
|
24
|
+
"@openfn/language-common": "3.3.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/mocha": "^10.0.10",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"rimraf": "3.0.2",
|
|
33
33
|
"ts-node": "10.9.1",
|
|
34
34
|
"typescript": "5.9.2",
|
|
35
|
-
"undici": "^7.
|
|
35
|
+
"undici": "^7.24.7"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|