|
1 | 1 | # @openfn/language-dhis2 |
2 | 2 |
|
| 3 | +## 7.0.0 |
| 4 | + |
| 5 | +This release of DHSI2 contains major breaking changes. |
| 6 | + |
| 7 | +This release includes a major re-think of the main adaptor API, introducing new |
| 8 | +namespaces (tracker, http, util) to help organize functionality. Note that the |
| 9 | +main namespace contains `get()` and `create()`, which do not surface HTTP |
| 10 | +semantics, and `http.get()` and `http.post()`. |
| 11 | + |
| 12 | +The intention is that most users can use the `get()`, `create()` and `tracker.*` |
| 13 | +APIs, with a HTTP abstraction as a fallback. |
| 14 | + |
| 15 | +It also removes a dependency on the axios library (preferring undici, as used by |
| 16 | +other adaptors). |
| 17 | + |
| 18 | +### Major Changes |
| 19 | + |
| 20 | +- Remove axios. |
| 21 | +- Re-worked signatures for `get()`, `create()`, `update()` and `upsert()`. |
| 22 | +- The `discover()` function has been removed. |
| 23 | +- Many non-operation functions have moved to the `util.` namespace, including. |
| 24 | + `attr`, `dv`, `findAttributeValue`, and `findAttributeValueById`. |
| 25 | +- HTTP helper functions (like `post()`, `patch()`) have been moved into a clean |
| 26 | + new http namespace. |
| 27 | + |
| 28 | +### Minor Changes |
| 29 | + |
| 30 | +- dfe53ef: - Implement a new `tracker` namespace for `tracker.import()` and |
| 31 | + `tracker.export()` functions. |
| 32 | + |
| 33 | + - Throw an error when `create('tracker')` is called. |
| 34 | + |
| 35 | +- 5b73844: - Add importStrategy to query params for `create` and `update` |
| 36 | + |
| 37 | +### Migration Guide |
| 38 | + |
| 39 | +#### get () |
| 40 | + |
| 41 | +The `get` function has a new signature of `get(path, params)`. Note that the old |
| 42 | +options object and callback have been removed. If you need to set headers on |
| 43 | +your request, use `http.get()` instead. |
| 44 | + |
| 45 | +For `path`, you can pass a resource type, like `"enrollments"`, or a path to a |
| 46 | +specific resource, like `tracker/trackedEntities/F8yKM85NbxW`. |
| 47 | + |
| 48 | +If using the new tracker API, we recommend using the new tracker namespace. |
| 49 | + |
| 50 | +#### create |
| 51 | + |
| 52 | +The `create` function has a new signature of `create(path, data, params)`. Note |
| 53 | +that the old options object and callback have been removed. If you need to set |
| 54 | +headers on your request, use `http.post()` instead. |
| 55 | + |
| 56 | +#### update |
| 57 | + |
| 58 | +Callbacks have been removed from the update signature. |
| 59 | + |
| 60 | +#### upsert |
| 61 | + |
| 62 | +Callbacks have been removed from the upsert signature. |
| 63 | + |
| 64 | +#### Utils |
| 65 | + |
| 66 | +Some helper functions, which are not operations and cannot be called at the top |
| 67 | +level, have been moved to a `util` namespace. |
| 68 | + |
| 69 | +Instead of this: |
| 70 | + |
| 71 | +``` |
| 72 | +fn((state) => { |
| 73 | + const value = findAttributeValue(state.data, 'first name') |
| 74 | + return state; |
| 75 | +}) |
| 76 | +``` |
| 77 | + |
| 78 | +Do this: |
| 79 | + |
| 80 | +``` |
| 81 | +fn((state) => { |
| 82 | + const value = util.findAttributeValue(state.data, 'first name') |
| 83 | + return state; |
| 84 | +}) |
| 85 | +``` |
| 86 | + |
3 | 87 | ## 6.3.4 - 22 April 2025 |
4 | 88 |
|
5 | 89 | ### Patch Changes |
|
0 commit comments