@persei/perseed-api 4.34.2

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 (52) hide show
  1. package/README.md +260 -0
  2. package/dist/perseed-api.mjs +177 -0
  3. package/dist/perseed-api.umd.js +1 -0
  4. package/dist/schemas/authentication_security/index.d.ts +1 -0
  5. package/dist/schemas/authentication_security/types.d.ts +29 -0
  6. package/dist/schemas/dashboard/create_dashboard_payload.schema.json +487 -0
  7. package/dist/schemas/dashboard/data_loaders/Outcomes.d.ts +6 -0
  8. package/dist/schemas/dashboard/data_loaders/index.d.ts +1 -0
  9. package/dist/schemas/dashboard/i18n.d.ts +6 -0
  10. package/dist/schemas/dashboard/index.d.ts +10 -0
  11. package/dist/schemas/dashboard/types.d.ts +51 -0
  12. package/dist/schemas/dashboard/update_dashboard_payload.schema.json +486 -0
  13. package/dist/schemas/dashboard/widgets/PatientListProps.d.ts +9 -0
  14. package/dist/schemas/dashboard/widgets/SectionCardProps.d.ts +9 -0
  15. package/dist/schemas/dashboard/widgets/ValueCardProps.d.ts +13 -0
  16. package/dist/schemas/dashboard/widgets/index.d.ts +3 -0
  17. package/dist/schemas/forms/create.schema.json +12 -0
  18. package/dist/schemas/forms/update.schema.json +22 -0
  19. package/dist/schemas/hospital/create.schema.json +23 -0
  20. package/dist/schemas/index.d.ts +15 -0
  21. package/dist/schemas/mfa/mfa-login-data.schema.json +33 -0
  22. package/dist/schemas/mobile/searchnotificationstatus.schema.json +9 -0
  23. package/dist/schemas/notification_configuration/create_trigger_payload.schema.json +170 -0
  24. package/dist/schemas/notification_configuration/index.d.ts +2 -0
  25. package/dist/schemas/notification_configuration/introspectionShema.d.ts +3 -0
  26. package/dist/schemas/notification_configuration/types.d.ts +91 -0
  27. package/dist/schemas/notification_configuration/update_trigger_payload.schema.json +169 -0
  28. package/dist/schemas/outcomes/index.d.ts +1 -0
  29. package/dist/schemas/outcomes/types.d.ts +35 -0
  30. package/dist/schemas/patient/createFullPatient.schema.json +17 -0
  31. package/dist/schemas/patient/createPatient.schema.json +12 -0
  32. package/dist/schemas/project/createCategory.schema.json +12 -0
  33. package/dist/schemas/project/export.schema.json +25 -0
  34. package/dist/schemas/project/uploadDocument.schema.json +23 -0
  35. package/dist/schemas/query/patch.schema.json +22 -0
  36. package/dist/schemas/questionnaire/createQuestionnaire.schema.json +29 -0
  37. package/dist/schemas/questionnaire/index.d.ts +1 -0
  38. package/dist/schemas/questionnaire/types.d.ts +7 -0
  39. package/dist/schemas/subform/create.schema.json +12 -0
  40. package/dist/schemas/subform/update.schema.json +12 -0
  41. package/dist/schemas/user_settings/APP_FONT_FACTOR.schema.json +10 -0
  42. package/dist/schemas/user_settings/AUTH_SECURITY_CONFIG.schema.json +41 -0
  43. package/dist/schemas/user_settings/GenericBooleanSetting.schema.json +9 -0
  44. package/dist/schemas/user_settings/index.d.ts +1 -0
  45. package/dist/schemas/user_settings/types.d.ts +5 -0
  46. package/dist/schemas/users/activate.schema.json +24 -0
  47. package/dist/schemas/users/contact.schema.json +15 -0
  48. package/dist/schemas/users/create.schema.json +92 -0
  49. package/dist/schemas/users/password.schema.json +12 -0
  50. package/dist/schemas/users/selfregister.schema.json +15 -0
  51. package/dist/schemas/users/unlinkProject.schema.json +18 -0
  52. package/package.json +176 -0
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$ref": "#/definitions/AuthenticationSecurityDefinition",
4
+ "definitions": {
5
+ "AuthenticationSecurityDefinition": {
6
+ "type": "object",
7
+ "properties": {
8
+ "mfaMethods": {
9
+ "type": "array",
10
+ "items": {
11
+ "$ref": "#/definitions/MFAMethod"
12
+ }
13
+ },
14
+ "required": {
15
+ "type": "boolean"
16
+ },
17
+ "default": {
18
+ "$ref": "#/definitions/MFAMethodCode"
19
+ }
20
+ },
21
+ "additionalProperties": false,
22
+ "description": "Global authentication security definition"
23
+ },
24
+ "MFAMethod": {
25
+ "type": "object",
26
+ "properties": {
27
+ "code": {
28
+ "$ref": "#/definitions/MFAMethodCode"
29
+ }
30
+ },
31
+ "required": ["code"],
32
+ "additionalProperties": false,
33
+ "description": "MFA method definition and configuration"
34
+ },
35
+ "MFAMethodCode": {
36
+ "type": "string",
37
+ "enum": ["sms", "email"],
38
+ "description": "Available MFA methods"
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$ref": "#/definitions/GenericBooleanSetting",
4
+ "definitions": {
5
+ "GenericBooleanSetting": {
6
+ "type": "boolean"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1 @@
1
+ export * from './types';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * App font factor
3
+ */
4
+ export type AppFontFactor = number;
5
+ export type GenericBooleanSetting = boolean;
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "description": "Schema for activate user account",
4
+ "type": "object",
5
+ "required": ["token", "username", "newPass", "newPassRepeated"],
6
+ "properties": {
7
+ "token": {
8
+ "type": "string"
9
+ },
10
+ "username": {
11
+ "type": "string",
12
+ "minLength": 1
13
+ },
14
+ "newPass": {
15
+ "type": "string",
16
+ "minLength": 8
17
+ },
18
+ "newPassRepeated": {
19
+ "type": "string",
20
+ "minLength": 8
21
+ }
22
+ },
23
+ "additionalProperties": false
24
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "description": "validation form patient",
4
+ "type": "object",
5
+ "required": ["email", "name", "comment"],
6
+ "properties": {
7
+ "email": {
8
+ "type": "string",
9
+ "format": "email"
10
+ },
11
+ "name": { "type": "string" },
12
+ "comment": { "type": "string" }
13
+ },
14
+ "additionalProperties": false
15
+ }
@@ -0,0 +1,92 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "description": "Schema for create user endpoint",
4
+ "type": "object",
5
+ "required": ["email", "project_id", "clinics"],
6
+ "properties": {
7
+ "active": {
8
+ "type": "boolean"
9
+ },
10
+ "username": {
11
+ "type": "string"
12
+ },
13
+ "password": {
14
+ "type": "string"
15
+ },
16
+ "firstname": {
17
+ "type": "string"
18
+ },
19
+ "secondname": {
20
+ "type": "string"
21
+ },
22
+ "name": {
23
+ "type": "string"
24
+ },
25
+ "surname": {
26
+ "type": "string"
27
+ },
28
+ "email": {
29
+ "type": "string",
30
+ "format": "email"
31
+ },
32
+ "language": {
33
+ "type": "string",
34
+ "pattern": "^[a-z]{2}$|^[a-z]{2}[-_]{1}[A-Z]{2}$"
35
+ },
36
+ "tzname": {
37
+ "type": "string"
38
+ },
39
+ "phone": {
40
+ "type": "string"
41
+ },
42
+ "project": {
43
+ "type": "string"
44
+ },
45
+ "project_id": {
46
+ "type": "integer"
47
+ },
48
+ "profiling_id": {
49
+ "type": "integer"
50
+ },
51
+ "creation_user_id": {
52
+ "type": "integer"
53
+ },
54
+ "hospital_id": {
55
+ "type": "integer"
56
+ },
57
+ "clinics": {
58
+ "type": "array",
59
+ "items": {
60
+ "type": "integer"
61
+ }
62
+ },
63
+ "displayName": {
64
+ "type": "string"
65
+ },
66
+ "user_type": {
67
+ "type": "string"
68
+ },
69
+ "display_name": {
70
+ "type": "string"
71
+ },
72
+ "forms": {
73
+ "type": "array",
74
+ "items": {
75
+ "type": "object",
76
+ "required": ["name", "fields"],
77
+ "properties": {
78
+ "name": {
79
+ "type": "string"
80
+ },
81
+ "fields": {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "object"
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ },
91
+ "additionalProperties": false
92
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "description": "schema for validating remind password endpoint",
3
+ "type": "object",
4
+ "required": ["email"],
5
+ "properties": {
6
+ "email": {
7
+ "type": "string",
8
+ "pattern": "^[a-zA-Z0-9._-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"
9
+ }
10
+ },
11
+ "additionalProperties": false
12
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "description": "Schema for user self registration endpoint",
4
+ "type": "object",
5
+ "required": ["code", "csrf"],
6
+ "properties": {
7
+ "code": {
8
+ "type": "string"
9
+ },
10
+ "csrf": {
11
+ "type": "string"
12
+ }
13
+ },
14
+ "additionalProperties": true
15
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "description": "Schema for unlink user from project",
4
+ "type": "object",
5
+ "required": ["project_id", "clinics"],
6
+ "properties": {
7
+ "project_id": {
8
+ "type": "integer"
9
+ },
10
+ "clinics": {
11
+ "type": "array",
12
+ "items": {
13
+ "type": "integer"
14
+ }
15
+ }
16
+ },
17
+ "additionalProperties": false
18
+ }
package/package.json ADDED
@@ -0,0 +1,176 @@
1
+ {
2
+ "name": "@persei/perseed-api",
3
+ "version": "4.34.2",
4
+ "private": false,
5
+ "main": "./dist/perseed-api.umd.cjs",
6
+ "module": "./dist/perseed-api.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/perseed-api.js",
11
+ "require": "./dist/perseed-api.umd.cjs"
12
+ }
13
+ },
14
+ "files": ["dist"],
15
+ "scripts": {
16
+ "build": "tsc && vite build",
17
+ "start": "ts-node src/server.ts",
18
+ "lint": "npm run test:lint",
19
+ "jshint": "jshint . > report.txt || true",
20
+ "indicators": "bash ./test/indicators/codestyletest.sh >> reports/countFunctions.txt",
21
+ "countcommits": " bash ./test/indicators/GCStest.sh",
22
+ "report": "eslint -f ./node_modules/eslint-detailed-reporter/lib/detailed.js 'src/**/*.ts' -o reports/eslint.html",
23
+ "eslintfix": "eslint src/ --fix --quiet",
24
+ "setup-test": "node ./test/unittests/setup-test-db.js",
25
+ "test": "npm run setup-test && env NODE_ENV=local ts-mocha --require ./test/hooks.js ./test/unittests/tests/**/*.js --exit",
26
+ "test-unit": "ts-mocha --require ./test/hooks.js './test/unit_tests_refactor/**/*.test.js'",
27
+ "test-functional": "ts-mocha --require ./test/hooks.js ./test/functional/**/*.test.js --timeout 10000 --recursive --exit",
28
+ "test-code": "npm run test:lint && ts-node --typeCheck -T src/test-code.ts",
29
+ "dev": "tsnd -r dotenv/config --respawn src/server.ts",
30
+ "redisdev": "CACHE_ENABLED=1 REDIS_URL='redis://localhost:6379/1' npm run dev",
31
+ "coveralls": "nyc --reporter=html npm run test-unit",
32
+ "security-packages-report": "npm audit --json | npm-audit-html --output reports/packages-security-report.html",
33
+ "test:lint": "eslint src/ && prettier --ignore-path .prettierignorefile --check src/",
34
+ "test:types": "tsc --noEmit",
35
+ "test:docs": "pip install esprima && python3 swagger_gen.py",
36
+ "dest:docs-unsafe": "pip install esprima --break-system-packages && python3 swagger_gen.py",
37
+ "test:security": "pipx install njsscan && pipx install semgrep && njsscan ./src/",
38
+ "test:security:report": "pipx install njsscan && pipx install semgrep && njsscan --html -o reports/security-report.html ./src/",
39
+ "test:security:report2": "./bin/bearer scan perseed-api/src --scanner=sast,secrets --report security --format html --output reports/bearer_api_report",
40
+ "precommit": "npm run schemas:generate && prettier --ignore-path .prettierignorefile src/ --write && npm run eslintfix && npm run i18n:generate && npm run test:types && npm run test-unit && npm run test:security",
41
+ "i18n:generate": "npx rimraf src/i18n/api/en.json && i18next && i18next --config i18next-parser.config.js",
42
+ "semgrep": "semgrep scan --json --json-output=semgrep.json",
43
+ "schemas:generate": "node generateSchemas.mjs"
44
+ },
45
+ "prettier": "@persei/eslint-config-perseed/prettier-config",
46
+ "eslintConfig": {
47
+ "extends": [
48
+ "@persei/eslint-config-perseed",
49
+ "plugin:security/recommended"
50
+ ],
51
+ "rules": {
52
+ "security/detect-object-injection": "off",
53
+ "@typescript-eslint/ban-ts-comment": "warn",
54
+ "@typescript-eslint/no-explicit-any": "warn",
55
+ "@typescript-eslint/member-ordering": "off",
56
+ "@typescript-eslint/no-unused-vars": "warn",
57
+ "@typescript-eslint/prefer-for-of": "warn",
58
+ "import/order": "off",
59
+ "no-extend-native": "warn",
60
+ "no-bitwise": "warn",
61
+ "no-prototype-builtins": "warn",
62
+ "guard-for-in": "warn",
63
+ "eqeqeq": "warn"
64
+ }
65
+ },
66
+ "dependencies": {
67
+ "@paralleldrive/cuid2": "^2.2.2",
68
+ "@persei/debug": "^2.0.0",
69
+ "@sentry/node": "^6.19.6",
70
+ "@types/amqplib": "^0.10.5",
71
+ "@types/json-logic-js": "^2.0.8",
72
+ "aes-js": "^3.1.2",
73
+ "ajv": "^8.11.0",
74
+ "ajv-formats": "^2.1.1",
75
+ "amqplib": "^0.10.3",
76
+ "anymatch": "^3.1.2",
77
+ "aws-cloudfront-sign": "^2.2.0",
78
+ "aws-sdk": "^2.1112.0",
79
+ "axios": "^1.6.8",
80
+ "bcrypt": "^5.0.1",
81
+ "body-parser": "^1.20.0",
82
+ "btoa": "^1.2.1",
83
+ "bull": "^4.10.1",
84
+ "bunyan": "^1.8.15",
85
+ "cors": "^2.8.5",
86
+ "crypto-js": "^4.2.0",
87
+ "dayjs": "^1.11.11",
88
+ "debug": "^4.3.4",
89
+ "dotenv": "^16.3.1",
90
+ "emoji-regex": "^10.1.0",
91
+ "ent": "^2.2.0",
92
+ "expr-eval": "^2.0.2",
93
+ "express": "^4.18.2",
94
+ "express-basic-auth": "^1.2.1",
95
+ "express-fingerprint": "^1.2.2",
96
+ "express-http-context": "^1.2.4",
97
+ "express-jwt": "^8.2.1",
98
+ "express-jwt-authz": "^2.4.1",
99
+ "form-data": "^4.0.0",
100
+ "geoip-lite": "^1.4.9",
101
+ "gettext-parser": "^5.1.2",
102
+ "google-libphonenumber": "^3.2.34",
103
+ "handlebars": "^4.7.8",
104
+ "helmet": "^5.0.2",
105
+ "humanize-duration": "^3.27.1",
106
+ "i18next": "^23.11.5",
107
+ "i18next-http-middleware": "^3.6.0",
108
+ "i18next-parser": "^8.13.0",
109
+ "i18next-resources-to-backend": "^1.2.1",
110
+ "ical-generator": "^4.0.0",
111
+ "json-logic-js": "^2.0.5",
112
+ "jsonwebtoken": "^9.0.2",
113
+ "jwks-rsa": "^2.0.5",
114
+ "knex": "^1.0.7",
115
+ "libsodium-wrappers": "^0.7.10",
116
+ "mobile-detect": "^1.4.5",
117
+ "multer": "^1.4.4",
118
+ "murmurhash3js": "^3.0.1",
119
+ "mysql2": "^3.9.7",
120
+ "node-geocoder": "^4.0.0",
121
+ "node-gettext": "^3.0.0",
122
+ "node-jq": "^6.0.1",
123
+ "nodemailer": "^6.9.13",
124
+ "objection": "^3.1.4",
125
+ "path-to-regexp": "^6.2.1",
126
+ "php-unserialize": "0.0.1",
127
+ "redis": "^4.3.1",
128
+ "request": "^2.88.2",
129
+ "request-promise": "^4.2.6",
130
+ "rrule": "^2.6.9",
131
+ "sanitize-html": "^2.13.0",
132
+ "semver": "^7.3.8",
133
+ "sharp": "^0.33.3",
134
+ "swagger-ui-express": "^4.3.0",
135
+ "traverse": "^0.6.6",
136
+ "underscore": "^1.13.2"
137
+ },
138
+ "devDependencies": {
139
+ "@persei/eslint-config-perseed": "^4.1.5",
140
+ "@rollup/plugin-json": "^6.1.0",
141
+ "@types/bcrypt": "^5.0.2",
142
+ "@types/express-serve-static-core": "^4.17.31",
143
+ "@types/geoip-lite": "^1.4.4",
144
+ "@types/google-libphonenumber": "^7.4.30",
145
+ "@types/multer": "^1.4.7",
146
+ "@types/node": "^22.5.4",
147
+ "@types/sanitize-html": "^2.11.0",
148
+ "@types/traverse": "^0.6.32",
149
+ "@types/underscore": "^1.11.15",
150
+ "chai": "^4.3.6",
151
+ "chai-as-promised": "^7.1.1",
152
+ "chai-http": "^4.3.0",
153
+ "chai-spies": "^1.0.0",
154
+ "eslint-detailed-reporter": "^0.9.0",
155
+ "eslint-plugin-security": "^1.5.0",
156
+ "i": "^0.3.7",
157
+ "jshint": "latest",
158
+ "mocha": "^10.4.0",
159
+ "mock-require": "^3.0.3",
160
+ "node-mocks-http": "^1.11.0",
161
+ "npm-audit-html": "^1.5.0",
162
+ "nyc": "^15.1.0",
163
+ "owasp-dependency-check": "^0.0.21",
164
+ "proxyquire": "^2.1.3",
165
+ "rollup-plugin-copy": "^3.5.0",
166
+ "sinon": "^13.0.2",
167
+ "ts-json-schema-generator": "^2.3.0",
168
+ "ts-mocha": "^10.0.0",
169
+ "ts-node": "^10.9.1",
170
+ "ts-node-dev": "^2.0.0",
171
+ "typescript": "^4.9.4",
172
+ "vite": "^6.2.4",
173
+ "vite-plugin-dts": "^4.5.3",
174
+ "yamljs": "^0.3.0"
175
+ }
176
+ }