@openfn/language-opencrvs 1.0.5 → 1.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 +56 -0
- package/dist/index.cjs +12 -0
- package/dist/index.js +11 -0
- package/package.json +3 -3
- package/types/Adaptor.d.ts +11 -0
- package/types/index.d.ts +3 -3
package/ast.json
CHANGED
|
@@ -115,6 +115,62 @@
|
|
|
115
115
|
]
|
|
116
116
|
},
|
|
117
117
|
"valid": true
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "createDocumentEntry",
|
|
121
|
+
"params": [
|
|
122
|
+
"resource",
|
|
123
|
+
"fullUrl"
|
|
124
|
+
],
|
|
125
|
+
"docs": {
|
|
126
|
+
"description": "Create a document bundle entry with automatic UUID generation",
|
|
127
|
+
"tags": [
|
|
128
|
+
{
|
|
129
|
+
"title": "example",
|
|
130
|
+
"description": "createDocumentEntry(builders.patient({ name: [{ given: ['John'] }] }))"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"title": "function",
|
|
134
|
+
"description": null,
|
|
135
|
+
"name": null
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"title": "public",
|
|
139
|
+
"description": null,
|
|
140
|
+
"type": null
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"title": "param",
|
|
144
|
+
"description": "A FHIR resource using builders from fhir-4",
|
|
145
|
+
"type": {
|
|
146
|
+
"type": "NameExpression",
|
|
147
|
+
"name": "Object"
|
|
148
|
+
},
|
|
149
|
+
"name": "resource"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"title": "param",
|
|
153
|
+
"description": "Custom fullUrl. Auto-generated if not provided",
|
|
154
|
+
"type": {
|
|
155
|
+
"type": "OptionalType",
|
|
156
|
+
"expression": {
|
|
157
|
+
"type": "NameExpression",
|
|
158
|
+
"name": "string"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"name": "fullUrl"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"title": "returns",
|
|
165
|
+
"description": "Bundle entry with fullUrl and resource",
|
|
166
|
+
"type": {
|
|
167
|
+
"type": "NameExpression",
|
|
168
|
+
"name": "Object"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
"valid": true
|
|
118
174
|
}
|
|
119
175
|
],
|
|
120
176
|
"exports": [],
|
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ __export(src_exports, {
|
|
|
22
22
|
builders: () => import_language_fhir_4.builders,
|
|
23
23
|
combine: () => import_language_common3.combine,
|
|
24
24
|
createBirthNotification: () => createBirthNotification,
|
|
25
|
+
createDocumentEntry: () => createDocumentEntry,
|
|
25
26
|
cursor: () => import_language_common3.cursor,
|
|
26
27
|
dataPath: () => import_language_common3.dataPath,
|
|
27
28
|
dataValue: () => import_language_common3.dataValue,
|
|
@@ -50,6 +51,7 @@ __export(Adaptor_exports, {
|
|
|
50
51
|
builders: () => import_language_fhir_4.builders,
|
|
51
52
|
combine: () => import_language_common3.combine,
|
|
52
53
|
createBirthNotification: () => createBirthNotification,
|
|
54
|
+
createDocumentEntry: () => createDocumentEntry,
|
|
53
55
|
cursor: () => import_language_common3.cursor,
|
|
54
56
|
dataPath: () => import_language_common3.dataPath,
|
|
55
57
|
dataValue: () => import_language_common3.dataValue,
|
|
@@ -289,6 +291,15 @@ function queryEvents(variables, options = {}) {
|
|
|
289
291
|
});
|
|
290
292
|
};
|
|
291
293
|
}
|
|
294
|
+
function createDocumentEntry(resource, fullUrl) {
|
|
295
|
+
const uuid = fullUrl || `urn:uuid:${crypto.randomUUID()}`;
|
|
296
|
+
return {
|
|
297
|
+
fullUrl: uuid,
|
|
298
|
+
resource: {
|
|
299
|
+
...resource
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
}
|
|
292
303
|
|
|
293
304
|
// src/http.js
|
|
294
305
|
var http_exports = {};
|
|
@@ -323,6 +334,7 @@ var src_default = Adaptor_exports;
|
|
|
323
334
|
builders,
|
|
324
335
|
combine,
|
|
325
336
|
createBirthNotification,
|
|
337
|
+
createDocumentEntry,
|
|
326
338
|
cursor,
|
|
327
339
|
dataPath,
|
|
328
340
|
dataValue,
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ __export(Adaptor_exports, {
|
|
|
10
10
|
builders: () => builders,
|
|
11
11
|
combine: () => combine,
|
|
12
12
|
createBirthNotification: () => createBirthNotification,
|
|
13
|
+
createDocumentEntry: () => createDocumentEntry,
|
|
13
14
|
cursor: () => cursor,
|
|
14
15
|
dataPath: () => dataPath,
|
|
15
16
|
dataValue: () => dataValue,
|
|
@@ -270,6 +271,15 @@ function queryEvents(variables, options = {}) {
|
|
|
270
271
|
});
|
|
271
272
|
};
|
|
272
273
|
}
|
|
274
|
+
function createDocumentEntry(resource, fullUrl) {
|
|
275
|
+
const uuid = fullUrl || `urn:uuid:${crypto.randomUUID()}`;
|
|
276
|
+
return {
|
|
277
|
+
fullUrl: uuid,
|
|
278
|
+
resource: {
|
|
279
|
+
...resource
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
273
283
|
|
|
274
284
|
// src/http.js
|
|
275
285
|
var http_exports = {};
|
|
@@ -303,6 +313,7 @@ export {
|
|
|
303
313
|
builders,
|
|
304
314
|
combine,
|
|
305
315
|
createBirthNotification,
|
|
316
|
+
createDocumentEntry,
|
|
306
317
|
cursor,
|
|
307
318
|
dataPath,
|
|
308
319
|
dataValue,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-opencrvs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "OpenFn adaptor for OpenCRVS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"configuration-schema.json"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@openfn/language-common": "3.1.
|
|
24
|
-
"@openfn/language-fhir-4": "0.
|
|
23
|
+
"@openfn/language-common": "3.1.1",
|
|
24
|
+
"@openfn/language-fhir-4": "0.2.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"assertion-error": "2.0.0",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -108,6 +108,17 @@ export function createBirthNotification(body: any[]): Operation;
|
|
|
108
108
|
* @state {OpenCRVSState}
|
|
109
109
|
*/
|
|
110
110
|
export function queryEvents(variables: any, options?: any): Operation;
|
|
111
|
+
/**
|
|
112
|
+
* Create a document bundle entry with automatic UUID generation
|
|
113
|
+
* @example
|
|
114
|
+
* createDocumentEntry(builders.patient({ name: [{ given: ['John'] }] }))
|
|
115
|
+
* @function
|
|
116
|
+
* @public
|
|
117
|
+
* @param {Object} resource - A FHIR resource using builders from fhir-4
|
|
118
|
+
* @param {string} [fullUrl] - Custom fullUrl. Auto-generated if not provided
|
|
119
|
+
* @returns {Object} Bundle entry with fullUrl and resource
|
|
120
|
+
*/
|
|
121
|
+
export function createDocumentEntry(resource: any, fullUrl?: string): any;
|
|
111
122
|
export { builders } from "@openfn/language-fhir-4";
|
|
112
123
|
/**
|
|
113
124
|
* State object
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export default Adaptor;
|
|
2
|
-
export * from "./Adaptor";
|
|
3
|
-
export * as http from "./http";
|
|
4
|
-
import * as Adaptor from "./Adaptor";
|
|
2
|
+
export * from "./Adaptor.js";
|
|
3
|
+
export * as http from "./http.js";
|
|
4
|
+
import * as Adaptor from "./Adaptor.js";
|