Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module.exports = {
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/prefer-interface": "off",
"no-dupe-class-members": "off",
"@typescript-eslint/ban-types": "off",
},
env: { node: true, browser: true, es6: true },
env: { node: true, browser: true, es2020: true },
};
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.14.2
v22
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ $ yarn publish [--tag beta] [--patch | --minor | --major]
### Create an API instance

```ts
import { D2Api } from "d2-api/2.36";
import { D2Api } from "@eyeseetea/d2-api";

// Basic access authentication
const api = new D2Api({
baseUrl: "https://play.im.dhis2.org/dev",
baseUrl: "https://play.im.dhis2.org/stable-2-40-11",
auth: { type: "basic", username: "admin", password: "district" },
});

// Personal Access Token (PAT) authentication
const api = new D2Api({
baseUrl: "https://play.im.dhis2.org/dev",
baseUrl: "https://play.im.dhis2.org/stable-2-40-11",
auth: { type: "personalToken", token: "token_here" },
});
```
Expand Down Expand Up @@ -365,7 +365,7 @@ const data = await api.tracker.trackedEntities
orgUnit: true,
},
ouMode: "ALL",
program: "program_id",
program: "IpHINAT79UW",
})
.getData();
```
Expand All @@ -379,7 +379,7 @@ const data = await api.tracker.trackedEntities
orgUnit: true,
},
ouMode: "ALL",
program: "program_id",
program: "IpHINAT79UW",
order: [
{ type: "field", field: "createdAt", direction: "asc" },
{ type: "trackedEntityAttributeId", id: "wMhqqPLb7pP", direction: "desc" },
Expand All @@ -397,7 +397,7 @@ const data = await api.tracker.trackedEntities
orgUnit: true,
},
ouMode: "ALL",
program: "program_id",
program: "IpHINAT79UW",
totalPages: true,
})
.getData();
Expand Down Expand Up @@ -444,7 +444,7 @@ await api.email

## Using type helpers

_d2-api_ exposes some type helpers that you may need in your app. Some examples:
_@eyeseetea/d2-api_ exposes some type helpers that you may need in your app. Some examples:

- `SelectedPick`: Get model from a selector:

Expand Down Expand Up @@ -486,8 +486,7 @@ console.log(res.data);
## Testing

```ts
import { D2Api } from "d2-api/2.36";
import { getMockApiFromClass } from "d2-api";
import { D2Api, getMockApiFromClass } from "@eyeseetea/d2-api";

const currentUserMock = {
id: "xE7jOejl9FI",
Expand Down
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@eyeseetea/d2-api",
"description": "Typed wrapper over DHIS2 API",
"version": "1.21.0",
"version": "40.11.0-beta.1",
"license": "GPL-3.0",
"author": "EyeSeeTea team",
"repository": {
Expand All @@ -12,7 +12,7 @@
"start": "NODE_ENV=development babel-watch src --extensions \".js,.jsx,.ts,.tsx\"",
"clean": "rimraf build",
"build-babel": "babel src --out-dir build --extensions \".js,.jsx,.ts,.tsx\"",
"build": "yarn build-babel && tsc && cp package.json build/",
"build": "yarn build-babel && tsc -p tsconfig.build.json && cp package.json build/",
"predist": "rimraf dist && yarn build",
"dist": "ncc build build/ -m",
"lint": "eslint src --ext .js,.jsx,.ts,.tsx",
Expand All @@ -22,7 +22,10 @@
"generate-schemas": "ts-node src/scripts/generate-schemas.ts",
"prerelease": "yarn build",
"release": "bash scripts/publish.sh",
"test": "echo no-op"
"test": "yarn test:unit && yarn test:integration",
"test:watch": "vitest",
"test:unit": "vitest run --config vitest.unit.config.ts",
"test:integration": "vitest run --config vitest.integration.config.ts"
},
"dependencies": {
"abort-controller": "3.0.0",
Expand All @@ -48,26 +51,28 @@
"@babel/runtime": "^7.5.4",
"@types/argparse": "^2.0.3",
"@types/btoa": "^1.2.3",
"@types/chai": "5.2.3",
"@types/cryptr": "^4.0.0",
"@types/express": "^4.17.0",
"@types/lodash": "^4.14.144",
"@types/node": "^12.6.3",
"@types/prettier": "^1.18.3",
"@types/qs": "^6.5.3",
"@typescript-eslint/eslint-plugin": "^2.11.0",
"@typescript-eslint/parser": "^2.11.0",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"@zeit/ncc": "^0.20.4",
"argparse": "^2.0.1",
"babel-eslint": "^10.0.2",
"babel-watch": "^7.0.0",
"eslint": "^5.12.1",
"eslint": "8.37.0",
"eslint-config-prettier": "^6.0.0",
"eslint-plugin-prettier": "^3.1.1",
"prettier": "^1.18.2",
"rimraf": "2.6.3",
"side-channel": "^1.0.4",
"ts-node": "^8.4.1",
"typescript": "4.1.6",
"vitest": "^2",
"watch": "^1.0.2"
}
}
10 changes: 10 additions & 0 deletions src/2.40/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4715,6 +4715,7 @@ export type D2Route = {
lastUpdatedBy: D2User;
name: string;
publicAccess: string;
responseTimeoutSeconds: number;
sharing: D2Sharing;
translations: D2Translation[];
url: string;
Expand Down Expand Up @@ -14729,6 +14730,7 @@ export interface D2RouteSchema {
lastUpdatedBy: D2UserSchema;
name: string;
publicAccess: string;
responseTimeoutSeconds: number;
sharing: D2SharingSchema;
translations: D2Translation[];
url: string;
Expand All @@ -14755,6 +14757,7 @@ export interface D2RouteSchema {
| "lastUpdated"
| "lastUpdatedBy"
| "name"
| "responseTimeoutSeconds"
| "sharing"
| "translations"
| "url"
Expand All @@ -14774,6 +14777,7 @@ export interface D2RouteSchema {
| "lastUpdated"
| "lastUpdatedBy"
| "name"
| "responseTimeoutSeconds"
| "sharing"
| "translations"
| "url"
Expand Down Expand Up @@ -36456,6 +36460,12 @@ export const models: Record<keyof D2ModelSchemas, D2SchemaProperties> = {
propertyType: "TEXT",
klass: "java.lang.String",
},
{
name: "responseTimeoutSeconds",
fieldName: "responseTimeoutSeconds",
propertyType: "INTEGER",
klass: "java.lang.Integer",
},
{
name: "sharing",
fieldName: "sharing",
Expand Down
21 changes: 0 additions & 21 deletions src/2.41/index.ts

This file was deleted.

Loading