@openfn/language-godata 3.5.4 → 3.5.6
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/dist/index.cjs +7 -5
- package/dist/index.js +8 -7
- package/package.json +4 -5
package/dist/index.cjs
CHANGED
|
@@ -90,6 +90,7 @@ __export(Adaptor_exports, {
|
|
|
90
90
|
upsertReferenceData: () => upsertReferenceData
|
|
91
91
|
});
|
|
92
92
|
var import_language_common = require("@openfn/language-common");
|
|
93
|
+
var import_util = require("@openfn/language-common/util");
|
|
93
94
|
var import_axios = __toESM(require("axios"), 1);
|
|
94
95
|
var import_language_common2 = require("@openfn/language-common");
|
|
95
96
|
function execute(...operations) {
|
|
@@ -170,7 +171,7 @@ function getContact(id, query, callback) {
|
|
|
170
171
|
function upsertContact(id, externalId, goDataContact, callback) {
|
|
171
172
|
return (state) => {
|
|
172
173
|
const { apiUrl, access_token } = state.configuration;
|
|
173
|
-
const data = (0,
|
|
174
|
+
const [data] = (0, import_util.expandReferences)(state, goDataContact);
|
|
174
175
|
const query = { where: {} };
|
|
175
176
|
query.where[externalId] = data[externalId];
|
|
176
177
|
const filter = JSON.stringify(query);
|
|
@@ -274,7 +275,8 @@ function getOutbreak(query, callback) {
|
|
|
274
275
|
function upsertOutbreak(outbreak, callback) {
|
|
275
276
|
return (state) => {
|
|
276
277
|
const { apiUrl, access_token } = state.configuration;
|
|
277
|
-
const
|
|
278
|
+
const [resolvedOutbreak] = (0, import_util.expandReferences)(state, outbreak);
|
|
279
|
+
const { externalId, data } = resolvedOutbreak;
|
|
278
280
|
const filter = JSON.stringify({ where: { id: externalId } });
|
|
279
281
|
return (0, import_axios.default)({
|
|
280
282
|
method: "GET",
|
|
@@ -373,7 +375,7 @@ function getCase(id, query, callback) {
|
|
|
373
375
|
function upsertCase(id, externalId, goDataCase, callback) {
|
|
374
376
|
return (state) => {
|
|
375
377
|
const { apiUrl, access_token } = state.configuration;
|
|
376
|
-
const data = (0,
|
|
378
|
+
const [data] = (0, import_util.expandReferences)(state, goDataCase);
|
|
377
379
|
const query = { where: {} };
|
|
378
380
|
query.where[externalId] = data[externalId];
|
|
379
381
|
const filter = JSON.stringify(query);
|
|
@@ -478,7 +480,7 @@ function getLocation(query, callback) {
|
|
|
478
480
|
function upsertLocation(externalId, goDataLocation, callback) {
|
|
479
481
|
return (state) => {
|
|
480
482
|
const { apiUrl, access_token } = state.configuration;
|
|
481
|
-
const data = (0,
|
|
483
|
+
const [data] = (0, import_util.expandReferences)(state, goDataLocation);
|
|
482
484
|
const query = { where: {} };
|
|
483
485
|
query.where[externalId] = data[externalId];
|
|
484
486
|
const filter = JSON.stringify(query);
|
|
@@ -585,7 +587,7 @@ function getReferenceData(query, callback) {
|
|
|
585
587
|
function upsertReferenceData(externalId, goDataReferenceData, callback) {
|
|
586
588
|
return (state) => {
|
|
587
589
|
const { apiUrl, access_token } = state.configuration;
|
|
588
|
-
const data = (0,
|
|
590
|
+
const [data] = (0, import_util.expandReferences)(state, goDataReferenceData);
|
|
589
591
|
const query = { where: {} };
|
|
590
592
|
query.where[externalId] = data[externalId];
|
|
591
593
|
const filter = JSON.stringify(query);
|
package/dist/index.js
CHANGED
|
@@ -38,9 +38,9 @@ __export(Adaptor_exports, {
|
|
|
38
38
|
});
|
|
39
39
|
import {
|
|
40
40
|
execute as commonExecute,
|
|
41
|
-
composeNextState
|
|
42
|
-
expandReferences
|
|
41
|
+
composeNextState
|
|
43
42
|
} from "@openfn/language-common";
|
|
43
|
+
import { expandReferences } from "@openfn/language-common/util";
|
|
44
44
|
import axios from "axios";
|
|
45
45
|
import {
|
|
46
46
|
fn,
|
|
@@ -133,7 +133,7 @@ function getContact(id, query, callback) {
|
|
|
133
133
|
function upsertContact(id, externalId, goDataContact, callback) {
|
|
134
134
|
return (state) => {
|
|
135
135
|
const { apiUrl, access_token } = state.configuration;
|
|
136
|
-
const data = expandReferences(goDataContact)
|
|
136
|
+
const [data] = expandReferences(state, goDataContact);
|
|
137
137
|
const query = { where: {} };
|
|
138
138
|
query.where[externalId] = data[externalId];
|
|
139
139
|
const filter = JSON.stringify(query);
|
|
@@ -237,7 +237,8 @@ function getOutbreak(query, callback) {
|
|
|
237
237
|
function upsertOutbreak(outbreak, callback) {
|
|
238
238
|
return (state) => {
|
|
239
239
|
const { apiUrl, access_token } = state.configuration;
|
|
240
|
-
const
|
|
240
|
+
const [resolvedOutbreak] = expandReferences(state, outbreak);
|
|
241
|
+
const { externalId, data } = resolvedOutbreak;
|
|
241
242
|
const filter = JSON.stringify({ where: { id: externalId } });
|
|
242
243
|
return axios({
|
|
243
244
|
method: "GET",
|
|
@@ -336,7 +337,7 @@ function getCase(id, query, callback) {
|
|
|
336
337
|
function upsertCase(id, externalId, goDataCase, callback) {
|
|
337
338
|
return (state) => {
|
|
338
339
|
const { apiUrl, access_token } = state.configuration;
|
|
339
|
-
const data = expandReferences(goDataCase)
|
|
340
|
+
const [data] = expandReferences(state, goDataCase);
|
|
340
341
|
const query = { where: {} };
|
|
341
342
|
query.where[externalId] = data[externalId];
|
|
342
343
|
const filter = JSON.stringify(query);
|
|
@@ -441,7 +442,7 @@ function getLocation(query, callback) {
|
|
|
441
442
|
function upsertLocation(externalId, goDataLocation, callback) {
|
|
442
443
|
return (state) => {
|
|
443
444
|
const { apiUrl, access_token } = state.configuration;
|
|
444
|
-
const data = expandReferences(goDataLocation)
|
|
445
|
+
const [data] = expandReferences(state, goDataLocation);
|
|
445
446
|
const query = { where: {} };
|
|
446
447
|
query.where[externalId] = data[externalId];
|
|
447
448
|
const filter = JSON.stringify(query);
|
|
@@ -548,7 +549,7 @@ function getReferenceData(query, callback) {
|
|
|
548
549
|
function upsertReferenceData(externalId, goDataReferenceData, callback) {
|
|
549
550
|
return (state) => {
|
|
550
551
|
const { apiUrl, access_token } = state.configuration;
|
|
551
|
-
const data = expandReferences(goDataReferenceData)
|
|
552
|
+
const [data] = expandReferences(state, goDataReferenceData);
|
|
552
553
|
const query = { where: {} };
|
|
553
554
|
query.where[externalId] = data[externalId];
|
|
554
555
|
const filter = JSON.stringify(query);
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-godata",
|
|
3
|
-
"
|
|
3
|
+
"label": "GoData",
|
|
4
|
+
"version": "3.5.6",
|
|
4
5
|
"description": "An OpenFn adaptor for use with the WHO's GoData API",
|
|
5
6
|
"main": "dist/index.cjs",
|
|
6
7
|
"author": "Open Function Group",
|
|
@@ -12,15 +13,13 @@
|
|
|
12
13
|
"configuration-schema.json"
|
|
13
14
|
],
|
|
14
15
|
"dependencies": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
16
|
+
"axios": "^1.7.7",
|
|
17
|
+
"@openfn/language-common": "3.0.1"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
|
-
"@openfn/simple-ast": "0.4.1",
|
|
20
20
|
"assertion-error": "^1.0.1",
|
|
21
21
|
"chai": "^3.4.0",
|
|
22
22
|
"deep-eql": "^0.1.3",
|
|
23
|
-
"esno": "^0.16.3",
|
|
24
23
|
"nock": "^12.0.3",
|
|
25
24
|
"rimraf": "^3.0.2",
|
|
26
25
|
"sinon": "^1.17.2"
|