@persei/perseed-api 4.34.4 → 4.34.6

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 (29) hide show
  1. package/dist/index.d.ts +2541 -0
  2. package/dist/perseed-api.mjs +487 -34
  3. package/dist/perseed-api.umd.js +1 -1
  4. package/dist/schemas/dashboard/create_dashboard_payload.schema.json +50 -20
  5. package/dist/schemas/dashboard/update_dashboard_payload.schema.json +50 -20
  6. package/dist/schemas/notification_configuration/create_trigger_payload.schema.json +1 -1
  7. package/dist/schemas/notification_configuration/update_trigger_payload.schema.json +1 -1
  8. package/package.json +3 -9
  9. package/dist/schemas/authentication_security/index.d.ts +0 -1
  10. package/dist/schemas/authentication_security/types.d.ts +0 -29
  11. package/dist/schemas/dashboard/data_loaders/Outcomes.d.ts +0 -6
  12. package/dist/schemas/dashboard/data_loaders/index.d.ts +0 -1
  13. package/dist/schemas/dashboard/i18n.d.ts +0 -6
  14. package/dist/schemas/dashboard/index.d.ts +0 -10
  15. package/dist/schemas/dashboard/types.d.ts +0 -51
  16. package/dist/schemas/dashboard/widgets/PatientListProps.d.ts +0 -16
  17. package/dist/schemas/dashboard/widgets/SectionCardProps.d.ts +0 -9
  18. package/dist/schemas/dashboard/widgets/ValueCardProps.d.ts +0 -13
  19. package/dist/schemas/dashboard/widgets/index.d.ts +0 -3
  20. package/dist/schemas/index.d.ts +0 -6
  21. package/dist/schemas/notification_configuration/index.d.ts +0 -2
  22. package/dist/schemas/notification_configuration/introspectionShema.d.ts +0 -3
  23. package/dist/schemas/notification_configuration/types.d.ts +0 -91
  24. package/dist/schemas/outcomes/index.d.ts +0 -1
  25. package/dist/schemas/outcomes/types.d.ts +0 -35
  26. package/dist/schemas/questionnaire/index.d.ts +0 -1
  27. package/dist/schemas/questionnaire/types.d.ts +0 -7
  28. package/dist/schemas/user_settings/index.d.ts +0 -1
  29. package/dist/schemas/user_settings/types.d.ts +0 -5
@@ -140,22 +140,25 @@
140
140
  "I18nTextTranslation": {
141
141
  "anyOf": [
142
142
  {
143
- "type": "object",
144
- "properties": {
145
- "default": {
146
- "type": "string"
147
- }
148
- },
149
- "required": ["default"],
150
- "additionalProperties": {
151
- "type": "string"
152
- }
143
+ "$ref": "#/definitions/I18nTextLocales"
153
144
  },
154
145
  {
155
146
  "type": "string"
156
147
  }
157
148
  ]
158
149
  },
150
+ "I18nTextLocales": {
151
+ "type": "object",
152
+ "properties": {
153
+ "default": {
154
+ "type": "string"
155
+ }
156
+ },
157
+ "required": ["default"],
158
+ "additionalProperties": {
159
+ "type": "string"
160
+ }
161
+ },
159
162
  "ColProps": {
160
163
  "type": "object",
161
164
  "properties": {
@@ -374,8 +377,7 @@
374
377
  "type": "boolean"
375
378
  },
376
379
  "aggType": {
377
- "type": "string",
378
- "enum": ["avg", "count", "max", "min", "sum"]
380
+ "$ref": "#/definitions/AggFunction"
379
381
  },
380
382
  "groupBy": {
381
383
  "anyOf": [
@@ -397,9 +399,7 @@
397
399
  "type": "string"
398
400
  },
399
401
  "orderDir": {
400
- "type": "string",
401
- "enum": ["asc", "desc"],
402
- "description": "Any changes here may need changes in Caaring-js packages/perseed-api-client/src/PerseedApiClient.ts"
402
+ "$ref": "#/definitions/OrderDir"
403
403
  }
404
404
  },
405
405
  "required": ["ecosystem", "projectName", "name"],
@@ -409,14 +409,39 @@
409
409
  "required": ["type", "params"],
410
410
  "additionalProperties": false
411
411
  },
