@persei/perseed-api 4.34.12 → 4.34.14

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/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { AjvValidator } from 'objection';
2
+ import { Dayjs } from 'dayjs';
2
3
  import { default as default_2 } from 'objection';
3
4
  import { i18n } from 'i18next';
4
5
  import { Knex } from 'knex';
@@ -18,10 +19,10 @@ declare class AbstractDisplayer extends BaseModel {
18
19
  creation_time: string;
19
20
  mod_user: number;
20
21
  mod_time: string;
21
- static getModel(ctx: RequestContext): typeof AbstractDisplayer;
22
22
  static get QueryBuilder(): typeof CustomQueryBuilder;
23
23
  static get uidRefProp(): null;
24
24
  static get dbRefProp(): null;
25
+ static getModel(ctx: RequestContext): typeof AbstractDisplayer;
25
26
  getString(value: any): any;
26
27
  getNumber(value: any): any;
27
28
  $beforeDelete(queryContext: any): Promise<void>;
@@ -34,6 +35,8 @@ declare class AbstractDisplayer extends BaseModel {
34
35
 
35
36
  export declare type AggFunction = 'avg' | 'count' | 'max' | 'min' | 'sum';
36
37
 
38
+ export declare const allCountries: (string | number | string[])[][];
39
+
37
40
  export declare enum ApiAction {
38
41
  QUESTIONNAIRE_CREATE = "questionnaire.create",
39
42
  CRF_CREATE = "crf.create",
@@ -42,7 +45,7 @@ export declare enum ApiAction {
42
45
  EXTERNAL_API_CALL = "external_api_call"
43
46
  }
44
47
 
45
- declare interface ApiActionContextData {
48
+ export declare interface ApiActionContextData {
46
49
  ctx?: RequestContext;
47
50
  requestContextData?: RequestContextData;
48
51
  current: Record<string, unknown>;
@@ -71,14 +74,14 @@ export declare interface AuthenticationSecurityDefinition {
71
74
  default?: MFAMethodCode;
72
75
  }
73
76
 
74
- declare type BaseApiServicePayload = {
77
+ export declare type BaseApiServicePayload = {
75
78
  ctx?: RequestContext;
76
79
  } & Partial<ApiActionContextData>;
77
80
 
78
81
  declare class BaseModel extends Model {
79
82
  id: number;
80
- static createValidator(): AjvValidator;
81
83
  static get modelPaths(): string[];
84
+ static createValidator(): AjvValidator;
82
85
  $parseJson(json: any, _opt: any): any;
83
86
  }
84
87
 
@@ -414,6 +417,8 @@ export declare const CORE: {
414
417
  SUBFORM_ID: string;
415
418
  };
416
419
 
420
+ export declare const CountryPhoneCodes: {};
421
+
417
422
  export declare interface CreateDashboardPayload {
418
423
  title: string;
419
424
  active?: boolean;
@@ -511,6 +516,17 @@ declare type EcosystemUsers = {
511
516
 
512
517
  export declare const EXCLUDE_FIELDS: string[];
513
518
 
519
+ export declare const Exporter: {
520
+ PENDING: string;
521
+ ERROR: string;
522
+ SUCCESS: string;
523
+ AVAILABLE_FORMATS: {
524
+ xls: number;
525
+ csv: number;
526
+ spss: number;
527
+ };
528
+ };
529
+
514
530
  declare class ExternalDisplayerCrf extends BaseModel {
515
531
  crf_name: string;
516
532
  patient_id: number;
@@ -726,6 +742,8 @@ export declare enum FORM_TYPES {
726
742
  STUDY = 6
727
743
  }
728
744
 
745
+ export declare const FORMS_VIEW = "forms";
746
+
729
747
  export declare type GenericBooleanSetting = boolean;
730
748
 
731
749
  export declare interface GenericWidgetDataLoader {
@@ -733,7 +751,17 @@ export declare interface GenericWidgetDataLoader {
733
751
  params: Record<string, any>;
734
752
  }
735
753
 
736
- export declare function getIntrospectionSchema(t: TFunction): IntrospectionSchema;
754
+ export declare const HISTORY: {
755
+ PERMANENT: string;
756
+ TEMPORARY: string;
757
+ };
758
+
759
+ export declare const HISTORY_TYPE_OPTIONS: {
760
+ '0': string;
761
+ '1': string;
762
+ };
763
+
764
+ export declare const HISTORY_VIEW = "history";
737
765
 
738
766
  export declare const HREF_TYPE: {
739
767
  NEW_WINDOW: string;
@@ -741,8 +769,8 @@ export declare const HREF_TYPE: {
741
769
  };
742
770
 
743
771
  export declare interface I18nTextLocales {
744
- [locale: string]: string;
745
772
  default: string;
773
+ [locale: string]: string;
746
774
  }
747
775
 
748
776
  export declare type I18nTextTranslation = I18nTextLocales | string;
@@ -796,11 +824,15 @@ export declare interface IntrospectionSchemaModel {
796
824
 
797
825
  export declare const isNotStatusField: (fieldName: any) => boolean;
798
826
 
827
+ export declare const LANG_CODES: string[];
828
+
799
829
  export declare interface LoadPatientDataType {
800
830
  join?: string[];
801
831
  where: Record<string, string> | 'auto';
802
832
  }
803
833
 
834
+ export declare const LOCALE_LANG_CODES: string[];
835
+
804
836
  export declare const META_NAMES: {
805
837
  DEPENDENT_SOURCE: string;
806
838
  ENCRYPTED: string;
@@ -893,6 +925,8 @@ export declare interface MFAMethod {
893
925
  */
894
926
  export declare type MFAMethodCode = 'sms' | 'email';
895
927
 
928
+ export declare const MINIMIAL_TIMEZONE_LIST: string[];
929
+
896
930
  export declare type ModelName = string;
897
931
 
898
932
  export declare const MULTIPLE_SELECTION_SEPARATOR = "~";
@@ -911,6 +945,15 @@ export declare interface NotificationConfigurationConf {
911
945
  conditionsFormat?: ConditionsFormat;
912
946
  }
913
947
 
948
+ export declare const NOTIFIED_TYPES: {
949
+ EMAIL: number;
950
+ MOBILE: number;
951
+ PLATFORM: number;
952
+ SMS: number;
953
+ HL7: number;
954
+ ALL: string[];
955
+ };
956
+
914
957
  export declare class NotifiedAboutInfo {
915
958
  notified_about: string;
916
959
  constructor(notifiedAbout: string);
@@ -934,9 +977,6 @@ export declare const OBJECT_TYPE: string[];
934
977
 
935
978
  declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
936
979
 
937
- /**
938
- * Any changes here may need changes in Caaring-js packages/perseed-api-client/src/PerseedApiClient.ts
939
- */
940
980
  export declare type OrderDir = 'asc' | 'desc';
941
981
 
942
982
  export declare type Outcome = OutcomeDateGroup & {
@@ -1105,7 +1145,6 @@ declare class Profiling extends BaseModel {
1105
1145
  };
1106
1146
  static getModel(ctx: RequestContext): typeof Profiling;
1107
1147
  static getFirstProProfilingId(ctx: RequestContext, projectId: number): Promise<number | undefined>;
1108
- isProProfiling(seedPrivileges: SeedPrivilege[]): boolean;
1109
1148
  static hasAddPatient(seedPrivilegeName: string): boolean;
1110
1149
  static hasConfigNotifications(seedPrivilegeName: string): boolean;
1111
1150
  static hasManageUsers(seedPrivilegeName: string): boolean;
@@ -1117,6 +1156,8 @@ declare class Profiling extends BaseModel {
1117
1156
  static hasDeleteDocumentsPermission(seedPrivilegeName: string): boolean;
1118
1157
  static hasDownloadDocumentsPermission(seedPrivilegeName: string): boolean;
1119
1158
  static hasDisplayPatientListPrivilege(seedPrivilegeName: string): boolean;
1159
+ static checkIfProfilingExists(ctx: RequestContext, profilingId?: number): Promise<boolean>;
1160
+ isProProfiling(seedPrivileges: SeedPrivilege[]): boolean;
1120
1161
  hasManageUsersPrivilege(): boolean;
1121
1162
  hasCoreProUserSensitiveInfoPrivilege(): boolean;
1122
1163
  hasUserManagementMyOrganizationsPrivilege(): boolean;
@@ -1135,7 +1176,6 @@ declare class Profiling extends BaseModel {
1135
1176
  hasConnectorAddFieldPrivilege(): boolean;
1136
1177
  hasRawExportPrivilege(): boolean;
1137
1178
  hasExportConfigurationsExplicitAccessOnlyPrivilege(): boolean;
1138
- static checkIfProfilingExists(ctx: RequestContext, profilingId?: number): Promise<boolean>;
1139
1179
  isPro(): boolean;
1140
1180
  isNonPro(): boolean;
1141
1181
  hasEnabledForm(formName: any): boolean;
@@ -1419,18 +1459,56 @@ declare class Project extends BaseModel {
1419
1459
  static getProjectLabel(ctx: RequestContext, projectName: string): Promise<string | undefined>;
1420
1460
  }
1421
1461
 
1422
- declare enum QuestionnaireInfoUpdateMode {
1462
+ export declare const QUESTIONNAIRE_DATE: {
1463
+ DATE: string;
1464
+ TIME: string;
1465
+ };
1466
+
1467
+ export declare const QUESTIONNAIRE_TYPE: {
1468
+ TYPE: string;
1469
+ };
1470
+
1471
+ export declare const QUESTIONNAIRE_TYPE_OPTIONS: {
1472
+ '0': string;
1473
+ '1': string;
1474
+ };
1475
+
1476
+ export declare interface QuestionnaireInfoData extends QuestionnaireInfoPatchData {
1477
+ id: number;
1478
+ }
1479
+
1480
+ export declare interface QuestionnaireInfoPatchData {
1481
+ crf_name?: string;
1482
+ patient_id: number;
1483
+ number_of_questionaries?: number | null;
1484
+ last_update?: string | null;
1485
+ last_update_form_id?: number | null;
1486
+ procedure_date: string;
1487
+ activation_date?: Dayjs | string | null;
1488
+ end_date?: string | null;
1489
+ next_date?: string | null;
1490
+ finish_date?: string | null;
1491
+ questionaries_not_filled?: number | null;
1492
+ flexible_entry?: number;
1493
+ field_reference_id?: number | null;
1494
+ total_tasks: number;
1495
+ activation_time_tz?: string | null;
1496
+ }
1497
+
1498
+ export declare enum QuestionnaireInfoUpdateMode {
1423
1499
  START_OVER = 0,
1424
1500
  RESUME = 1
1425
1501
  }
1426
1502
 
1427
- declare interface QuestionnaireInfoUpdateOptions {
1503
+ export declare interface QuestionnaireInfoUpdateOptions {
1428
1504
  defaultMode: QuestionnaireInfoUpdateMode;
1429
1505
  referenceFieldIdModes?: {
1430
1506
  [key: string]: QuestionnaireInfoUpdateMode;
1431
1507
  };
1432
1508
  }
1433
1509
 
1510
+ export declare type QuestionnaireTypeValue = 'QoL' | 'Task';
1511
+
1434
1512
  /**
1435
1513
  * req.body object mfa validation
1436
1514
  */
@@ -1543,6 +1621,10 @@ declare class RequestContext implements RequestContextData {
1543
1621
  ecosystemName?: string | null;
1544
1622
  projectName?: string | null;
1545
1623
  };
1624
+ private constructor();
1625
+ get userType(): string | undefined;
1626
+ get acceptLanguage(): string;
1627
+ get t(): TFunction<["translation", ...string[]], undefined>;
1546
1628
  static create(data: RequestContextData): Promise<RequestContext>;
1547
1629
  static createFromRequest(req: Request_2): Promise<RequestContext>;
1548
1630
  static getRequestDataWithUser(req: Optional<Request_2, 'ctx'>, u: Partial<UserData>): RequestContextData;
@@ -1559,14 +1641,9 @@ declare class RequestContext implements RequestContextData {
1559
1641
  reqId?: string | undefined;
1560
1642
  };
1561
1643
  getStaticRequestData(): Partial<RequestContextData>;
1562
- private constructor();
1563
- private init;
1564
1644
  updateContextData(data: Partial<RequestContextData>): Promise<void>;
1565
- get userType(): string | undefined;
1566
- get acceptLanguage(): string;
1567
1645
  getRequestContextData(): RequestContextData;
1568
1646
  cloneWithData(data: Partial<RequestContextData>): Promise<RequestContext>;
1569
- get t(): TFunction<["translation", ...string[]], undefined>;
1570
1647
  getProjectPool(): Knex;
1571
1648
  getEcosystemPool(): Knex;
1572
1649
  getPerseedPool(): Knex;
@@ -1578,6 +1655,7 @@ declare class RequestContext implements RequestContextData {
1578
1655
  getEcosystemName(): string;
1579
1656
  getEcosystemId(): number;
1580
1657
  getPatientId(): number;
1658
+ private init;
1581
1659
  }
1582
1660
 
1583
1661
  declare interface RequestContextData {
@@ -1614,6 +1692,13 @@ declare class Role extends BaseModel {
1614
1692
  static getIdByRoleId(ctx: RequestContext, roleId: string): Promise<number | undefined>;
1615
1693
  }
1616
1694
 
1695
+ export declare const ROLES: {
1696
+ PERSEED_ADMIN: string;
1697
+ ECOSYSTEM_ADMIN: string;
1698
+ USER: string;
1699
+ SALE: string;
1700
+ };
1701
+
1617
1702
  export declare interface SectionCardProps {
1618
1703
  icon: string;
1619
1704
  background?: string;
@@ -1625,7 +1710,7 @@ export declare interface SectionCardProps {
1625
1710
  /**
1626
1711
  * Seed Privilege constants
1627
1712
  */
1628
- declare const SEED_PRIVILEGE: {
1713
+ export declare const SEED_PRIVILEGE: {
1629
1714
  readonly ADD_PATIENT: "add_patient";
1630
1715
  readonly ADD_REPEATABLE_CRF: "add_repeat_crf";
1631
1716
  readonly ADVANCED_FILTER: "advanced_filter";
@@ -1666,7 +1751,7 @@ declare const SEED_PRIVILEGE: {
1666
1751
 
1667
1752
  declare type SEED_PRIVILEGE_Keys = keyof typeof SEED_PRIVILEGE;
1668
1753
 
1669
- declare type SEED_PRIVILEGES = typeof SEED_PRIVILEGE[SEED_PRIVILEGE_Keys];
1754
+ export declare type SEED_PRIVILEGES = typeof SEED_PRIVILEGE[SEED_PRIVILEGE_Keys];
1670
1755
 
1671
1756
  declare class SeedPrivilege extends BaseModel {
1672
1757
  seed_id: number;
@@ -1782,6 +1867,12 @@ export declare const SLIDER_TYPE: {
1782
1867
  IMAGES: string;
1783
1868
  };
1784
1869
 
1870
+ export declare enum STATUS {
1871
+ CLOSED = "Closed",
1872
+ OPEN = "Open",
1873
+ COMING_SOON = "Coming soon"
1874
+ }
1875
+
1785
1876
  export declare const STATUS_FIELD_REGEXP: RegExp;
1786
1877
 
1787
1878
  export declare const STATUS_SUFFIX = "_status";
@@ -1831,6 +1922,11 @@ export declare enum TriggerAction {
1831
1922
  UPDATE = "update"
1832
1923
  }
1833
1924
 
1925
+ export declare const TYPE: {
1926
+ QOL: string;
1927
+ TASK: string;
1928
+ };
1929
+
1834
1930
  export declare type UpdateDashboardPayload = Partial<CreateDashboardPayload>;
1835
1931
 
1836
1932
  export declare interface UpdateFormPayload extends BaseApiServicePayload {
@@ -2132,6 +2228,9 @@ declare class User extends BaseModel {
2132
2228
  static logAccess(ctx: RequestContext, userId: number, checkPrevValue?: boolean): Promise<void>;
2133
2229
  static logFailedLogin(ecosystemPool: default_2.TransactionOrKnex, userId: number): Promise<User[]>;
2134
2230
  static resetCurrentFailedCount(ecosystemPool: default_2.TransactionOrKnex, userId: number): Promise<number>;
2231
+ static checkUploadDocumentsPermissions(projectId: number, profilings: Profiling[]): boolean;
2232
+ static checkDeleteDocumentsPermissions(projectId: number, profilings: Profiling[]): boolean;
2233
+ static checkDownloadDocumentsPermissions(projectId: number, profilings: Profiling[]): boolean;
2135
2234
  getCrfFilter(projectName: string): string[] | null;
2136
2235
  getClinics(): Clinic[];
2137
2236
  checkIfAccountIsActivated(activationToken: string): boolean;
@@ -2145,9 +2244,6 @@ declare class User extends BaseModel {
2145
2244
  checkConfigNotificationsPermissions(projectId: number): boolean;
2146
2245
  checkDisplayPatientListPermissions(projectId: number): boolean;
2147
2246
  checkOnlyUpdatePatientsPermissions(projectName: string): boolean;
2148
- static checkUploadDocumentsPermissions(projectId: number, profilings: Profiling[]): boolean;
2149
- static checkDeleteDocumentsPermissions(projectId: number, profilings: Profiling[]): boolean;
2150
- static checkDownloadDocumentsPermissions(projectId: number, profilings: Profiling[]): boolean;
2151
2247
  checkPermission(ctx: RequestContext, privilege: SEED_PRIVILEGES): boolean;
2152
2248
  checkUserProject(projectId: number): boolean;
2153
2249
  isPerseedAdmin(): boolean;