@openfn/language-godata 3.2.0
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/LICENSE +674 -0
- package/LICENSE.LESSER +165 -0
- package/README.md +266 -0
- package/ast.json +1226 -0
- package/configuration-schema.json +34 -0
- package/dist/index.cjs +678 -0
- package/dist/index.js +641 -0
- package/package.json +50 -0
- package/types/Adaptor.d.ts +253 -0
- package/types/index.d.ts +3 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execute a sequence of operations.
|
|
3
|
+
* Wraps `language-common/execute`, and prepends initial state for http.
|
|
4
|
+
* @example
|
|
5
|
+
* execute(
|
|
6
|
+
* create('foo'),
|
|
7
|
+
* delete('bar')
|
|
8
|
+
* )(state)
|
|
9
|
+
* @constructor
|
|
10
|
+
* @param {Operations} operations - Operations to be performed.
|
|
11
|
+
* @returns {Operation}
|
|
12
|
+
*/
|
|
13
|
+
export function execute(...operations: Operations): Operation;
|
|
14
|
+
export class execute {
|
|
15
|
+
/**
|
|
16
|
+
* Execute a sequence of operations.
|
|
17
|
+
* Wraps `language-common/execute`, and prepends initial state for http.
|
|
18
|
+
* @example
|
|
19
|
+
* execute(
|
|
20
|
+
* create('foo'),
|
|
21
|
+
* delete('bar')
|
|
22
|
+
* )(state)
|
|
23
|
+
* @constructor
|
|
24
|
+
* @param {Operations} operations - Operations to be performed.
|
|
25
|
+
* @returns {Operation}
|
|
26
|
+
*/
|
|
27
|
+
constructor(...operations: Operations);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Fetch the list of contacts within a particular outbreak using its ID.
|
|
31
|
+
* @public
|
|
32
|
+
* @example
|
|
33
|
+
* listContacts("343d-dc3e", // Outbreak Id
|
|
34
|
+
* state => {
|
|
35
|
+
* console.log(state);
|
|
36
|
+
* return state;
|
|
37
|
+
* });
|
|
38
|
+
* @function
|
|
39
|
+
* @param {string} id - Outbreak id
|
|
40
|
+
* @param {function} callback - (Optional) Callback function
|
|
41
|
+
* @returns {Operation}
|
|
42
|
+
*/
|
|
43
|
+
export function listContacts(id: string, callback: Function): Operation;
|
|
44
|
+
/**
|
|
45
|
+
* Get one or multiple contacts within an outbreak from a query filter
|
|
46
|
+
* @public
|
|
47
|
+
* @example
|
|
48
|
+
* getContact("343d-dc3e", {"where":{"firstName": "Luca"}}, state => {
|
|
49
|
+
* console.log(state.data);
|
|
50
|
+
* return state;
|
|
51
|
+
* });
|
|
52
|
+
* @function
|
|
53
|
+
* @param {string} id - Outbreak id
|
|
54
|
+
* @param {object} query - An object with a query filter parameter
|
|
55
|
+
* @param {function} callback - (Optional) Callback function
|
|
56
|
+
* @returns {Operation}
|
|
57
|
+
*/
|
|
58
|
+
export function getContact(id: string, query: object, callback: Function): Operation;
|
|
59
|
+
/**
|
|
60
|
+
* Upsert contact to godata using an external id to match a specific record.
|
|
61
|
+
* @public
|
|
62
|
+
* @example
|
|
63
|
+
* upsertContact("4dce-3eedce3-rd33", 'visualId',
|
|
64
|
+
* {
|
|
65
|
+
* firstName: 'Luca',
|
|
66
|
+
* gender: 'male',
|
|
67
|
+
* 'age:years': '20'
|
|
68
|
+
* ...
|
|
69
|
+
* }
|
|
70
|
+
* )
|
|
71
|
+
* @function
|
|
72
|
+
* @param {string} id - Outbreak id
|
|
73
|
+
* @param {string} externalId - External Id to match
|
|
74
|
+
* @param {object} goDataContact - an object with some case data.
|
|
75
|
+
* @param {function} callback - (Optional) Callback function
|
|
76
|
+
* @returns {Operation}
|
|
77
|
+
*/
|
|
78
|
+
export function upsertContact(id: string, externalId: string, goDataContact: object, callback: Function): Operation;
|
|
79
|
+
/**
|
|
80
|
+
* Fetch the list of outbreaks
|
|
81
|
+
* @public
|
|
82
|
+
* @example
|
|
83
|
+
* listOutbreaks(state => {
|
|
84
|
+
* console.log(state.data);
|
|
85
|
+
* return state;
|
|
86
|
+
* });
|
|
87
|
+
* @function
|
|
88
|
+
* @param {function} callback - (Optional) Callback function
|
|
89
|
+
* @returns {Operation}
|
|
90
|
+
*/
|
|
91
|
+
export function listOutbreaks(callback: Function): Operation;
|
|
92
|
+
/**
|
|
93
|
+
* Get one or multiple outbreaks from a query filter
|
|
94
|
+
* @public
|
|
95
|
+
* @example
|
|
96
|
+
* getOutbreak({"where":{"name": "Outbreak demo"}}, state => {
|
|
97
|
+
* console.log(state.data);
|
|
98
|
+
* return state;
|
|
99
|
+
* });
|
|
100
|
+
* @function
|
|
101
|
+
* @param {object} query - An object with a query filter parameter
|
|
102
|
+
* @param {function} callback - (Optional) Callback function
|
|
103
|
+
* @returns {Operation}
|
|
104
|
+
*/
|
|
105
|
+
export function getOutbreak(query: object, callback: Function): Operation;
|
|
106
|
+
/**
|
|
107
|
+
* Upsert outbreak to godata
|
|
108
|
+
* @public
|
|
109
|
+
* @example
|
|
110
|
+
* upsertOutbreak({externalId: "3dec33-ede3", data: {...}})
|
|
111
|
+
* @function
|
|
112
|
+
* @param {object} outbreak - an object with an externalId and some outbreak data.
|
|
113
|
+
* @param {function} callback - (Optional) Callback function
|
|
114
|
+
* @returns {Operation}
|
|
115
|
+
*/
|
|
116
|
+
export function upsertOutbreak(outbreak: object, callback: Function): Operation;
|
|
117
|
+
/**
|
|
118
|
+
* Fetch the list of cases within a particular outbreak using its ID.
|
|
119
|
+
* @public
|
|
120
|
+
* @example
|
|
121
|
+
* listCases("343d-dc3e", state => {
|
|
122
|
+
* console.log(state);
|
|
123
|
+
* return state;
|
|
124
|
+
* });
|
|
125
|
+
* @function
|
|
126
|
+
* @param {string} id - Outbreak id
|
|
127
|
+
* @param {function} callback - (Optional) Callback function
|
|
128
|
+
* @returns {Operation}
|
|
129
|
+
*/
|
|
130
|
+
export function listCases(id: string, callback: Function): Operation;
|
|
131
|
+
/**
|
|
132
|
+
* Get one or multiple cases within an outbreak from a query filter
|
|
133
|
+
* @public
|
|
134
|
+
* @example
|
|
135
|
+
* getCase(
|
|
136
|
+
* '3b55-cdf4',
|
|
137
|
+
* { 'where.relationship': { active: true }, where: { firstName: 'Luca'} },
|
|
138
|
+
* state => {
|
|
139
|
+
* console.log(state);
|
|
140
|
+
* return state;
|
|
141
|
+
* }
|
|
142
|
+
* );
|
|
143
|
+
* @function
|
|
144
|
+
* @param {string} id - Outbreak id
|
|
145
|
+
* @param {object} query - An object with a query filter parameter
|
|
146
|
+
* @param {function} callback - (Optional) Callback function
|
|
147
|
+
* @returns {Operation}
|
|
148
|
+
*/
|
|
149
|
+
export function getCase(id: string, query: object, callback: Function): Operation;
|
|
150
|
+
/**
|
|
151
|
+
* Upsert case to godata using an external id to mach a specific record
|
|
152
|
+
* @public
|
|
153
|
+
* @example
|
|
154
|
+
* upsertCase("4dce-3eedce3-rd33", 'visualId',
|
|
155
|
+
* data: state => {
|
|
156
|
+
* const patient = state.data.body;
|
|
157
|
+
* return {
|
|
158
|
+
* firstName: patient.Patient_name.split(' ')[0],
|
|
159
|
+
* lastName: patient.Patient_name.split(' ')[1],
|
|
160
|
+
* visualId: patient.Case_ID,
|
|
161
|
+
* 'age:years': patient.Age_in_year,
|
|
162
|
+
* gender: patient.Sex,
|
|
163
|
+
* };
|
|
164
|
+
* })
|
|
165
|
+
* @function
|
|
166
|
+
* @param {string} id - Outbreak id
|
|
167
|
+
* @param {string} externalId - External Id to match
|
|
168
|
+
* @param {object} goDataCase - an object with some case data.
|
|
169
|
+
* @param {function} callback - (Optional) Callback function
|
|
170
|
+
* @returns {Operation}
|
|
171
|
+
*/
|
|
172
|
+
export function upsertCase(id: string, externalId: string, goDataCase: object, callback: Function): Operation;
|
|
173
|
+
/**
|
|
174
|
+
* Fetch the list of locations
|
|
175
|
+
* @public
|
|
176
|
+
* @example
|
|
177
|
+
* listLocations(state => {
|
|
178
|
+
* console.log(state.data);
|
|
179
|
+
* return state;
|
|
180
|
+
* });
|
|
181
|
+
* @function
|
|
182
|
+
* @param {function} callback - (Optional) Callback function
|
|
183
|
+
* @returns {Operation}
|
|
184
|
+
*/
|
|
185
|
+
export function listLocations(callback: Function): Operation;
|
|
186
|
+
/**
|
|
187
|
+
* Get one or multiple locations from a query filter
|
|
188
|
+
* @public
|
|
189
|
+
* @example
|
|
190
|
+
* getLocation({"where":{"name": "30 DE OCTUBRE"}}, state => {
|
|
191
|
+
* console.log(state.data);
|
|
192
|
+
* return state;
|
|
193
|
+
* });
|
|
194
|
+
* @function
|
|
195
|
+
* @param {object} query - An object with a query filter parameter
|
|
196
|
+
* @param {function} callback - (Optional) Callback function
|
|
197
|
+
* @returns {Operation}
|
|
198
|
+
*/
|
|
199
|
+
export function getLocation(query: object, callback: Function): Operation;
|
|
200
|
+
/**
|
|
201
|
+
* Upsert location to godata
|
|
202
|
+
* @public
|
|
203
|
+
* @example
|
|
204
|
+
* upsertLocation('name', {...})
|
|
205
|
+
* @function
|
|
206
|
+
* @param {string} externalId - External Id to match
|
|
207
|
+
* @param {object} goDataLocation - an object with some location data.
|
|
208
|
+
* @param {function} callback - (Optional) Callback function
|
|
209
|
+
* @returns {Operation}
|
|
210
|
+
*/
|
|
211
|
+
export function upsertLocation(externalId: string, goDataLocation: object, callback: Function): Operation;
|
|
212
|
+
/**
|
|
213
|
+
* Fetch the list of reference data
|
|
214
|
+
* @public
|
|
215
|
+
* @example
|
|
216
|
+
* listReferenceData(state => {
|
|
217
|
+
* console.log(state.data);
|
|
218
|
+
* return state;
|
|
219
|
+
* });
|
|
220
|
+
* @function
|
|
221
|
+
* @param {function} callback - (Optional) Callback function
|
|
222
|
+
* @returns {Operation}
|
|
223
|
+
*/
|
|
224
|
+
export function listReferenceData(callback: Function): Operation;
|
|
225
|
+
/**
|
|
226
|
+
* Get one or multiple reference data from a query filter
|
|
227
|
+
* @public
|
|
228
|
+
* @example
|
|
229
|
+
* getReferenceData({"where":{"categoryId": "LNG_REFERENCE_DATA_CATEGORY_CENTRE_NAME"}}, state => {
|
|
230
|
+
* console.log(state.data);
|
|
231
|
+
* return state;
|
|
232
|
+
* });
|
|
233
|
+
* @function
|
|
234
|
+
* @param {object} query - An object with a query filter parameter
|
|
235
|
+
* @param {function} callback - (Optional) Callback function
|
|
236
|
+
* @returns {Operation}
|
|
237
|
+
*/
|
|
238
|
+
export function getReferenceData(query: object, callback: Function): Operation;
|
|
239
|
+
/**
|
|
240
|
+
* Upsert reference data to godata
|
|
241
|
+
* @public
|
|
242
|
+
* @example
|
|
243
|
+
* upsertReferenceData('id', {...})
|
|
244
|
+
* @function
|
|
245
|
+
* @param {string} externalId - External Id to match
|
|
246
|
+
* @param {object} goDataReferenceData - an object with some reference data.
|
|
247
|
+
* @param {function} callback - (Optional) Callback function
|
|
248
|
+
* @returns {Operation}
|
|
249
|
+
*/
|
|
250
|
+
export function upsertReferenceData(externalId: string, goDataReferenceData: object, callback: Function): Operation;
|
|
251
|
+
export { axios };
|
|
252
|
+
import axios from "axios";
|
|
253
|
+
export { alterState, dataPath, dataValue, each, field, fields, lastReferenceValue, merge, sourceValue } from "@openfn/language-common";
|
package/types/index.d.ts
ADDED