@openfn/language-dhis2 7.0.2 → 7.1.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/ast.json +119 -0
- package/dist/index.cjs +6 -0
- package/dist/index.js +8 -2
- package/package.json +2 -2
- package/types/Adaptor.d.ts +1 -1
package/ast.json
CHANGED
|
@@ -1150,6 +1150,125 @@
|
|
|
1150
1150
|
]
|
|
1151
1151
|
},
|
|
1152
1152
|
"valid": false
|
|
1153
|
+
},
|
|
1154
|
+
{
|
|
1155
|
+
"name": "as",
|
|
1156
|
+
"params": [
|
|
1157
|
+
"key",
|
|
1158
|
+
"operation"
|
|
1159
|
+
],
|
|
1160
|
+
"docs": {
|
|
1161
|
+
"description": "Run an operation and save the result to a custom key in state instead of overwriting state.data.",
|
|
1162
|
+
"tags": [
|
|
1163
|
+
{
|
|
1164
|
+
"title": "public",
|
|
1165
|
+
"description": null,
|
|
1166
|
+
"type": null
|
|
1167
|
+
},
|
|
1168
|
+
{
|
|
1169
|
+
"title": "function",
|
|
1170
|
+
"description": null,
|
|
1171
|
+
"name": null
|
|
1172
|
+
},
|
|
1173
|
+
{
|
|
1174
|
+
"title": "example",
|
|
1175
|
+
"description": "as('cceData', collections.get('cce-data-dhis2', { key: `*:*:${$.syncedAt}*` }));",
|
|
1176
|
+
"caption": "Fetch cce-data from collections and store them under state.cceData"
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
"title": "param",
|
|
1180
|
+
"description": "The state key to assign the result of the operation to.",
|
|
1181
|
+
"type": {
|
|
1182
|
+
"type": "NameExpression",
|
|
1183
|
+
"name": "string"
|
|
1184
|
+
},
|
|
1185
|
+
"name": "key"
|
|
1186
|
+
},
|
|
1187
|
+
{
|
|
1188
|
+
"title": "param",
|
|
1189
|
+
"description": " An operation that returns a new state object with a `data` property",
|
|
1190
|
+
"type": {
|
|
1191
|
+
"type": "NameExpression",
|
|
1192
|
+
"name": "function"
|
|
1193
|
+
},
|
|
1194
|
+
"name": "operation"
|
|
1195
|
+
},
|
|
1196
|
+
{
|
|
1197
|
+
"title": "returns",
|
|
1198
|
+
"description": null,
|
|
1199
|
+
"type": {
|
|
1200
|
+
"type": "NameExpression",
|
|
1201
|
+
"name": "Operation"
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
]
|
|
1205
|
+
},
|
|
1206
|
+
"valid": true
|
|
1207
|
+
},
|
|
1208
|
+
{
|
|
1209
|
+
"name": "map",
|
|
1210
|
+
"params": {},
|
|
1211
|
+
"docs": {
|
|
1212
|
+
"description": "Iterates over a collection of items and returns a new array of mapped values,\nlike Javascript's `Array.map()` function.\n\nEach item in the source array will be passed into the callback function. The returned value\nwill be added to the new array. The callback is passed the original item, the current index\nin the source array (ie, the nth item number), and the state object.\n\nWrites a new array to `state.data` with transformed values.c array.",
|
|
1213
|
+
"tags": [
|
|
1214
|
+
{
|
|
1215
|
+
"title": "public",
|
|
1216
|
+
"description": null,
|
|
1217
|
+
"type": null
|
|
1218
|
+
},
|
|
1219
|
+
{
|
|
1220
|
+
"title": "function",
|
|
1221
|
+
"description": null,
|
|
1222
|
+
"name": null
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
"title": "example",
|
|
1226
|
+
"description": "map($.items', (data, index, state) => {\n return {\n id: index + 1,\n name: data.name,\n createdAt: state.cursor,\n };\n});",
|
|
1227
|
+
"caption": "Transform an array of items in state"
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
"title": "example",
|
|
1231
|
+
"description": "map($.items, async (data, index, state) => {\n const userInfo = await fetchUserInfo(data.userId);\n return {\n id: index + 1,\n name: data.name,\n extra: userInfo,\n };\n});",
|
|
1232
|
+
"caption": "Map items asynchronously (e.g. fetch extra info)"
|
|
1233
|
+
},
|
|
1234
|
+
{
|
|
1235
|
+
"title": "param",
|
|
1236
|
+
"description": "An array of items or a a JSONPath string which points to an array of items.",
|
|
1237
|
+
"type": {
|
|
1238
|
+
"type": "UnionType",
|
|
1239
|
+
"elements": [
|
|
1240
|
+
{
|
|
1241
|
+
"type": "NameExpression",
|
|
1242
|
+
"name": "string"
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
"type": "NameExpression",
|
|
1246
|
+
"name": "Array"
|
|
1247
|
+
}
|
|
1248
|
+
]
|
|
1249
|
+
},
|
|
1250
|
+
"name": "path"
|
|
1251
|
+
},
|
|
1252
|
+
{
|
|
1253
|
+
"title": "param",
|
|
1254
|
+
"description": "The mapping function, invoked with `(data, index, state)` for each item in the array.",
|
|
1255
|
+
"type": {
|
|
1256
|
+
"type": "NameExpression",
|
|
1257
|
+
"name": "function"
|
|
1258
|
+
},
|
|
1259
|
+
"name": "callback"
|
|
1260
|
+
},
|
|
1261
|
+
{
|
|
1262
|
+
"title": "returns",
|
|
1263
|
+
"description": null,
|
|
1264
|
+
"type": {
|
|
1265
|
+
"type": "NameExpression",
|
|
1266
|
+
"name": "State"
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
]
|
|
1270
|
+
},
|
|
1271
|
+
"valid": false
|
|
1153
1272
|
}
|
|
1154
1273
|
]
|
|
1155
1274
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -26,6 +26,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
26
26
|
var src_exports = {};
|
|
27
27
|
__export(src_exports, {
|
|
28
28
|
alterState: () => import_language_common3.alterState,
|
|
29
|
+
as: () => import_language_common3.as,
|
|
29
30
|
create: () => create,
|
|
30
31
|
cursor: () => import_language_common3.cursor,
|
|
31
32
|
dataPath: () => import_language_common3.dataPath,
|
|
@@ -43,6 +44,7 @@ __export(src_exports, {
|
|
|
43
44
|
group: () => import_language_common3.group,
|
|
44
45
|
http: () => http_exports,
|
|
45
46
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
47
|
+
map: () => import_language_common3.map,
|
|
46
48
|
merge: () => import_language_common3.merge,
|
|
47
49
|
metadata: () => metadata_default,
|
|
48
50
|
sourceValue: () => import_language_common3.sourceValue,
|
|
@@ -285,6 +287,7 @@ var metadata_default = metadata;
|
|
|
285
287
|
var Adaptor_exports = {};
|
|
286
288
|
__export(Adaptor_exports, {
|
|
287
289
|
alterState: () => import_language_common3.alterState,
|
|
290
|
+
as: () => import_language_common3.as,
|
|
288
291
|
create: () => create,
|
|
289
292
|
cursor: () => import_language_common3.cursor,
|
|
290
293
|
dataPath: () => import_language_common3.dataPath,
|
|
@@ -301,6 +304,7 @@ __export(Adaptor_exports, {
|
|
|
301
304
|
group: () => import_language_common3.group,
|
|
302
305
|
http: () => import_language_common3.http,
|
|
303
306
|
lastReferenceValue: () => import_language_common3.lastReferenceValue,
|
|
307
|
+
map: () => import_language_common3.map,
|
|
304
308
|
merge: () => import_language_common3.merge,
|
|
305
309
|
sourceValue: () => import_language_common3.sourceValue,
|
|
306
310
|
update: () => update,
|
|
@@ -719,6 +723,7 @@ var src_default = Adaptor_exports;
|
|
|
719
723
|
// Annotate the CommonJS export names for ESM import in node:
|
|
720
724
|
0 && (module.exports = {
|
|
721
725
|
alterState,
|
|
726
|
+
as,
|
|
722
727
|
create,
|
|
723
728
|
cursor,
|
|
724
729
|
dataPath,
|
|
@@ -735,6 +740,7 @@ var src_default = Adaptor_exports;
|
|
|
735
740
|
group,
|
|
736
741
|
http,
|
|
737
742
|
lastReferenceValue,
|
|
743
|
+
map,
|
|
738
744
|
merge,
|
|
739
745
|
metadata,
|
|
740
746
|
sourceValue,
|
package/dist/index.js
CHANGED
|
@@ -240,6 +240,7 @@ var metadata_default = metadata;
|
|
|
240
240
|
var Adaptor_exports = {};
|
|
241
241
|
__export(Adaptor_exports, {
|
|
242
242
|
alterState: () => alterState,
|
|
243
|
+
as: () => as,
|
|
243
244
|
create: () => create,
|
|
244
245
|
cursor: () => cursor,
|
|
245
246
|
dataPath: () => dataPath,
|
|
@@ -256,6 +257,7 @@ __export(Adaptor_exports, {
|
|
|
256
257
|
group: () => group,
|
|
257
258
|
http: () => http,
|
|
258
259
|
lastReferenceValue: () => lastReferenceValue,
|
|
260
|
+
map: () => map,
|
|
259
261
|
merge: () => merge,
|
|
260
262
|
sourceValue: () => sourceValue,
|
|
261
263
|
update: () => update,
|
|
@@ -265,18 +267,20 @@ import { execute as commonExecute } from "@openfn/language-common";
|
|
|
265
267
|
import { expandReferences, throwError } from "@openfn/language-common/util";
|
|
266
268
|
import {
|
|
267
269
|
alterState,
|
|
270
|
+
as,
|
|
271
|
+
cursor,
|
|
268
272
|
dataPath,
|
|
269
273
|
dataValue,
|
|
270
274
|
dateFns,
|
|
271
|
-
cursor,
|
|
272
275
|
each,
|
|
273
276
|
field,
|
|
274
277
|
fields,
|
|
275
278
|
fn,
|
|
276
279
|
fnIf,
|
|
277
|
-
http,
|
|
278
280
|
group,
|
|
281
|
+
http,
|
|
279
282
|
lastReferenceValue,
|
|
283
|
+
map,
|
|
280
284
|
merge,
|
|
281
285
|
sourceValue
|
|
282
286
|
} from "@openfn/language-common";
|
|
@@ -689,6 +693,7 @@ function _export(path, query, options = {}) {
|
|
|
689
693
|
var src_default = Adaptor_exports;
|
|
690
694
|
export {
|
|
691
695
|
alterState,
|
|
696
|
+
as,
|
|
692
697
|
create,
|
|
693
698
|
cursor,
|
|
694
699
|
dataPath,
|
|
@@ -706,6 +711,7 @@ export {
|
|
|
706
711
|
group,
|
|
707
712
|
http_exports as http,
|
|
708
713
|
lastReferenceValue,
|
|
714
|
+
map,
|
|
709
715
|
merge,
|
|
710
716
|
metadata_default as metadata,
|
|
711
717
|
sourceValue,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfn/language-dhis2",
|
|
3
3
|
"label": "DHIS2",
|
|
4
|
-
"version": "7.0
|
|
4
|
+
"version": "7.1.0",
|
|
5
5
|
"description": "DHIS2 Language Pack for OpenFn",
|
|
6
6
|
"homepage": "https://docs.openfn.org",
|
|
7
7
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"axios": "^1.8.2",
|
|
30
30
|
"lodash": "^4.17.21",
|
|
31
31
|
"qs": "^6.11.0",
|
|
32
|
-
"@openfn/language-common": "
|
|
32
|
+
"@openfn/language-common": "3.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"assertion-error": "2.0.0",
|
package/types/Adaptor.d.ts
CHANGED
|
@@ -365,4 +365,4 @@ export type RequestOptions = {
|
|
|
365
365
|
*/
|
|
366
366
|
apiVersion?: string;
|
|
367
367
|
};
|
|
368
|
-
export { alterState, dataPath, dataValue, dateFns,
|
|
368
|
+
export { alterState, as, cursor, dataPath, dataValue, dateFns, each, field, fields, fn, fnIf, group, http, lastReferenceValue, map, merge, sourceValue } from "@openfn/language-common";
|