@openfn/language-dhis2 2.0.8 → 3.0.0-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.
Files changed (44) hide show
  1. package/README.md +39 -4
  2. package/ast.json +295 -2430
  3. package/lib/Adaptor.js +475 -1519
  4. package/lib/Client.js +32 -0
  5. package/lib/Utils.js +124 -175
  6. package/lib/index.js +4 -6
  7. package/node_modules/@openfn/language-common/node_modules/axios/package.json +20 -0
  8. package/node_modules/@openfn/language-common/node_modules/follow-redirects/package.json +20 -0
  9. package/node_modules/@openfn/language-common/node_modules/jsonpath-plus/package.json +20 -0
  10. package/node_modules/@openfn/language-common/node_modules/lodash/package.json +20 -0
  11. package/node_modules/@openfn/language-common/package.json +8 -4
  12. package/node_modules/axios/CHANGELOG.md +159 -8
  13. package/node_modules/axios/README.md +98 -6
  14. package/node_modules/axios/SECURITY.md +5 -0
  15. package/node_modules/axios/dist/axios.js +2101 -1582
  16. package/node_modules/axios/dist/axios.map +1 -1
  17. package/node_modules/axios/dist/axios.min.js +1 -2
  18. package/node_modules/axios/dist/axios.min.map +1 -1
  19. package/node_modules/axios/index.d.ts +76 -31
  20. package/node_modules/axios/lib/adapters/http.js +74 -14
  21. package/node_modules/axios/lib/adapters/xhr.js +66 -33
  22. package/node_modules/axios/lib/axios.js +6 -5
  23. package/node_modules/axios/lib/cancel/CancelToken.js +62 -0
  24. package/node_modules/axios/lib/core/Axios.js +60 -7
  25. package/node_modules/axios/lib/core/InterceptorManager.js +4 -2
  26. package/node_modules/axios/lib/core/README.md +1 -0
  27. package/node_modules/axios/lib/core/dispatchRequest.js +11 -3
  28. package/node_modules/axios/lib/core/enhanceError.js +2 -1
  29. package/node_modules/axios/lib/core/mergeConfig.js +50 -38
  30. package/node_modules/axios/lib/core/transformData.js +3 -1
  31. package/node_modules/axios/lib/defaults.js +48 -12
  32. package/node_modules/axios/lib/env/README.md +3 -0
  33. package/node_modules/axios/lib/env/data.js +3 -0
  34. package/node_modules/axios/lib/helpers/validator.js +82 -0
  35. package/node_modules/axios/lib/utils.js +1 -3
  36. package/node_modules/axios/package.json +37 -40
  37. package/node_modules/axios/tsconfig.json +14 -0
  38. package/node_modules/axios/tslint.json +6 -0
  39. package/node_modules/follow-redirects/README.md +1 -1
  40. package/node_modules/follow-redirects/debug.js +14 -8
  41. package/node_modules/follow-redirects/index.js +106 -41
  42. package/node_modules/follow-redirects/package.json +14 -17
  43. package/node_modules/lodash/package.json +2 -2
  44. package/package.json +5 -4
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Language DHIS2 [![Build Status](https://travis-ci.org/OpenFn/language-dhis2.svg?branch=main)](https://travis-ci.org/OpenFn/language-dhis2)
2
2
 
3
- Language Pack for building expressions and operations for working with
4
- the [DHIS2 API](http://dhis2.github.io/dhis2-docs/master/en/developer/html/dhis2_developer_manual.html).
3
+ Language Pack for building expressions and operations for working with the
4
+ [DHIS2 API](http://dhis2.github.io/dhis2-docs/master/en/developer/html/dhis2_developer_manual.html).
5
5
 
6
6
  ## Documentation
7
7
 
@@ -38,7 +38,7 @@ fetchAnalytics({
38
38
  outputIdScheme: 'UID',
39
39
  },
40
40
  });
41
- ````
41
+ ```
42
42
 
43
43
  ## Tracked Entity API
44
44
 
@@ -174,4 +174,39 @@ Clone the repo, run `npm install`.
174
174
 
175
175
  Run tests using `npm run test` or `npm run test:watch`
176
176
 
177
- Build the project using `make`.
177
+ NB: There are two types of tests: unit tests and integration tests.
178
+
179
+ ### Unit Tests
180
+
181
+ Unit tests allows to test the functionalities of the adaptor helper functions
182
+ such as:
183
+
184
+ > Does `create('events', payload)` perform a post request to the correct DHIS2
185
+ > API?
186
+
187
+ To run unit tests execute `npm run test` (they're the default tests).
188
+
189
+ Anytime a new functionality is added to the helper functions, more unit tests
190
+ needs to be added.
191
+
192
+ ### End-to-end integration tests
193
+
194
+ Integration tests allow us to test the end-to-end behavior of the helper functions
195
+ and also to test the examples we provide via inline documentation.
196
+
197
+ For example with integration tests we answer the following question:
198
+
199
+ > Does `create('events', eventPayload)` actually create a new event in a live
200
+ > DHIS2 system?
201
+
202
+ To run integration tests, execute `npm run integration-test`. These
203
+ tests use network I/O and a public connection to a DHIS2 "play" server so their
204
+ timing and performance is unpredictable. Consider adding an increased timeout,
205
+ and modifying the orgUnit, program, etc., IDs set in `globalState`.
206
+
207
+ Anytime a new example is added in the documentation of a helper function, a new
208
+ integration test should be done.
209
+
210
+ ### Build
211
+
212
+ Build the project using `npm run build`.