@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.
- package/README.md +260 -0
- package/dist/perseed-api.mjs +177 -0
- package/dist/perseed-api.umd.js +1 -0
- package/dist/schemas/authentication_security/index.d.ts +1 -0
- package/dist/schemas/authentication_security/types.d.ts +29 -0
- package/dist/schemas/dashboard/create_dashboard_payload.schema.json +487 -0
- package/dist/schemas/dashboard/data_loaders/Outcomes.d.ts +6 -0
- package/dist/schemas/dashboard/data_loaders/index.d.ts +1 -0
- package/dist/schemas/dashboard/i18n.d.ts +6 -0
- package/dist/schemas/dashboard/index.d.ts +10 -0
- package/dist/schemas/dashboard/types.d.ts +51 -0
- package/dist/schemas/dashboard/update_dashboard_payload.schema.json +486 -0
- package/dist/schemas/dashboard/widgets/PatientListProps.d.ts +9 -0
- package/dist/schemas/dashboard/widgets/SectionCardProps.d.ts +9 -0
- package/dist/schemas/dashboard/widgets/ValueCardProps.d.ts +13 -0
- package/dist/schemas/dashboard/widgets/index.d.ts +3 -0
- package/dist/schemas/forms/create.schema.json +12 -0
- package/dist/schemas/forms/update.schema.json +22 -0
- package/dist/schemas/hospital/create.schema.json +23 -0
- package/dist/schemas/index.d.ts +15 -0
- package/dist/schemas/mfa/mfa-login-data.schema.json +33 -0
- package/dist/schemas/mobile/searchnotificationstatus.schema.json +9 -0
- package/dist/schemas/notification_configuration/create_trigger_payload.schema.json +170 -0
- package/dist/schemas/notification_configuration/index.d.ts +2 -0
- package/dist/schemas/notification_configuration/introspectionShema.d.ts +3 -0
- package/dist/schemas/notification_configuration/types.d.ts +91 -0
- package/dist/schemas/notification_configuration/update_trigger_payload.schema.json +169 -0
- package/dist/schemas/outcomes/index.d.ts +1 -0
- package/dist/schemas/outcomes/types.d.ts +35 -0
- package/dist/schemas/patient/createFullPatient.schema.json +17 -0
- package/dist/schemas/patient/createPatient.schema.json +12 -0
- package/dist/schemas/project/createCategory.schema.json +12 -0
- package/dist/schemas/project/export.schema.json +25 -0
- package/dist/schemas/project/uploadDocument.schema.json +23 -0
- package/dist/schemas/query/patch.schema.json +22 -0
- package/dist/schemas/questionnaire/createQuestionnaire.schema.json +29 -0
- package/dist/schemas/questionnaire/index.d.ts +1 -0
- package/dist/schemas/questionnaire/types.d.ts +7 -0
- package/dist/schemas/subform/create.schema.json +12 -0
- package/dist/schemas/subform/update.schema.json +12 -0
- package/dist/schemas/user_settings/APP_FONT_FACTOR.schema.json +10 -0
- package/dist/schemas/user_settings/AUTH_SECURITY_CONFIG.schema.json +41 -0
- package/dist/schemas/user_settings/GenericBooleanSetting.schema.json +9 -0
- package/dist/schemas/user_settings/index.d.ts +1 -0
- package/dist/schemas/user_settings/types.d.ts +5 -0
- package/dist/schemas/users/activate.schema.json +24 -0
- package/dist/schemas/users/contact.schema.json +15 -0
- package/dist/schemas/users/create.schema.json +92 -0
- package/dist/schemas/users/password.schema.json +12 -0
- package/dist/schemas/users/selfregister.schema.json +15 -0
- package/dist/schemas/users/unlinkProject.schema.json +18 -0
- package/package.json +176 -0
package/README.md
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# Table of contents
|
|
2
|
+
|
|
3
|
+
1. [Perseed API - NodeJS](#1-perseed-api-nodejs)
|
|
4
|
+
2. [Requirements](#2-requirements)
|
|
5
|
+
3. [Installation overview](#3-installation-overview)
|
|
6
|
+
4. [Tunneling database connection](#4-tunneling-database-connection)
|
|
7
|
+
5. [Local development without docker - NOT RECOMMENDED](#5-local-development-without-docker-not-recommended)
|
|
8
|
+
6. [Local development with docker-compose (with auto reload via nodemon) - RECOMMENDED](#6-local-development-with-docker-compose-with-auto-reload-via-nodemon-recommended)
|
|
9
|
+
7. [API documentation](#7-api-documentation)
|
|
10
|
+
8. [Redis cache and queue](#8-redis-cache-and-queue)
|
|
11
|
+
9. [Generating json schema from ts definitions](#9-generating-json-schema-from-ts-definitions)
|
|
12
|
+
10. [Add a new language](#10-add-a-new-language)
|
|
13
|
+
|
|
14
|
+
# 1 - Perseed API - NodeJs
|
|
15
|
+
|
|
16
|
+
The perseed API (node js) provides a series of endpoints for clients to communicate
|
|
17
|
+
to the Perseed ecosystem.
|
|
18
|
+
|
|
19
|
+
As client, we understand that it can be:
|
|
20
|
+
|
|
21
|
+
1. A third party that is integrating with the API.
|
|
22
|
+
2. Internal or external mobile applications that want to consume the data provided by the API.
|
|
23
|
+
|
|
24
|
+
This readme provides the basic guidance to get started.
|
|
25
|
+
|
|
26
|
+
# 2 - Requirements
|
|
27
|
+
|
|
28
|
+
For local development without docker:
|
|
29
|
+
|
|
30
|
+
- NodeJs 10+ (Installation instructions [here](https://nodejs.org/en/download/package-manager)
|
|
31
|
+
- NPM 6+
|
|
32
|
+
|
|
33
|
+
For local development with docker and docker-compose:
|
|
34
|
+
|
|
35
|
+
- docker engine installed (Installation instructions can be found [here](https://docs.docker.com/install))
|
|
36
|
+
- docker-compose installed (Installation instructions can be found [here](https://docs.docker.com/compose/install))
|
|
37
|
+
|
|
38
|
+
## 2.1 - Setting up credentials file
|
|
39
|
+
|
|
40
|
+
Disclaimer: this section is required for local setup with or without docker.
|
|
41
|
+
|
|
42
|
+
1. Copy the file ´config.local.example´ from the root of the project and past it in the credentials folder `config/credentials` as `local.js` (`cp config.local.example config/credentials/local.js`)
|
|
43
|
+
2. Copy the file ´config.local.example´ from the root of the project and past it in the credentials folder `config/credentials` as `test.js` (`cp config.local.example config/credentials/test.js`)
|
|
44
|
+
3. Copy the file ´~/.ssh/id_rsa.pub´ and paste it in the key folder `config/apiPublicKey` as `public.pem` (`cp ~/.ssh/id_rsa.pub config/apiPublicKey/public.pem`)
|
|
45
|
+
|
|
46
|
+
# 3 - Installation overview
|
|
47
|
+
|
|
48
|
+
Once cloned this repository, a few steps are required in order to get the API
|
|
49
|
+
up and running, and they are as follows:
|
|
50
|
+
|
|
51
|
+
- set up a local credentials file, it includes the js files with secrets as well as the public key file.
|
|
52
|
+
- Install dependencies
|
|
53
|
+
- Start database tunneling
|
|
54
|
+
- Start the API process
|
|
55
|
+
|
|
56
|
+
For each item mentioned above, there is a section that follows what is needed to completed each step.
|
|
57
|
+
|
|
58
|
+
# 4 - Tunneling database connection - NOT RECOMMENDED
|
|
59
|
+
|
|
60
|
+
As a suggested approach to not setup projects into local database, a ssh tunnel
|
|
61
|
+
is the way to go, the following command can create a connection from the database
|
|
62
|
+
to a local port:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
ssh perseedweb00-dev -L 3306:10.150.128.151:3306
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The command above exposes the port 3306 from the server (**10.150.128.151**) to the port 3306
|
|
69
|
+
on the localhost. In this example, the IP **10.150.128.151** is the staging database,
|
|
70
|
+
or as it is most common called in perseed, the TMP database serve.
|
|
71
|
+
|
|
72
|
+
Quick note on tunneling connections: probably if your using a tunnel you would also like
|
|
73
|
+
to set up the `/etc/hosts` accordingly, assuming the TMP database above, you should add the
|
|
74
|
+
following entry on the hosts file:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
127.0.0.1 perseeddb00-dev.internal.persei.com.es
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
# 5 - Local development without docker - NOT RECOMMENDED
|
|
81
|
+
|
|
82
|
+
## 5.1 - Install the dependencies
|
|
83
|
+
|
|
84
|
+
The preferred way to install the project dependencies is through NPM, running the following command:
|
|
85
|
+
|
|
86
|
+
`npm install`
|
|
87
|
+
|
|
88
|
+
In order to proceed to the API launch this command must exit with status 0, in other words, successfully.
|
|
89
|
+
|
|
90
|
+
## 5.2 - Start the api process (non development - without autoreload)
|
|
91
|
+
|
|
92
|
+
Once the previous two steps have been completed successfully, the api can be started running the following command:
|
|
93
|
+
|
|
94
|
+
`npm run start`
|
|
95
|
+
|
|
96
|
+
# 6 - Local development with docker-compose (with auto reload via nodemon) - RECOMMENDED
|
|
97
|
+
|
|
98
|
+
The preferred command to use docker is through the `docker-compose` itself,
|
|
99
|
+
the setup used by docker-compose, deploys two containers: nginx and the node js.
|
|
100
|
+
|
|
101
|
+
To a clean installation make sure that there is no **node_modules** folder
|
|
102
|
+
created in the root directory, then proceed to execute the first command
|
|
103
|
+
to install the dependencies:
|
|
104
|
+
|
|
105
|
+
Also this setup assumes that you are **NOT** using the tunneling approach, for
|
|
106
|
+
tunneling, have a look at the command in the section 6.1.
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
docker-compose -f docker-compose-dev.yml run --rm nodejs npm install --target_arch=x64 --target_platform=linux
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Once the command is finished, then, lunch the services (note: it will
|
|
113
|
+
keep showing up logs in the terminal):
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
docker-compose -f docker-compose-dev.yml up
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
To double-check the setup, and in a new terminal window, run the following test
|
|
120
|
+
suite:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
docker-compose -f docker-compose-dev.yml run --rm nodejs npm run test-unit
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Besides that, the docker-compose setup comes with one single ecosystem (reseaarch) and
|
|
127
|
+
the credentials are as follows:
|
|
128
|
+
|
|
129
|
+
- Ecosystem admin (used to generate the JWT token):
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
username: ecoadmin
|
|
133
|
+
password: 1CarefulWithPersonalInfo2
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## 6.1 Local development with docker with tunneling
|
|
137
|
+
|
|
138
|
+
For more advanced developers that want to play with the raw image through docker
|
|
139
|
+
a friendly command is provided below. For more information about the image
|
|
140
|
+
please refer to the `Dockerfile` in the repository root directory.
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
docker build . -t perseed_api && docker run -p 3005:3005 -it --net=host -v $(pwd):/var/www/perseed_api perseed_api npm run dev
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The command above will build the image, install npm dependencies and run the
|
|
147
|
+
api. It is important to note that the `--net` is used explicitly for the tunneling,
|
|
148
|
+
this way docker does not blocks the tunnel port. On the other hand, the docker
|
|
149
|
+
compose file uses the network mode as host, which should change in the future.
|
|
150
|
+
|
|
151
|
+
# 7 - API documentation
|
|
152
|
+
|
|
153
|
+
The API documentation is build thanks to Swagger Tools that takes an OpenAPI Specification file (.yaml or .json) and generates code for Server and Client.
|
|
154
|
+
|
|
155
|
+
In our case, we build the OpenAPI Spec file (swagger.yaml) directly from the API code comments using the **swagger_gen.py** script that can be found in this git repository.
|
|
156
|
+
|
|
157
|
+
- This script goes through all the jsdocs files in the "routes" directory and parses all the comments that document the endpoints
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
## 7.1 How to document an endpoint directly in the API code comments:
|
|
161
|
+
More info in confluence at [How To Document The API](https://confluence.persei.com.es/display/TBDC/How+to+document+the+API)
|
|
162
|
+
|
|
163
|
+
To document an endpoint the comment should be right above of endpoint. It is important **follow the next template**:
|
|
164
|
+
|
|
165
|
+
-----------------
|
|
166
|
+
#### 1. The Body Request *IS A MODEL*:
|
|
167
|
+
```ruby
|
|
168
|
+
/*@PA <endpoint_path>
|
|
169
|
+
method: <HTTP_method>
|
|
170
|
+
summary: <What_the_endpoint_does>
|
|
171
|
+
tags: [<tag1>,...,<tagN>]
|
|
172
|
+
responses: #/<Response_Content (has to be JSON format)>/#
|
|
173
|
+
body: model <model> - <description>
|
|
174
|
+
*/
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### 2. The Body Request is a *NOT A MODEL*:
|
|
178
|
+
```ruby
|
|
179
|
+
/* @PA <endpoint_path>
|
|
180
|
+
method: <HTTP_method>
|
|
181
|
+
summary: <What_the_endpoint_does>
|
|
182
|
+
tags: [<tag1>,...,<tagN>]
|
|
183
|
+
responses: #/<Response_Content (has to be JSON format)>/#
|
|
184
|
+
body: {<Body_Content>} - <description>
|
|
185
|
+
required: [required_field1,...,required_fieldN]
|
|
186
|
+
```
|
|
187
|
+
-------------------
|
|
188
|
+
The API can return a response in two ways:
|
|
189
|
+
|
|
190
|
+
1. Returning as a response body ***A MODEL THAT ALREADY EXISTS***:
|
|
191
|
+
2. Returning as a response body ***A JSON (not extracted from a model)***:
|
|
192
|
+
|
|
193
|
+
>#### (1)
|
|
194
|
+
>>responses:
|
|
195
|
+
>>>**#/**{*“<HTTP_code_response1>”* : {**“content-type”** : *”<content_type>”*, **“model_content”** : *“<model_name>”*, **“description”** : *“<description>”*},............................................................................................................................................................................
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
>#### (2)
|
|
199
|
+
>>>...........,*“<HTTP_code_responseN>”* : {**“content-type”** : *”<content_type>”*,**”json_content”** : *<JSON>*, **“description”** : *“<description>”*}}**/#**
|
|
200
|
+
|
|
201
|
+
>#### (1) y (2)
|
|
202
|
+
|
|
203
|
+
>>responses:
|
|
204
|
+
>>>**#/**{*“<HTTP_code_response1>”* : {**“content-type”** : *”<content_type>”*, **“model_content”** : *“<model_name>”*, **“description”** : *“<description>”*} ,.........,
|
|
205
|
+
*“<HTTP_code_responseN>”* : {**“content-type”** : *”<content_type>”*, **”json_content”** : *<JSON>*, **“description”** : *“<description>”*}}**/#**
|
|
206
|
+
|
|
207
|
+
## 7.2 Recommendations:
|
|
208
|
+
|
|
209
|
+
1. The code was developed specifically for this type and format of comments.
|
|
210
|
+
|
|
211
|
+
2. Be sure that the comment starts with : **/\* @PA** and ends with: **\*/**
|
|
212
|
+
|
|
213
|
+
3. Just in case you want to check if you are formatting the comments correctly: [Regex Help](https://regexr.com/)
|
|
214
|
+
|
|
215
|
+
- 3.1 body field (NOT A MODEL):
|
|
216
|
+
|
|
217
|
+
>`body:(?:.||\n.*){((?:.|\n)*)}(?:.*-|-|)(.*)`
|
|
218
|
+
|
|
219
|
+
- 3.2 body field (MODEL):
|
|
220
|
+
|
|
221
|
+
>`body: model(.*)`
|
|
222
|
+
|
|
223
|
+
- 3.3 responses field:
|
|
224
|
+
|
|
225
|
+
>`responses:(?:.|\n)*?#\/((?:.|\n*.*){(?:.|\n)*})(?:(?:.|\n)*)\/#`
|
|
226
|
+
|
|
227
|
+
- 3.4 tags field:
|
|
228
|
+
|
|
229
|
+
>`tags:.*\[(.*)\]`
|
|
230
|
+
|
|
231
|
+
- 3.5 required field:
|
|
232
|
+
|
|
233
|
+
>`required:.*\[((?:.|\n)*)\]`
|
|
234
|
+
|
|
235
|
+
## 8 Redis cache and queue
|
|
236
|
+
|
|
237
|
+
The API can be configured to use a cache and/or queue system. Both are optional.
|
|
238
|
+
|
|
239
|
+
To configure only redis cache set the env var REDIS_CACHE_URL with the connection url to redis server (for example redis://user:pass@host:6379/1).
|
|
240
|
+
|
|
241
|
+
To configure only redis queue set the env var REDIS_QUEUE_URL with the connection url to redis server.
|
|
242
|
+
|
|
243
|
+
To configure both at once set the env var REDIS_URL with the connection url to redis server.
|
|
244
|
+
|
|
245
|
+
## 9 Generating json schema from ts definitions
|
|
246
|
+
|
|
247
|
+
The schema can be generated manually:
|
|
248
|
+
|
|
249
|
+
`npx ts-json-schema-generator --path 'my/project/**/*.ts' --type 'My.Type.Name'`
|
|
250
|
+
|
|
251
|
+
Or added to /schemas.json to be generated automatically on every precommit
|
|
252
|
+
|
|
253
|
+
## 10 Add a new language
|
|
254
|
+
|
|
255
|
+
To add a new language:
|
|
256
|
+
|
|
257
|
+
* Add to the `locales` array in `/i18next-parser.config.js`
|
|
258
|
+
* Run `npm run i18n:generate` to generate the new locale file with the default values (in english). This file should be translated.
|
|
259
|
+
* Done!
|
|
260
|
+
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
const n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2
|
+
__proto__: null
|
|
3
|
+
}, Symbol.toStringTag, { value: "Module" })), c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4
|
+
__proto__: null
|
|
5
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
6
|
+
var a = /* @__PURE__ */ ((e) => (e.OUTCOMES = "outcomes", e))(a || {}), o = /* @__PURE__ */ ((e) => (e.VALUECARD = "ValueCard", e.SECTIONCARD = "SectionCard", e.PATIENTLIST = "PatientList", e))(o || {});
|
|
7
|
+
const m = {
|
|
8
|
+
data_loaders: n,
|
|
9
|
+
widgets: c
|
|
10
|
+
}, i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
11
|
+
__proto__: null,
|
|
12
|
+
DashboardWidgetType: o,
|
|
13
|
+
DataLoaderType: a,
|
|
14
|
+
default: m
|
|
15
|
+
}, Symbol.toStringTag, { value: "Module" })), d = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
16
|
+
__proto__: null
|
|
17
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
18
|
+
var s = /* @__PURE__ */ ((e) => (e.QUESTIONNAIRE_CREATE = "questionnaire.create", e.CRF_CREATE = "crf.create", e.CRF_UPDATE = "crf.update", e.CRF_DELETE = "crf.delete", e))(s || {}), r = /* @__PURE__ */ ((e) => (e.JSON_LOGIC = "jsonLogic", e.CUSTOM = "custom", e))(r || {}), l = /* @__PURE__ */ ((e) => (e.CREATION = "creation", e.UPDATE = "update", e))(l || {}), t = /* @__PURE__ */ ((e) => (e.TEXT = "text", e.DATE = "date", e.TIME = "time", e.BOOLEAN = "boolean", e.NUMBER = "number", e.SELECT = "select", e.MULTISELECT = "multiselect", e))(t || {});
|
|
19
|
+
function u(e) {
|
|
20
|
+
return {
|
|
21
|
+
models: {
|
|
22
|
+
user: {
|
|
23
|
+
label: e("introspection-schema.models.user.label", "User"),
|
|
24
|
+
relations: [],
|
|
25
|
+
canJoinPatient: !0,
|
|
26
|
+
fields: [
|
|
27
|
+
{
|
|
28
|
+
name: "username",
|
|
29
|
+
type: t.TEXT,
|
|
30
|
+
label: e("introspection-schema.models.user.username", "Username")
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "created_user",
|
|
34
|
+
type: t.TEXT,
|
|
35
|
+
label: e("introspection-schema.models.user.created_user", "Created user")
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: "created_mode",
|
|
39
|
+
type: t.TEXT,
|
|
40
|
+
label: e("introspection-schema.models.user.created_mode", "Created mode")
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "mod_user",
|
|
44
|
+
type: t.NUMBER,
|
|
45
|
+
label: e("introspection-schema.models.user.mod_user", "User modified")
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "mod_time",
|
|
49
|
+
type: t.DATE,
|
|
50
|
+
label: e("introspection-schema.models.user.time", "Update date")
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "email",
|
|
54
|
+
type: t.TEXT,
|
|
55
|
+
label: e("introspection-schema.models.user.email", "Email")
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "password",
|
|
59
|
+
type: t.TEXT,
|
|
60
|
+
label: e("introspection-schema.models.user.password", "Password")
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "displayName",
|
|
64
|
+
type: t.TEXT,
|
|
65
|
+
label: e("introspection-schema.models.user.display-name", "Display name")
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "blocked",
|
|
69
|
+
type: t.BOOLEAN,
|
|
70
|
+
label: e("introspection-schema.models.user.blocked", "Blocked")
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "timestamp",
|
|
74
|
+
type: t.DATE,
|
|
75
|
+
label: e("introspection-schema.models.user.timestamp", "Creation date")
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "state",
|
|
79
|
+
type: t.BOOLEAN,
|
|
80
|
+
label: e("introspection-schema.models.user.state", "State")
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "newRegister",
|
|
84
|
+
type: t.BOOLEAN,
|
|
85
|
+
label: e("introspection-schema.models.user.new-register", "New register")
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "password_changed_date",
|
|
89
|
+
type: t.DATE,
|
|
90
|
+
label: e("introspection-schema.models.user.password-changed-date", "Password changed date")
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "token",
|
|
94
|
+
type: t.TEXT,
|
|
95
|
+
label: e("introspection-schema.models.user.token", "Token")
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "type",
|
|
99
|
+
type: t.TEXT,
|
|
100
|
+
label: e("introspection-schema.models.user.type", "Type")
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "expiry_date",
|
|
104
|
+
type: t.DATE,
|
|
105
|
+
label: e("introspection-schema.models.user.expiry-date", "Expiry date")
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "allow_upload",
|
|
109
|
+
type: t.BOOLEAN,
|
|
110
|
+
label: e("introspection-schema.models.user.allow-upload", "Allow upload")
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "allow_change_color",
|
|
114
|
+
type: t.BOOLEAN,
|
|
115
|
+
label: e("introspection-schema.models.user.allow-change-color", "Allow change color")
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: "clinic_request",
|
|
119
|
+
type: t.BOOLEAN,
|
|
120
|
+
label: e("introspection-schema.models.user.clinic-request", "Clinic request")
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: "favourite",
|
|
124
|
+
type: t.BOOLEAN,
|
|
125
|
+
label: e("introspection-schema.models.user.favourite", "Favourite")
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "last_access",
|
|
129
|
+
type: t.DATE,
|
|
130
|
+
label: e("introspection-schema.models.user.last-access", "Last access")
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: "temporary_password",
|
|
134
|
+
type: t.TEXT,
|
|
135
|
+
label: e("introspection-schema.models.user.temporary-password", "Temporary password")
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "currentFailedCount",
|
|
139
|
+
type: t.NUMBER,
|
|
140
|
+
label: e("introspection-schema.models.user.current-failed-count", "Current failed count")
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "tokenDate",
|
|
144
|
+
type: t.DATE,
|
|
145
|
+
label: e("introspection-schema.models.user.token-date", "Token date")
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
const p = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
153
|
+
__proto__: null,
|
|
154
|
+
ApiAction: s,
|
|
155
|
+
ConditionsFormat: r,
|
|
156
|
+
IntrospectionSchemaType: t,
|
|
157
|
+
TriggerAction: l,
|
|
158
|
+
getIntrospectionSchema: u
|
|
159
|
+
}, Symbol.toStringTag, { value: "Module" })), _ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
160
|
+
__proto__: null
|
|
161
|
+
}, Symbol.toStringTag, { value: "Module" })), b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
162
|
+
__proto__: null
|
|
163
|
+
}, Symbol.toStringTag, { value: "Module" })), E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
164
|
+
__proto__: null
|
|
165
|
+
}, Symbol.toStringTag, { value: "Module" })), T = {
|
|
166
|
+
dashboard: i,
|
|
167
|
+
authentication_security: d,
|
|
168
|
+
notification_configuration: p,
|
|
169
|
+
outcomes: _,
|
|
170
|
+
questionnaire: b,
|
|
171
|
+
user_settings: E
|
|
172
|
+
}, y = {
|
|
173
|
+
schemas: T
|
|
174
|
+
};
|
|
175
|
+
export {
|
|
176
|
+
y as default
|
|
177
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(o,a){typeof exports=="object"&&typeof module<"u"?module.exports=a():typeof define=="function"&&define.amd?define(a):(o=typeof globalThis<"u"?globalThis:o||self,o["perseed-api"]=a())})(this,function(){"use strict";const o=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),a=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var s=(e=>(e.OUTCOMES="outcomes",e))(s||{}),r=(e=>(e.VALUECARD="ValueCard",e.SECTIONCARD="SectionCard",e.PATIENTLIST="PatientList",e))(r||{});const c=Object.freeze(Object.defineProperty({__proto__:null,DashboardWidgetType:r,DataLoaderType:s,default:{data_loaders:o,widgets:a}},Symbol.toStringTag,{value:"Module"})),d=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));var n=(e=>(e.QUESTIONNAIRE_CREATE="questionnaire.create",e.CRF_CREATE="crf.create",e.CRF_UPDATE="crf.update",e.CRF_DELETE="crf.delete",e))(n||{}),l=(e=>(e.JSON_LOGIC="jsonLogic",e.CUSTOM="custom",e))(l||{}),i=(e=>(e.CREATION="creation",e.UPDATE="update",e))(i||{}),t=(e=>(e.TEXT="text",e.DATE="date",e.TIME="time",e.BOOLEAN="boolean",e.NUMBER="number",e.SELECT="select",e.MULTISELECT="multiselect",e))(t||{});function m(e){return{models:{user:{label:e("introspection-schema.models.user.label","User"),relations:[],canJoinPatient:!0,fields:[{name:"username",type:t.TEXT,label:e("introspection-schema.models.user.username","Username")},{name:"created_user",type:t.TEXT,label:e("introspection-schema.models.user.created_user","Created user")},{name:"created_mode",type:t.TEXT,label:e("introspection-schema.models.user.created_mode","Created mode")},{name:"mod_user",type:t.NUMBER,label:e("introspection-schema.models.user.mod_user","User modified")},{name:"mod_time",type:t.DATE,label:e("introspection-schema.models.user.time","Update date")},{name:"email",type:t.TEXT,label:e("introspection-schema.models.user.email","Email")},{name:"password",type:t.TEXT,label:e("introspection-schema.models.user.password","Password")},{name:"displayName",type:t.TEXT,label:e("introspection-schema.models.user.display-name","Display name")},{name:"blocked",type:t.BOOLEAN,label:e("introspection-schema.models.user.blocked","Blocked")},{name:"timestamp",type:t.DATE,label:e("introspection-schema.models.user.timestamp","Creation date")},{name:"state",type:t.BOOLEAN,label:e("introspection-schema.models.user.state","State")},{name:"newRegister",type:t.BOOLEAN,label:e("introspection-schema.models.user.new-register","New register")},{name:"password_changed_date",type:t.DATE,label:e("introspection-schema.models.user.password-changed-date","Password changed date")},{name:"token",type:t.TEXT,label:e("introspection-schema.models.user.token","Token")},{name:"type",type:t.TEXT,label:e("introspection-schema.models.user.type","Type")},{name:"expiry_date",type:t.DATE,label:e("introspection-schema.models.user.expiry-date","Expiry date")},{name:"allow_upload",type:t.BOOLEAN,label:e("introspection-schema.models.user.allow-upload","Allow upload")},{name:"allow_change_color",type:t.BOOLEAN,label:e("introspection-schema.models.user.allow-change-color","Allow change color")},{name:"clinic_request",type:t.BOOLEAN,label:e("introspection-schema.models.user.clinic-request","Clinic request")},{name:"favourite",type:t.BOOLEAN,label:e("introspection-schema.models.user.favourite","Favourite")},{name:"last_access",type:t.DATE,label:e("introspection-schema.models.user.last-access","Last access")},{name:"temporary_password",type:t.TEXT,label:e("introspection-schema.models.user.temporary-password","Temporary password")},{name:"currentFailedCount",type:t.NUMBER,label:e("introspection-schema.models.user.current-failed-count","Current failed count")},{name:"tokenDate",type:t.DATE,label:e("introspection-schema.models.user.token-date","Token date")}]}}}}return{schemas:{dashboard:c,authentication_security:d,notification_configuration:Object.freeze(Object.defineProperty({__proto__:null,ApiAction:n,ConditionsFormat:l,IntrospectionSchemaType:t,TriggerAction:i,getIntrospectionSchema:m},Symbol.toStringTag,{value:"Module"})),outcomes:Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),questionnaire:Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),user_settings:Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}))}}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Available MFA methods
|
|
3
|
+
*/
|
|
4
|
+
export type MFAMethodCode = 'sms' | 'email';
|
|
5
|
+
/**
|
|
6
|
+
* MFA method definition and configuration
|
|
7
|
+
*/
|
|
8
|
+
export interface MFAMethod {
|
|
9
|
+
code: MFAMethodCode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Global authentication security definition
|
|
13
|
+
*/
|
|
14
|
+
export interface AuthenticationSecurityDefinition {
|
|
15
|
+
mfaMethods?: MFAMethod[];
|
|
16
|
+
required?: boolean;
|
|
17
|
+
default?: MFAMethodCode;
|
|
18
|
+
}
|
|
19
|
+
export interface MFALoginData {
|
|
20
|
+
type: MFAMethodCode;
|
|
21
|
+
value: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* req.body object mfa validation
|
|
25
|
+
*/
|
|
26
|
+
export interface ReqBodyWithMFA {
|
|
27
|
+
mfa?: MFALoginData;
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}
|