@persei/perseed-api 4.34.17 → 4.34.18

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
@@ -78,6 +78,31 @@ export declare type BaseApiServicePayload = {
78
78
  ctx?: RequestContext;
79
79
  } & Partial<ApiActionContextData>;
80
80
 
81
+ export declare type BaseDashboardWidget = (BaseDashboardWidgetPayload & {
82
+ type: DashboardWidgetType.SECTIONCARD;
83
+ params: SectionCardProps;
84
+ }) | (BaseDashboardWidgetPayload & {
85
+ type: DashboardWidgetType.VALUECARD;
86
+ params: ValueCardProps;
87
+ }) | (BaseDashboardWidgetPayload & {
88
+ type: DashboardWidgetType.PATIENTLIST;
89
+ params: PatientListProps;
90
+ }) | (BaseDashboardWidgetPayload & {
91
+ type: DashboardWidgetType.DASHBOARD;
92
+ params: DashboardProps;
93
+ });
94
+
95
+ export declare type BaseDashboardWidgetPayload<T extends DashboardWidgetType | undefined = undefined> = {
96
+ id?: number;
97
+ title: string;
98
+ description?: string;
99
+ size?: number | ColProps;
100
+ type: T | DashboardWidgetType;
101
+ library: boolean;
102
+ config?: WidgetBlockConfig;
103
+ position?: number;
104
+ };
105
+
81
106
  declare class BaseModel extends Model {
82
107
  id: number;
83
108
  static get modelPaths(): string[];
@@ -462,16 +487,32 @@ export declare type DashboardBaseWidgetPayload = {
462
487
  description?: string;
463
488
  weight?: number;
464
489
  size?: number | ColProps;
490
+ library?: boolean;
491
+ widgetsBlocks?: DashboardWidgetBlockCreatePayload[];
465
492
  };
466
493
 
467
494
  export declare interface DashboardProps {
468
- title: string;
469
495
  active?: boolean;
470
496
  config?: any;
471
497
  icon?: string | null;
472
- weight?: number;
473
498
  }
474
499
 
500
+ export declare type DashboardWidget<T extends DashboardWidgetType | undefined = undefined> = T extends DashboardWidgetType ? {
501
+ id: number;
502
+ widgets?: BaseDashboardWidgetPayload[];
503
+ } & DashboardWidgetTypeToParams[T] & BaseDashboardWidgetPayload<T> : {
504
+ id: number;
505
+ params: any;
506
+ widgets?: BaseDashboardWidgetPayload[];
507
+ } & BaseDashboardWidgetPayload<T>;
508
+
509
+ export declare type DashboardWidgetBlockCreatePayload = {
510
+ parent_id: number | string;
511
+ child_id: number;
512
+ position: number;
513
+ config?: WidgetBlockConfig;
514
+ };
515
+
475
516
  export declare type DashboardWidgetDataLoader<T> = T extends {
476
517
  type: infer Type;
477
518
  params: infer Params;
@@ -487,6 +528,21 @@ export declare enum DashboardWidgetType {
487
528
  DASHBOARD = "Dashboard"
488
529
  }
489
530
 
531
+ export declare type DashboardWidgetTypeToParams = {
532
+ [DashboardWidgetType.SECTIONCARD]: {
533
+ params: SectionCardProps;
534
+ };
535
+ [DashboardWidgetType.VALUECARD]: {
536
+ params: ValueCardProps;
537
+ };
538
+ [DashboardWidgetType.PATIENTLIST]: {
539
+ params: PatientListProps;
540
+ };
541
+ [DashboardWidgetType.DASHBOARD]: {
542
+ params: DashboardProps;
543
+ };
544
+ };
545
+
490
546
  export declare enum DataLoaderType {
491
547
  OUTCOMES = "outcomes"
492
548
  }
@@ -1722,8 +1778,6 @@ export declare interface SectionCardProps {
1722
1778
  icon: string;
1723
1779
  background?: string;
1724
1780
  titleBackground?: string;
1725
- title: I18nTextTranslation;
1726
- widgets: number[];
1727
1781
  }
1728
1782
 
1729
1783
  /**
@@ -2641,7 +2695,6 @@ declare class UserProfile extends BaseModel {
2641
2695
  declare type UserSettingValue = string | number | boolean | Record<string, string | number> | string[] | number[];
2642
2696
 
2643
2697
  export declare interface ValueCardProps {
2644
- title: I18nTextTranslation;
2645
2698
  icon: string;
2646
2699
  text: I18nTextTranslation;
2647
2700
  subtext?: I18nTextTranslation;
@@ -2651,6 +2704,10 @@ export declare interface ValueCardProps {
2651
2704
  dataLoader?: DashboardWidgetDataLoader<WidgetOutcomesDataLoader>;
2652
2705
  }
2653
2706
 
2707
+ export declare type WidgetBlockConfig = {
2708
+ size?: number | ColProps;
2709
+ };
2710
+
2654
2711
  export declare interface WidgetOutcomesDataLoader {
2655
2712
  type: DataLoaderType.OUTCOMES;
2656
2713
  params: OutcomesParams;
@@ -33,6 +33,15 @@
33
33
  "$ref": "#/definitions/ColProps"
34
34
  }
35
35
  ]
36
+ },
37
+ "library": {
38
+ "type": "boolean"
39
+ },
40
+ "widgetsBlocks": {
41
+ "type": "array",
42
+ "items": {
43
+ "$ref": "#/definitions/DashboardWidgetBlockCreatePayload"
44
+ }
36
45
  }
37
46
  },
38
47
  "required": ["params", "title", "type"]
@@ -66,6 +75,15 @@
66
75
  "$ref": "#/definitions/ColProps"
67
76
  }
68
77
  ]
78
+ },
79
+ "library": {
80
+ "type": "boolean"
81
+ },
82
+ "widgetsBlocks": {
83
+ "type": "array",
84
+ "items": {
85
+ "$ref": "#/definitions/DashboardWidgetBlockCreatePayload"
86
+ }
69
87
  }
70
88
  },
71
89
  "required": ["params", "title", "type"]
@@ -99,6 +117,15 @@
99
117
  "$ref": "#/definitions/ColProps"
100
118
  }
101
119
  ]
120
+ },
121
+ "library": {
122
+ "type": "boolean"
123
+ },
124
+ "widgetsBlocks": {
125
+ "type": "array",
126
+ "items": {
127
+ "$ref": "#/definitions/DashboardWidgetBlockCreatePayload"
128
+ }
102
129
  }
103
130
  },
104
131
  "required": ["params", "title", "type"]
@@ -132,6 +159,15 @@
132
159
  "$ref": "#/definitions/ColProps"
133
160
  }
134
161
  ]
162
+ },
163
+ "library": {
164
+ "type": "boolean"
165
+ },
166
+ "widgetsBlocks": {
167
+ "type": "array",
168
+ "items": {
169
+ "$ref": "#/definitions/DashboardWidgetBlockCreatePayload"
170
+ }
135
171
  }
136
172
  },
137
173
  "required": ["params", "title", "type"]
@@ -149,42 +185,11 @@
149
185
  },
150
186
  "titleBackground": {
151
187
  "type": "string"
152
- },
153
- "title": {
154
- "$ref": "#/definitions/I18nTextTranslation"
155
- },
156
- "widgets": {
157
- "type": "array",
158
- "items": {
159
- "type": "number"
160
- }
161
188
  }
162
189
  },
163
- "required": ["icon", "title", "widgets"],
190
+ "required": ["icon"],
164
191
  "additionalProperties": false
165
192
  },
166
- "I18nTextTranslation": {
167
- "anyOf": [
168
- {
169
- "$ref": "#/definitions/I18nTextLocales"
170
- },
171
- {
172
- "type": "string"
173
- }
174
- ]
175
- },
176
- "I18nTextLocales": {
177
- "type": "object",
178
- "properties": {
179
- "default": {
180
- "type": "string"
181
- }
182
- },
183
- "required": ["default"],
184
- "additionalProperties": {
185
- "type": "string"
186
- }
187
- },
188
193
  "ColProps": {
189
194
  "type": "object",
190
195
  "properties": {
@@ -317,12 +322,44 @@
317
322
  },
318
323
  "additionalProperties": false
319
324
  },
320
- "ValueCardProps": {
325
+ "DashboardWidgetBlockCreatePayload": {
321
326
  "type": "object",
322
327
  "properties": {
323
- "title": {
324
- "$ref": "#/definitions/I18nTextTranslation"
328
+ "parent_id": {
329
+ "type": ["number", "string"]
330
+ },
331
+ "child_id": {
332
+ "type": "number"
325
333
  },
334
+ "position": {
335
+ "type": "number"
336
+ },
337
+ "config": {
338
+ "$ref": "#/definitions/WidgetBlockConfig"
339
+ }
340
+ },
341
+ "required": ["parent_id", "child_id", "position"],
342
+ "additionalProperties": false
343
+ },
344
+ "WidgetBlockConfig": {
345
+ "type": "object",
346
+ "properties": {
347
+ "size": {
348
+ "anyOf": [
349
+ {
350
+ "type": "number"
351
+ },
352
+ {
353
+ "$ref": "#/definitions/ColProps"
354
+ }
355
+ ]
356
+ }
357
+ },
358
+ "additionalProperties": false
359
+ },
360
+ "ValueCardProps": {
361
+ "type": "object",
362
+ "properties": {
326
363
  "icon": {
327
364
  "type": "string"
328
365
  },
@@ -345,9 +382,31 @@
345
382
  "$ref": "#/definitions/DashboardWidgetDataLoader%3CWidgetOutcomesDataLoader%3E"
346
383
  }
347
384
  },
348
- "required": ["title", "icon", "text"],
385
+ "required": ["icon", "text"],
349
386
  "additionalProperties": false
350
387
  },
388
+ "I18nTextTranslation": {
389
+ "anyOf": [
390
+ {
391
+ "$ref": "#/definitions/I18nTextLocales"
392
+ },
393
+ {
394
+ "type": "string"
395
+ }
396
+ ]
397
+ },
398
+ "I18nTextLocales": {
399
+ "type": "object",
400
+ "properties": {
401
+ "default": {
402
+ "type": "string"
403
+ }
404
+ },
405
+ "required": ["default"],
406
+ "additionalProperties": {
407
+ "type": "string"
408
+ }
409
+ },
351
410
  "DashboardWidgetDataLoader<WidgetOutcomesDataLoader>": {
352
411
  "type": "object",
353
412
  "properties": {
@@ -563,21 +622,14 @@
563
622
  "DashboardProps": {
564
623
  "type": "object",
565
624
  "properties": {
566
- "title": {
567
- "type": "string"
568
- },
569
625
  "active": {
570
626
  "type": "boolean"
571
627
  },
572
628
  "config": {},
573
629
  "icon": {
574
630
  "type": ["string", "null"]
575
- },
576
- "weight": {
577
- "type": "number"
578
631
  }
579
632
  },
580
- "required": ["title"],
581
633
  "additionalProperties": false
582
634
  }
583
635
  }
@@ -24,6 +24,15 @@
24
24
  }
25
25
  ]
26
26
  },
27
+ "library": {
28
+ "type": "boolean"
29
+ },
30
+ "widgetsBlocks": {
31
+ "type": "array",
32
+ "items": {
33
+ "$ref": "#/definitions/DashboardWidgetBlockCreatePayload"
34
+ }
35
+ },
27
36
  "type": {
28
37
  "anyOf": [
29
38
  {
@@ -195,59 +204,60 @@
195
204
  },
196
205
  "additionalProperties": false
197
206
  },
198
- "SectionCardProps": {
207
+ "DashboardWidgetBlockCreatePayload": {
199
208
  "type": "object",
200
209
  "properties": {
201
- "icon": {
202
- "type": "string"
203
- },
204
- "background": {
205
- "type": "string"
210
+ "parent_id": {
211
+ "type": ["number", "string"]
206
212
  },
207
- "titleBackground": {
208
- "type": "string"
213
+ "child_id": {
214
+ "type": "number"
209
215
  },
210
- "title": {
211
- "$ref": "#/definitions/I18nTextTranslation"
216
+ "position": {
217
+ "type": "number"
212
218
  },
213
- "widgets": {
214
- "type": "array",
215
- "items": {
216
- "type": "number"
217
- }
219
+ "config": {
220
+ "$ref": "#/definitions/WidgetBlockConfig"
218
221
  }
219
222
  },
220
- "required": ["icon", "title", "widgets"],
223
+ "required": ["parent_id", "child_id", "position"],
221
224
  "additionalProperties": false
222
225
  },
223
- "I18nTextTranslation": {
224
- "anyOf": [
225
- {
226
- "$ref": "#/definitions/I18nTextLocales"
227
- },
228
- {
229
- "type": "string"
226
+ "WidgetBlockConfig": {
227
+ "type": "object",
228
+ "properties": {
229
+ "size": {
230
+ "anyOf": [
231
+ {
232
+ "type": "number"
233
+ },
234
+ {
235
+ "$ref": "#/definitions/ColProps"
236
+ }
237
+ ]
230
238
  }
231
- ]
239
+ },
240
+ "additionalProperties": false
232
241
  },
233
- "I18nTextLocales": {
242
+ "SectionCardProps": {
234
243
  "type": "object",
235
244
  "properties": {
236
- "default": {
245
+ "icon": {
246
+ "type": "string"
247
+ },
248
+ "background": {
249
+ "type": "string"
250
+ },
251
+ "titleBackground": {
237
252
  "type": "string"
238
253
  }
239
254
  },
240
- "required": ["default"],
241
- "additionalProperties": {
242
- "type": "string"
243
- }
255
+ "required": ["icon"],
256
+ "additionalProperties": false
244
257
  },
245
258
  "ValueCardProps": {
246
259
  "type": "object",
247
260
  "properties": {
248
- "title": {
249
- "$ref": "#/definitions/I18nTextTranslation"
250
- },
251
261
  "icon": {
252
262
  "type": "string"
253
263
  },
@@ -270,9 +280,31 @@
270
280
  "$ref": "#/definitions/DashboardWidgetDataLoader%3CWidgetOutcomesDataLoader%3E"
271
281
  }
272
282
  },
273
- "required": ["title", "icon", "text"],
283
+ "required": ["icon", "text"],
274
284
  "additionalProperties": false
275
285
  },
286
+ "I18nTextTranslation": {
287
+ "anyOf": [
288
+ {
289
+ "$ref": "#/definitions/I18nTextLocales"
290
+ },
291
+ {
292
+ "type": "string"
293
+ }
294
+ ]
295
+ },
296
+ "I18nTextLocales": {
297
+ "type": "object",
298
+ "properties": {
299
+ "default": {
300
+ "type": "string"
301
+ }
302
+ },
303
+ "required": ["default"],
304
+ "additionalProperties": {
305
+ "type": "string"
306
+ }
307
+ },
276
308
  "DashboardWidgetDataLoader<WidgetOutcomesDataLoader>": {
277
309
  "type": "object",
278
310
  "properties": {
@@ -488,21 +520,14 @@
488
520
  "DashboardProps": {
489
521
  "type": "object",
490
522
  "properties": {
491
- "title": {
492
- "type": "string"
493
- },
494
523
  "active": {
495
524
  "type": "boolean"
496
525
  },
497
526
  "config": {},
498
527
  "icon": {
499
528
  "type": ["string", "null"]
500
- },
501
- "weight": {
502
- "type": "number"
503
529
  }
504
530
  },
505
- "required": ["title"],
506
531
  "additionalProperties": false
507
532
  }
508
533
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@persei/perseed-api",
3
- "version": "4.34.17",
3
+ "version": "4.34.18",
4
4
  "private": false,
5
5
  "main": "./dist/perseed-api.umd.js",
6
6
  "module": "./dist/perseed-api.mjs",
@@ -9,7 +9,7 @@
9
9
  "dist"
10
10
  ],
11
11
  "scripts": {
12
- "publish_package": "npm run precommit && npm run build && npm publish",
12
+ "_prepare": "npm run precommit && npm run build",
13
13
  "build": "tsc --noEmit && vite build",
14
14
  "start": "ts-node src/server.ts",
15
15
  "lint": "npm run test:lint",