412
+ "AggFunction": {
413
+ "type": "string",
414
+ "enum": ["avg", "count", "max", "min", "sum"]
415
+ },
412
416
  "OutcomesGroupBy": {
417
+ "anyOf": [
418
+ {
419
+ "type": "string",
420
+ "const": "name"
421
+ },
422
+ {
423
+ "type": "string",
424
+ "const": "identifier"
425
+ },
426
+ {
427
+ "type": "string",
428
+ "const": "value"
429
+ },
430
+ {
431
+ "$ref": "#/definitions/OutcomesDateFields"
432
+ },
433
+ {
434
+ "$ref": "#/definitions/OutcomeDateField"
435
+ }
436
+ ]
437
+ },
438
+ "OutcomesDateFields": {
439
+ "type": "string",
440
+ "enum": ["from", "to"]
441
+ },
442
+ "OutcomeDateField": {
413
443
  "type": "string",
414
444
  "enum": [
415
- "name",
416
- "identifier",
417
- "value",
418
- "from",
419
- "to",
420
445
  "from.date",
421
446
  "from.day",
422
447
  "from.dayname",
@@ -453,6 +478,11 @@
453
478
  "to.yearweek"
454
479
  ]
455
480
  },
481
+ "OrderDir": {
482
+ "type": "string",
483
+ "enum": ["asc", "desc"],
484
+ "description": "Any changes here may need changes in Caaring-js packages/perseed-api-client/src/PerseedApiClient.ts"
485
+ },
456
486
  "PatientListProps": {
457
487
  "type": "object",
458
488
  "properties": {
@@ -139,22 +139,25 @@
139
139
  "I18nTextTranslation": {
140
140
  "anyOf": [
141
141
  {
142
- "type": "object",
143
- "properties": {
144
- "default": {
145
- "type": "string"
146
- }
147
- },
148
- "required": ["default"],
149
- "additionalProperties": {
150
- "type": "string"
151
- }
142
+ "$ref": "#/definitions/I18nTextLocales"
152
143
  },
153
144
  {
154
145
  "type": "string"
155
146
  }
156
147
  ]
157
148
  },
149
+ "I18nTextLocales": {
150
+ "type": "object",
151
+ "properties": {
152
+ "default": {
153
+ "type": "string"
154
+ }
155
+ },
156
+ "required": ["default"],
157
+ "additionalProperties": {
158
+ "type": "string"
159
+ }
160
+ },
158
161
  "ColProps": {
159
162
  "type": "object",
160
163
  "properties": {
@@ -373,8 +376,7 @@
373
376
  "type": "boolean"
374
377
  },
375
378
  "aggType": {
376
- "type": "string",
377
- "enum": ["avg", "count", "max", "min", "sum"]
379
+ "$ref": "#/definitions/AggFunction"
378
380
  },
379
381
  "groupBy": {
380
382
  "anyOf": [
@@ -396,9 +398,7 @@
396
398
  "type": "string"
397
399
  },
398
400
  "orderDir": {
399
- "type": "string",
400
- "enum": ["asc", "desc"],
401
- "description": "Any changes here may need changes in Caaring-js packages/perseed-api-client/src/PerseedApiClient.ts"
401
+ "$ref": "#/definitions/OrderDir"
402
402
  }
403
403
  },
404
404
  "required": ["ecosystem", "projectName", "name"],
@@ -408,14 +408,39 @@
408
408
  "required": ["type", "params"],
409
409
  "additionalProperties": false
410
410
  },
411
+ "AggFunction": {
412
+ "type": "string",
413
+ "enum": ["avg", "count", "max", "min", "sum"]
414
+ },
411
415
  "OutcomesGroupBy": {
416
+ "anyOf": [
417
+ {
418
+ "type": "string",
419
+ "const": "name"
420
+ },
421
+ {
422
+ "type": "string",
423
+ "const": "identifier"
424
+ },
425
+ {
426
+ "type": "string",
427
+ "const": "value"
428
+ },
429
+ {
430
+ "$ref": "#/definitions/OutcomesDateFields"
431
+ },
432
+ {
433
+ "$ref": "#/definitions/OutcomeDateField"
434
+ }
435
+ ]
436
+ },
437
+ "OutcomesDateFields": {
438
+ "type": "string",
439
+ "enum": ["from", "to"]
440
+ },
441
+ "OutcomeDateField": {
412
442
  "type": "string",
413
443
  "enum": [
414
- "name",
415
- "identifier",
416
- "value",
417
- "from",
418
- "to",
419
444
  "from.date",
420
445
  "from.day",
421
446
  "from.dayname",
@@ -452,6 +477,11 @@
452
477
  "to.yearweek"
453
478
  ]
454
479
  },
480
+ "OrderDir": {
481
+ "type": "string",
482
+ "enum": ["asc", "desc"],
483
+ "description": "Any changes here may need changes in Caaring-js packages/perseed-api-client/src/PerseedApiClient.ts"
484
+ },
455
485
  "PatientListProps": {
456
486
  "type": "object",
457
487
  "properties": {
@@ -160,7 +160,7 @@
160
160
  },
161
161
  "ApiAction": {
162
162
  "type": "string",
163
- "enum": ["questionnaire.create", "crf.create", "crf.update", "crf.delete"]
163
+ "enum": ["questionnaire.create", "crf.create", "crf.update", "crf.delete", "external_api_call"]
164
164
  },
165
165
  "ConditionsFormat": {
166
166
  "type": "string",
@@ -159,7 +159,7 @@
159
159
  },
160
160
  "ApiAction": {
161
161
  "type": "string",
162
- "enum": ["questionnaire.create", "crf.create", "crf.update", "crf.delete"]
162
+ "enum": ["questionnaire.create", "crf.create", "crf.update", "crf.delete", "external_api_call"]
163
163
  },
164
164
  "ConditionsFormat": {
165
165
  "type": "string",
package/package.json CHANGED
@@ -1,22 +1,16 @@
1
1
  {
2
2
  "name": "@persei/perseed-api",
3
- "version": "4.34.4",
3
+ "version": "4.34.6",
4
4
  "private": false,
5
5
  "main": "./dist/perseed-api.umd.cjs",
6
6
  "module": "./dist/perseed-api.js",
7
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
8
  "files": [
15
9
  "dist"
16
10
  ],
17
11
  "scripts": {
18
- "publish": "npm run precommit && npm run build && npm publish",
19
- "build": "tsc && vite build",
12
+ "publish_package": "npm run precommit && npm run build && npm publish",
13
+ "build": "tsc --noEmit && vite build",
20
14
  "start": "ts-node src/server.ts",
21
15
  "lint": "npm run test:lint",
22
16
  "jshint": "jshint . > report.txt || true",
@@ -1 +0,0 @@
1
- export * from './types';
@@ -1,29 +0,0 @@
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
- }
@@ -1,6 +0,0 @@
1
- import { DataLoaderType } from '../types';
2
- import { OutcomesParams } from '../../outcomes/types';
3
- export interface WidgetOutcomesDataLoader {
4
- type: DataLoaderType.OUTCOMES;
5
- params: OutcomesParams;
6
- }
@@ -1 +0,0 @@
1
- export * from './Outcomes';
@@ -1,6 +0,0 @@
1
- interface I18nTextLocales {
2
- [locale: string]: string;
3
- default: string;
4
- }
5
- export type I18nTextTranslation = I18nTextLocales | string;
6
- export {};
@@ -1,10 +0,0 @@
1
- import * as data_loaders from './data_loaders';
2
- import * as widgets from './widgets';
3
- export * from './types';
4
- export * from './i18n';
5
- export * from './col.d';
6
- declare const dashboard: {
7
- data_loaders: typeof data_loaders;
8
- widgets: typeof widgets;
9
- };
10
- export default dashboard;
@@ -1,51 +0,0 @@
1
- import { ColProps } from './col';
2
- import { PatientListProps } from './widgets/PatientListProps';
3
- import { SectionCardProps } from './widgets/SectionCardProps';
4
- import { ValueCardProps } from './widgets/ValueCardProps';
5
- /**
6
- * Any changes here may need changes in Caaring-js packages/perseed-react-ui-components/src/dashboards/types.ts
7
- */
8
- export declare enum DataLoaderType {
9
- OUTCOMES = "outcomes"
10
- }
11
- export interface GenericWidgetDataLoader {
12
- type: DataLoaderType;
13
- params: Record<string, any>;
14
- }
15
- export type WidgetDataLoader<T> = T extends {
16
- type: infer Type;
17
- params: infer Params;
18
- } ? {
19
- type: Type;
20
- params: Params;
21
- } : never;
22
- interface BaseWidget {
23
- size?: number | ColProps;
24
- }
25
- export declare enum DashboardWidgetType {
26
- VALUECARD = "ValueCard",
27
- SECTIONCARD = "SectionCard",
28
- PATIENTLIST = "PatientList"
29
- }
30
- export type Widget = BaseWidget & ({
31
- type: DashboardWidgetType.SECTIONCARD;
32
- params: SectionCardProps;
33
- } | {
34
- type: DashboardWidgetType.VALUECARD;
35
- params: ValueCardProps;
36
- } | {
37
- type: DashboardWidgetType.PATIENTLIST;
38
- params: PatientListProps;
39
- });
40
- export interface DashboardConfig {
41
- widgets?: Widget[];
42
- }
43
- export interface CreateDashboardPayload {
44
- title: string;
45
- active?: boolean;
46
- config?: DashboardConfig;
47
- icon?: string | null;
48
- weight?: number;
49
- }
50
- export type UpdateDashboardPayload = Partial<CreateDashboardPayload>;
51
- export {};
@@ -1,16 +0,0 @@
1
- export interface PatientListProps {
2
- loadUserProfiles?: boolean;
3
- loadAdherence?: boolean;
4
- extraFields?: string[];
5
- loadPushTokens?: boolean;
6
- loadUserAccessData?: boolean;
7
- programId?: number | null;
8
- prevAdherenceDays?: number | null;
9
- filter?: FilterParams;
10
- }
11
- export interface FilterParams {
12
- conditions?: Record<string, unknown>;
13
- relatedData?: {
14
- join?: string[];
15
- };
16
- }
@@ -1,9 +0,0 @@
1
- import { Widget } from '../types';
2
- import { I18nTextTranslation } from '../i18n';
3
- export interface SectionCardProps {
4
- icon: string;
5
- background?: string;
6
- titleBackground?: string;
7
- title: I18nTextTranslation;
8
- widgets: Widget[];
9
- }
@@ -1,13 +0,0 @@
1
- import { I18nTextTranslation } from '../i18n';
2
- import { WidgetDataLoader } from '../types';
3
- import { WidgetOutcomesDataLoader } from '../data_loaders/Outcomes';
4
- export interface ValueCardProps {
5
- title: I18nTextTranslation;
6
- icon: string;
7
- text: I18nTextTranslation;
8
- subtext?: I18nTextTranslation;
9
- titleTextColor?: string;
10
- bodyTextColor?: string;
11
- data?: Record<string, any>;
12
- dataLoader?: WidgetDataLoader<WidgetOutcomesDataLoader>;
13
- }
@@ -1,3 +0,0 @@
1
- export * from './PatientListProps';
2
- export * from './SectionCardProps';
3
- export * from './ValueCardProps';
@@ -1,6 +0,0 @@
1
- export * from './dashboard';
2
- export * from './authentication_security';
3
- export * from './notification_configuration';
4
- export * from './outcomes';
5
- export * from './questionnaire';
6
- export * from './user_settings';
@@ -1,2 +0,0 @@
1
- export * from './types';
2
- export * from './introspectionShema';
@@ -1,3 +0,0 @@
1
- import { TFunction } from 'i18next';
2
- import { IntrospectionSchema } from './types';
3
- export declare function getIntrospectionSchema(t: TFunction): IntrospectionSchema;
@@ -1,91 +0,0 @@
1
- type ModelName = string;
2
- export declare enum ApiAction {
3
- QUESTIONNAIRE_CREATE = "questionnaire.create",
4
- CRF_CREATE = "crf.create",
5
- CRF_UPDATE = "crf.update",
6
- CRF_DELETE = "crf.delete"
7
- }
8
- export type NotifiedAboutType = `model_${ModelName}` | `model_displayer_${ModelName}` | `model_${ModelName}_${TriggerAction}` | `model_displayer_${ModelName}_${TriggerAction}`;
9
- export interface CreateTriggerPayload {
10
- notified_about: NotifiedAboutType;
11
- text_content?: string;
12
- configuration?: NotificationConfigurationConf;
13
- }
14
- export type UpdateTriggerPayload = Partial<CreateTriggerPayload>;
15
- export interface ConditionExpression {
16
- [field: string]: ConditionValue;
17
- }
18
- export interface ConditionOperator {
19
- AND?: Conditions[];
20
- OR?: Conditions[];
21
- NOT?: Conditions[];
22
- JQ?: string;
23
- }
24
- export type Conditions = ConditionExpression | ConditionOperator;
25
- export interface ConditionValue {
26
- equal?: string | number | boolean;
27
- not_equal?: string | number | boolean;
28
- contains?: string;
29
- not_contains?: string;
30
- greater_than?: string | number;
31
- less_than?: string | number;
32
- empty?: string | number | boolean;
33
- not_empty?: string | number | boolean;
34
- parseValue?: boolean;
35
- operator?: 'AND' | 'OR';
36
- }
37
- interface LoadPatientDataType {
38
- join?: string[];
39
- where: Record<string, string> | 'auto';
40
- }
41
- export declare enum ConditionsFormat {
42
- JSON_LOGIC = "jsonLogic",
43
- CUSTOM = "custom"
44
- }
45
- /**
46
- * Importing the types from json-logic-js makes the process of generating schema.json fails so we use any instead
47
- */
48
- export type ConditionsRules = Conditions | any;
49
- export interface NotificationConfigurationConf {
50
- conditions?: ConditionsRules;
51
- join?: string[];
52
- load_patient?: LoadPatientDataType;
53
- action?: ApiAction;
54
- conditionsFormat?: ConditionsFormat;
55
- }
56
- export declare enum TriggerAction {
57
- CREATION = "creation",
58
- UPDATE = "update"
59
- }
60
- export declare enum IntrospectionSchemaType {
61
- TEXT = "text",
62
- DATE = "date",
63
- TIME = "time",
64
- BOOLEAN = "boolean",
65
- NUMBER = "number",
66
- SELECT = "select",
67
- MULTISELECT = "multiselect"
68
- }
69
- export interface IntrospectionField {
70
- name: string;
71
- type: IntrospectionSchemaType;
72
- options?: {
73
- value: string;
74
- title: string;
75
- }[];
76
- label: string;
77
- }
78
- export interface IntrospectionOption {
79
- value: string;
80
- label: string;
81
- }
82
- export interface IntrospectionSchemaModel {
83
- label: string;
84
- fields: IntrospectionField[];
85
- relations?: IntrospectionOption[];
86
- canJoinPatient?: boolean;
87
- }
88
- export interface IntrospectionSchema {
89
- models: Record<string, IntrospectionSchemaModel>;
90
- }
91
- export {};
@@ -1 +0,0 @@
1
- export * from './types';
@@ -1,35 +0,0 @@
1
- /**
2
- * Any changes here may need changes in Caaring-js packages/perseed-api-client/src/PerseedApiClient.ts
3
- */
4
- type OrderDir = 'asc' | 'desc';
5
- type AggFunction = 'avg' | 'count' | 'max' | 'min' | 'sum';
6
- type OutcomesDateFields = 'from' | 'to';
7
- type OutcomesDateFunctions = 'date' | 'day' | 'dayname' | 'dayofmonth' | 'dayofweek' | 'dayofyear' | 'hour' | 'minute' | 'month' | 'monthname' | 'time' | 'second' | 'week' | 'weekday' | 'weekofyear' | 'year' | 'yearweek';
8
- type OutcomeDateField = `${OutcomesDateFields}.${OutcomesDateFunctions}`;
9
- export type OutcomesGroupBy = 'name' | 'identifier' | 'value' | OutcomesDateFields | OutcomeDateField;
10
- interface OutcomeDateGroup {
11
- [dateGroup: string]: string;
12
- }
13
- export type Outcome = OutcomeDateGroup & {
14
- name: string;
15
- identifier: string;
16
- from: string;
17
- to: string;
18
- value: number;
19
- };
20
- export interface OutcomesParams {
21
- ecosystem: string;
22
- projectName: string;
23
- clinicId?: number;
24
- name: string | string[];
25
- identifier?: string | string[];
26
- from?: string;
27
- to?: string;
28
- datesContained?: boolean;
29
- aggType?: AggFunction;
30
- groupBy?: OutcomesGroupBy | OutcomesGroupBy[];
31
- limit?: number;
32
- orderBy?: string;
33
- orderDir?: OrderDir;
34
- }
35
- export {};
@@ -1 +0,0 @@
1
- export * from './types';
@@ -1,7 +0,0 @@
1
- export interface CreateQuestionnairePayload {
2
- patientId?: number;
3
- type: 'unique' | 'periodic';
4
- date: string;
5
- untilDate?: string;
6
- formName: string;
7
- }
@@ -1 +0,0 @@
1
- export * from './types';
@@ -1,5 +0,0 @@
1
- /**
2
- * App font factor
3
- */
4
- export type AppFontFactor = number;
5
- export type GenericBooleanSetting = boolean;