@persei/perseed-api 5.0.27 → 5.0.29

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 (73) hide show
  1. package/dist/ecosystem-alert.cjs +229 -0
  2. package/dist/ecosystem-alert.cjs.map +1 -0
  3. package/dist/ecosystem-alert.d.ts +1 -0
  4. package/dist/ecosystem-alert.mjs +229 -0
  5. package/dist/ecosystem-alert.mjs.map +1 -0
  6. package/dist/ecosystem-process-log.cjs.map +1 -1
  7. package/dist/ecosystem-process-log.mjs.map +1 -1
  8. package/dist/src/Services/AiService.d.ts.map +1 -1
  9. package/dist/src/Services/FileService.d.ts +1 -1
  10. package/dist/src/Services/FileService.d.ts.map +1 -1
  11. package/dist/src/app.d.ts.map +1 -1
  12. package/dist/src/controllers/IntrospectionController.d.ts +10 -1
  13. package/dist/src/controllers/IntrospectionController.d.ts.map +1 -1
  14. package/dist/src/schemas/container_widget/widgetTypes/PatientListProps.d.ts +20 -0
  15. package/dist/src/schemas/container_widget/widgetTypes/PatientListProps.d.ts.map +1 -1
  16. package/dist/src/test/test-helpers.d.ts.map +1 -1
  17. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts +22 -4
  18. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts.map +1 -1
  19. package/dist/src/v2/modules/ecosystem/action-system/action-system.schema.d.ts +14 -14
  20. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.d.ts +4 -4
  21. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.d.ts +5 -0
  22. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.d.ts.map +1 -1
  23. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.d.ts +4 -4
  24. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts +9 -2
  25. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts.map +1 -1
  26. package/dist/src/v2/modules/ecosystem/alert/alert.helper.d.ts +16 -0
  27. package/dist/src/v2/modules/ecosystem/alert/alert.helper.d.ts.map +1 -1
  28. package/dist/src/v2/modules/ecosystem/alert/alert.model.d.ts +42 -0
  29. package/dist/src/v2/modules/ecosystem/alert/alert.model.d.ts.map +1 -1
  30. package/dist/src/v2/modules/ecosystem/alert/alert.schema.d.ts.map +1 -1
  31. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.d.ts +52 -0
  32. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.d.ts.map +1 -0
  33. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.test.d.ts +2 -0
  34. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.test.d.ts.map +1 -0
  35. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.d.ts +36 -0
  36. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.d.ts.map +1 -0
  37. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.test.d.ts +2 -0
  38. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.test.d.ts.map +1 -0
  39. package/dist/src/v2/modules/ecosystem/alert/{alert.service.d.ts → alert.service/alert.service.d.ts} +5 -5
  40. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert.service.d.ts.map +1 -0
  41. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert.service.test.d.ts.map +1 -0
  42. package/dist/src/v2/modules/ecosystem/alert/alert.service/index.d.ts +5 -0
  43. package/dist/src/v2/modules/ecosystem/alert/alert.service/index.d.ts.map +1 -0
  44. package/dist/src/v2/modules/ecosystem/alert/index.d.ts +3 -2
  45. package/dist/src/v2/modules/ecosystem/alert/index.d.ts.map +1 -1
  46. package/dist/src/v2/modules/ecosystem/alert/lib.d.ts +2 -0
  47. package/dist/src/v2/modules/ecosystem/alert/lib.d.ts.map +1 -0
  48. package/dist/src/v2/modules/ecosystem/process-log/process-log.schema.d.ts.map +1 -1
  49. package/dist/src/v2/modules/project/forms-data/forms-data.helper.d.ts +52 -1
  50. package/dist/src/v2/modules/project/forms-data/forms-data.helper.d.ts.map +1 -1
  51. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.d.ts +64 -0
  52. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.d.ts.map +1 -0
  53. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.test.d.ts +2 -0
  54. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.test.d.ts.map +1 -0
  55. package/dist/src/v2/modules/project/forms-data/forms-data.service/forms-data.service.d.ts +22 -0
  56. package/dist/src/v2/modules/project/forms-data/forms-data.service/forms-data.service.d.ts.map +1 -0
  57. package/dist/src/v2/modules/project/forms-data/forms-data.service/forms-data.service.test.d.ts.map +1 -0
  58. package/dist/src/v2/modules/project/forms-data/forms-data.service/index.d.ts +4 -0
  59. package/dist/src/v2/modules/project/forms-data/forms-data.service/index.d.ts.map +1 -0
  60. package/dist/src/v2/modules/project/forms-data/index.d.ts +1 -0
  61. package/dist/src/v2/modules/project/forms-data/index.d.ts.map +1 -1
  62. package/dist/v1/perseed-api.cjs +9 -0
  63. package/dist/v1/perseed-api.cjs.map +1 -1
  64. package/dist/v1/perseed-api.mjs +9 -0
  65. package/dist/v1/perseed-api.mjs.map +1 -1
  66. package/package.json +1 -1
  67. package/dist/src/v2/modules/ecosystem/alert/alert.service.d.ts.map +0 -1
  68. package/dist/src/v2/modules/ecosystem/alert/alert.service.test.d.ts.map +0 -1
  69. package/dist/src/v2/modules/project/forms-data/forms-data.service.d.ts +0 -12
  70. package/dist/src/v2/modules/project/forms-data/forms-data.service.d.ts.map +0 -1
  71. package/dist/src/v2/modules/project/forms-data/forms-data.service.test.d.ts.map +0 -1
  72. /package/dist/src/v2/modules/ecosystem/alert/{alert.service.test.d.ts → alert.service/alert.service.test.d.ts} +0 -0
  73. /package/dist/src/v2/modules/project/forms-data/{forms-data.service.test.d.ts → forms-data.service/forms-data.service.test.d.ts} +0 -0
@@ -42,8 +42,8 @@ declare function listManualTriggers(ctx: RequestContext, pagination: PaginatedQu
42
42
  actions?: {
43
43
  name?: string | null | undefined;
44
44
  project_id?: number | null | undefined;
45
- retention_days?: number | null | undefined;
46
45
  library?: boolean | undefined;
46
+ retention_days?: number | null | undefined;
47
47
  id: number;
48
48
  type: "ApiAction";
49
49
  config: {
@@ -97,8 +97,8 @@ declare function getManualTriggerById(ctx: RequestContext, id: number, includeAc
97
97
  actions?: {
98
98
  name?: string | null | undefined;
99
99
  project_id?: number | null | undefined;
100
- retention_days?: number | null | undefined;
101
100
  library?: boolean | undefined;
101
+ retention_days?: number | null | undefined;
102
102
  id: number;
103
103
  type: "ApiAction";
104
104
  config: {
@@ -115,8 +115,8 @@ declare function createManualTrigger(ctx: RequestContext, data: CreateManualTrig
115
115
  actions: {
116
116
  name?: string | null | undefined;
117
117
  project_id?: number | null | undefined;
118
- retention_days?: number | null | undefined;
119
118
  library?: boolean | undefined;
119
+ retention_days?: number | null | undefined;
120
120
  id: number;
121
121
  type: "ApiAction";
122
122
  config: {
@@ -147,8 +147,8 @@ declare function updateManualTrigger(ctx: RequestContext, id: number, data: Upda
147
147
  actions: {
148
148
  name?: string | null | undefined;
149
149
  project_id?: number | null | undefined;
150
- retention_days?: number | null | undefined;
151
150
  library?: boolean | undefined;
151
+ retention_days?: number | null | undefined;
152
152
  id: number;
153
153
  type: "ApiAction";
154
154
  config: {
@@ -1,6 +1,7 @@
1
1
  import { default as RequestContext } from '../../../../../models/request/RequestContext';
2
2
  import { ApiActionContextData } from '../../../../../schemas/api_action/ApiActionTypes';
3
3
  import { EvaluableTrigger, TriggerBatch, TriggerExecutionResult, TriggerRelations, TriggerSource } from '../action-system.schema';
4
+ import { PatientCache } from '../action-system.helper';
4
5
  /**
5
6
  * Assembles the context that conditions and action payloads are evaluated
6
7
  * against: the trigger's declared relations are loaded onto `current` ONCE,
@@ -15,8 +16,12 @@ import { EvaluableTrigger, TriggerBatch, TriggerExecutionResult, TriggerRelation
15
16
  * they are — a doctor, someone of a given clinic — and not only what the entity holds.
16
17
  * It is part of the one context, not a second one: the conditions and the templates of
17
18
  * an action read the same object, so neither can ever see data the other does not.
19
+ *
20
+ * `patientCache` is passed on to `loadRelations` so a batch resolves the patient of its
21
+ * entity once instead of once per trigger. It is optional: a caller that builds a single
22
+ * context has nothing to share and omits it.
18
23
  */
19
- export declare function buildTriggerContext(ctx: RequestContext, source: TriggerSource, target: string | null | undefined, current: Record<string, unknown>, old: Record<string, unknown> | null, relations?: TriggerRelations | null): Promise<{
24
+ export declare function buildTriggerContext(ctx: RequestContext, source: TriggerSource, target: string | null | undefined, current: Record<string, unknown>, old: Record<string, unknown> | null, relations?: TriggerRelations | null, patientCache?: PatientCache): Promise<{
20
25
  context: ApiActionContextData;
21
26
  relationsSkipped?: string;
22
27
  }>;
@@ -63,7 +68,9 @@ export declare function executeTriggerActions(ctx: RequestContext, trigger: Eval
63
68
  * of the batch.
64
69
  *
65
70
  * `now` is threaded through the whole batch rather than read again per row, so
66
- * every `expires_at` it computes shares a single timestamp.
71
+ * every `expires_at` it computes shares a single timestamp. The patient cache is
72
+ * threaded for the same reason: every trigger here evaluates against the same
73
+ * `batch.current`, so its patient is worth resolving once and not once per trigger.
67
74
  */
68
75
  export declare function runTriggerBatch(ctx: RequestContext, batch: TriggerBatch, now: Date): Promise<TriggerExecutionResult[]>;
69
76
  export declare const TriggerEngineService: {
@@ -1 +1 @@
1
- {"version":3,"file":"trigger-engine.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAQ9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAGjF,OAAO,EAKL,KAA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AI,GACR,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAmEnC;AAED,eAAO,MAAM,oBAAoB;;;;;CAKhC,CAAA"}
1
+ {"version":3,"file":"trigger-engine.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAQ9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAGjF,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,yBAAyB,CAAA;AAEhC,OAAO,EAQL,KAAK,YAAY,EAClB,MAAM,yBAAyB,CAAA;AAahC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACnC,SAAS,CAAC,EAAE,gBAAgB,GAAG,IAAI,EACnC,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC;IAAE,OAAO,EAAE,oBAAoB,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAavE;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,GAAG,YAAY,CAAC,GACnD,OAAO,CAAC,OAAO,CAAC,CAIlB;AA0ED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;;;;GAKG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,oBAAoB,EAC7B,GAAG,EAAE,IAAI,EACT,WAAW,EAAE,yBAAyB,GACrC,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,CAqDhF;AAID;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,cAAc,EACnB,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,IAAI,GACR,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAqEnC;AAED,eAAO,MAAM,oBAAoB;;;;;CAKhC,CAAA"}
@@ -1,4 +1,6 @@
1
+ import { QueryBuilder } from 'objection';
1
2
  import { default as RequestContext } from '../../../../models/request/RequestContext';
3
+ import { Alert } from './alert.model';
2
4
  /**
3
5
  * Permission preHandler of the write endpoints of this module (create, update, resolve). Reads go
4
6
  * through `resolveAlertReadScope` instead, which narrows what is returned rather than refusing.
@@ -52,4 +54,18 @@ export interface AlertReadScope {
52
54
  * query that enforces it (`alert.service.ts`), so each can be tested without the other.
53
55
  */
54
56
  export declare function resolveAlertReadScope(ctx: RequestContext): Promise<AlertReadScope | null>;
57
+ /**
58
+ * The scoped base query every reader starts from: the alerts the request reaches, narrowed to what
59
+ * `scope` allows and to nothing else.
60
+ *
61
+ * It exists so no reader — the endpoints of this module, a listing whose axis is `alert` — has to
62
+ * restate the two narrowings, which are the security boundary of this table: `scopeToRequest` keeps
63
+ * a project from reading another project's alerts (they share the ecosystem database), and
64
+ * `applyReadScope` keeps a caller without `alerts_management` from reading alerts they are not
65
+ * party to. Both are module-private on purpose; this is the single supported way to reuse them.
66
+ *
67
+ * The caller adds its own clauses on top. Because both narrowings are already applied — and the
68
+ * scope one as a grouped `OR` — anything the caller adds can only narrow the result further.
69
+ */
70
+ export declare function scopedQuery(ctx: RequestContext, scope: AlertReadScope | null): QueryBuilder<Alert, Alert[]>;
55
71
  //# sourceMappingURL=alert.helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert.helper.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/alert/alert.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAA;AAKnE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB,0DAGnC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB;AAsBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAO/F"}
1
+ {"version":3,"file":"alert.helper.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/alert/alert.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAA;AAInE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB,0DAGnC,CAAA;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,SAAS,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB;AAsBD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAO/F;AAyCD;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,GAAG,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAI3G"}
@@ -1,7 +1,11 @@
1
1
  import { default as Objection } from 'objection';
2
2
  import { default as BaseModel } from '../../../../models/BaseModel';
3
3
  import { default as RequestContext } from '../../../../models/request/RequestContext';
4
+ import { default as User } from '../../../../models/ecosystem/User';
5
+ import { default as Project } from '../../../../models/ecosystem/Project';
6
+ import { default as UserPatient } from '../../../../models/ecosystem/UserPatient';
4
7
  import { TypedQueryBuilder } from '../../global/objection';
8
+ import { AlertType } from '../alert-type';
5
9
  import { AlertData, AlertEmitterData, AlertEntityRefData, AlertSeverity, AlertStatus } from './alert.schema';
6
10
  /**
7
11
  * What the write methods accept, which is not quite a row.
@@ -39,9 +43,47 @@ export declare class Alert extends BaseModel implements AlertData {
39
43
  created_user?: number | null;
40
44
  created_at?: string;
41
45
  mod_time?: string;
46
+ user?: User | null;
47
+ alert_type?: AlertType | null;
48
+ project?: Project | null;
49
+ user_patients?: UserPatient[];
42
50
  static tableName: string;
43
51
  static jsonAttributes: string[];
44
52
  static jsonSchema: Objection.JSONSchema;
53
+ static get relationMappings(): {
54
+ user: {
55
+ relation: Objection.RelationType;
56
+ modelClass: typeof User;
57
+ join: {
58
+ from: string;
59
+ to: string;
60
+ };
61
+ };
62
+ alert_type: {
63
+ relation: Objection.RelationType;
64
+ modelClass: typeof AlertType;
65
+ join: {
66
+ from: string;
67
+ to: string;
68
+ };
69
+ };
70
+ project: {
71
+ relation: Objection.RelationType;
72
+ modelClass: typeof Project;
73
+ join: {
74
+ from: string;
75
+ to: string;
76
+ };
77
+ };
78
+ user_patients: {
79
+ relation: Objection.RelationType;
80
+ modelClass: typeof UserPatient;
81
+ join: {
82
+ from: string;
83
+ to: string;
84
+ };
85
+ };
86
+ };
45
87
  static QueryBuilder: typeof Objection.QueryBuilder;
46
88
  static query(): TypedQueryBuilder<Alert, typeof Alert, never>;
47
89
  static getModel(ctx: RequestContext): typeof Alert;
@@ -1 +1 @@
1
- {"version":3,"file":"alert.model.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/alert/alert.model.ts"],"names":[],"mappings":"AAAA,OAAO,SAA2B,MAAM,WAAW,CAAA;AACnD,OAAO,SAAS,MAAM,sBAAsB,CAAA;AAC5C,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAI9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAG9D,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAA;AAUvB;;;;;;;;GAQG;AACH,KAAK,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC,GAAG;IAChF,YAAY,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;CACpC,CAAA;AASD,qBAAa,KAAM,SAAQ,SAAU,YAAW,SAAS;IACvD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,QAAQ,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC/B,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,OAAO,EAAG,gBAAgB,CAAA;IAC1B,UAAU,CAAC,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAA;IACxC,gBAAgB,CAAC,EAAE,kBAAkB,EAAE,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B,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAUhE,eAAO,MAAM,oBAAoB;;;EAUhC,CAAA;AACD,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAIpE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2GvB,CAAA;AACD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,WAAW,CAAC,CAAA;AAQlD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;EAwB7B,CAAA;AAKD,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAEpE;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAQrE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;EAI5B,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAOpE,eAAO,MAAM,kBAAkB;;EAO9B,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAIhE,eAAO,MAAM,oBAAoB;;;;;;EAShC,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
@@ -0,0 +1,52 @@
1
+ import { default as RequestContext } from '../../../../../models/request/RequestContext';
2
+ import { ContainerWidget, FormListDataConfig, WidgetType } from '../../../../../schemas';
3
+ import { PaginatedQuery } from '../../../global/pagination';
4
+ import { AssociatedSources } from '../../../project/forms-data';
5
+ interface AlertListingInput {
6
+ widget: ContainerWidget<WidgetType.FORMS_LIST>;
7
+ projectId: number;
8
+ mainFormKey: string;
9
+ config: FormListDataConfig;
10
+ /** Loaded for the patient of each alert: forms of the project and `health_data_*`. */
11
+ associatedSources: AssociatedSources;
12
+ /** Configured alongside the axis but not loadable by patient (platform tables): logged and left out. */
13
+ ignoredSourceKeys: string[];
14
+ paramValues: Record<string, unknown>;
15
+ pagination: PaginatedQuery;
16
+ }
17
+ /**
18
+ * Serves a listing whose rows are alerts.
19
+ *
20
+ * It is a path of its own rather than a branch of the crf one, because from the moment the axis is
21
+ * resolved the two share nothing: that one builds a displayer model over the project pool, keys its
22
+ * rows by patient and pages through `FormService`. Here the axis is a table of the **ecosystem**
23
+ * database, a row is an alert, and paging is the ordinary `paginateQuery` — the same shape
24
+ * `ProcessLogService.list` already uses over that pool.
25
+ *
26
+ * **No query crosses a database.** The axis, its relations and the conditions over them all live in
27
+ * the ecosystem database and compile into one query there. The associated sources come afterwards,
28
+ * in queries of their own over the project database, keyed by the `patient_id` of the alerts of the
29
+ * page — the same way the crf axis loads them for the patient of each of its rows.
30
+ *
31
+ * **Associated sources fill a row, they never narrow the listing.** An alert without a patient, or
32
+ * with one its reader cannot see in the project, keeps its row with those sources empty. Their own
33
+ * conditions narrow what they load, as on the crf axis.
34
+ *
35
+ * **The whole row travels.** Every column of `alert` is returned, JSON ones included: what a client
36
+ * does with a document in a table cell is the client's to decide, and withholding columns here
37
+ * would only make the listing lie about what an alert is.
38
+ *
39
+ * Rows come out flat, keyed `<sourceKey>.<column>`, which is the shape the listing's table already
40
+ * paints for a crf axis — so the front needs no change to render this.
41
+ */
42
+ declare function get(ctx: RequestContext, input: AlertListingInput): Promise<{
43
+ results: any[];
44
+ total: number;
45
+ }>;
46
+ /** Whether a listing configuration puts `alert` at the axis. */
47
+ export declare function isAlertAxis(mainFormBaseName: string): boolean;
48
+ export declare const AlertListingService: {
49
+ get: typeof get;
50
+ };
51
+ export {};
52
+ //# sourceMappingURL=alert-listing.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-listing.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAI9D,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAU,UAAU,EAAE,MAAM,aAAa,CAAA;AAC1F,OAAO,EAAE,cAAc,EAAiB,MAAM,6BAA6B,CAAA;AAE3E,OAAO,EACL,iBAAiB,EAIlB,MAAM,8BAA8B,CAAA;AAgErC,UAAU,iBAAiB;IACzB,MAAM,EAAE,eAAe,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;IAC9C,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,kBAAkB,CAAA;IAC1B,sFAAsF;IACtF,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,wGAAwG;IACxG,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,UAAU,EAAE,cAAc,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,iBAAe,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB;;;GA+E/D;AAED,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED,eAAO,MAAM,mBAAmB;;CAE/B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=alert-listing.service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-listing.service.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,36 @@
1
+ import { default as RequestContext } from '../../../../../models/request/RequestContext';
2
+ import { FormListDataConfig } from '../../../../../schemas';
3
+ /** One alert of a patient, in the shape the listing merges a repeatable source from. */
4
+ export interface AlertPatientRow {
5
+ patient_id: number;
6
+ data: {
7
+ form: {
8
+ name: string;
9
+ isMultiple: () => true;
10
+ };
11
+ };
12
+ values: Record<string, unknown>;
13
+ }
14
+ /**
15
+ * The alerts of a set of patients, as the rows of a repeatable source associated to a listing.
16
+ *
17
+ * It is the counterpart of `HealthDataService.getDataForPatients` for alerts: the listing asks for
18
+ * the patients of its page, and each alert becomes a row merged into the one of its patient — which
19
+ * is what lets a column count, or otherwise aggregate, the alerts of each patient.
20
+ *
21
+ * **Only the alerts the caller may read.** The query starts from `scopedQuery`, so it is narrowed to
22
+ * the project of the request and to the read scope of the caller before anything the configuration
23
+ * asks for: a user without `alerts_management` counts only the alerts they could open.
24
+ *
25
+ * The configuration of the source card applies as it does to a form associated to a listing: its
26
+ * conditions narrow which alerts are loaded, `sortBy` orders them and `limit` caps them **per
27
+ * patient**. The conditions name the columns of `alert` unprefixed, as the card builds them.
28
+ *
29
+ * Every column of the alert travels, keyed `<sourceKey>.<column>`, the same as on the alert axis.
30
+ */
31
+ declare function getDataForPatients(ctx: RequestContext, patientIds: number[], key: string, config: FormListDataConfig, paramValues: Record<string, unknown>): Promise<AlertPatientRow[]>;
32
+ export declare const AlertPatientDataService: {
33
+ getDataForPatients: typeof getDataForPatients;
34
+ };
35
+ export {};
36
+ //# sourceMappingURL=alert-patient-data.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-patient-data.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.ts"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAU,MAAM,aAAa,CAAA;AAM7D,wFAAwF;AACxF,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE;QAAE,IAAI,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,IAAI,CAAA;SAAE,CAAA;KAAE,CAAA;IACxD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC;AAKD;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAe,kBAAkB,CAC/B,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,MAAM,EAAE,EACpB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,kBAAkB,EAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,eAAe,EAAE,CAAC,CAsC5B;AAED,eAAO,MAAM,uBAAuB;;CAEnC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=alert-patient-data.service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-patient-data.service.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.test.ts"],"names":[],"mappings":""}
@@ -1,8 +1,8 @@
1
- import { default as RequestContext } from '../../../../models/request/RequestContext';
2
- import { PaginatedQuery } from '../../global/pagination';
3
- import { AlertReadScope } from './alert.helper';
4
- import { Alert } from './alert.model';
5
- import { CreateAlertData, ListAlertQuery, UpdateAlertData } from './alert.schema';
1
+ import { default as RequestContext } from '../../../../../models/request/RequestContext';
2
+ import { PaginatedQuery } from '../../../global/pagination';
3
+ import { AlertReadScope } from '../alert.helper';
4
+ import { Alert } from '../alert.model';
5
+ import { CreateAlertData, ListAlertQuery, UpdateAlertData } from '../alert.schema';
6
6
  /**
7
7
  * Lists the alerts the request reaches, newest first, narrowed by the optional filters.
8
8
  *
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/alert.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAA;AAKnE,OAAO,EAAE,cAAc,EAAiB,MAAM,6BAA6B,CAAA;AAE3E,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,iBAAiB,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAe,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAE9G;;;;;GAKG;AACH,iBAAe,UAAU,CACvB,GAAG,EAAE,cAAc,EACnB,UAAU,EAAE,cAAc,EAC1B,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,cAAc,GAAG,IAAI,4CAa7B;AAED;;;;;;GAMG;AACH,iBAAe,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,8BAExF;AA+DD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,iBAAe,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,eAAe,kBAkBpE;AA2FD,iBAAe,WAAW,CAAC,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,kBAahF;AAED;;;;;;;GAOG;AACH,iBAAe,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,kBAyB1F;AAED,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert.service.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/alert.service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export { AlertService } from './alert.service';
2
+ export { AlertListingService, isAlertAxis } from './alert-listing.service';
3
+ export { AlertPatientDataService } from './alert-patient-data.service';
4
+ export type { AlertPatientRow } from './alert-patient-data.service';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA"}
@@ -1,7 +1,8 @@
1
- export { AlertService } from './alert.service';
1
+ export { AlertService, AlertListingService, AlertPatientDataService, isAlertAxis } from './alert.service';
2
+ export type { AlertPatientRow } from './alert.service';
2
3
  export { Alert } from './alert.model';
3
4
  export { AlertController } from './alert.controller';
4
- export { requireAlertsManagement } from './alert.helper';
5
+ export { requireAlertsManagement, resolveAlertReadScope, scopedQuery } from './alert.helper';
5
6
  export { AlertStatus, AlertSeverity, AlertEmitterType } from './alert.schema';
6
7
  export type { AlertData, AlertEmitterData, AlertEntityRefData, CreateAlertData, CreateAlertRequestBody, UpdateAlertData, } from './alert.schema';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC7E,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,eAAe,GAChB,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACzG,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5F,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC7E,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,eAAe,GAChB,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './alert.schema';
2
+ //# sourceMappingURL=lib.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/alert/lib.ts"],"names":[],"mappings":"AAEA,cAAc,gBAAgB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"process-log.schema.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/process-log/process-log.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA8BpD,eAAO,MAAM,cAAc;;;;;CAKjB,CAAA;AACV,eAAO,MAAM,oBAAoB,iCAG/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAchE,eAAO,MAAM,cAAc;;;;;;;CAUjB,CAAA;AACV,eAAO,MAAM,oBAAoB,+IAG/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAOhE,eAAO,MAAM,gCAAgC;;;;;;;;EAgC5C,CAAA;AACD,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAExF,eAAO,MAAM,2BAA2B;;EAGvC,CAAA;AACD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAE9E,eAAO,MAAM,4BAA4B;;;;;;;;;;;EAwBxC,CAAA;AACD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAKhF,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAalD,CAAA;AACD,MAAM,MAAM,gCAAgC,GAAG,MAAM,CAAC,OAAO,sCAAsC,CAAC,CAAA;AAOpG,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAiE5B,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAM5D,eAAO,MAAM,yBAAyB;;;;;;;;;;EA2BrC,CAAA;AAID,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
1
+ {"version":3,"file":"process-log.schema.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/process-log/process-log.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AA+BpD,eAAO,MAAM,cAAc;;;;;CAKjB,CAAA;AACV,eAAO,MAAM,oBAAoB,iCAG/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAchE,eAAO,MAAM,cAAc;;;;;;;CAUjB,CAAA;AACV,eAAO,MAAM,oBAAoB,+IAG/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAOhE,eAAO,MAAM,gCAAgC;;;;;;;;EAgC5C,CAAA;AACD,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAExF,eAAO,MAAM,2BAA2B;;EAGvC,CAAA;AACD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAE9E,eAAO,MAAM,4BAA4B;;;;;;;;;;;EAwBxC,CAAA;AACD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAKhF,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAalD,CAAA;AACD,MAAM,MAAM,gCAAgC,GAAG,MAAM,CAAC,OAAO,sCAAsC,CAAC,CAAA;AAOpG,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAiE5B,CAAA;AACD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAM5D,eAAO,MAAM,yBAAyB;;;;;;;;;;EA2BrC,CAAA;AAID,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
@@ -9,8 +9,59 @@ interface SqlCompiler<Q> {
9
9
  interface FilterableConfig {
10
10
  filterParams?: FilterParamsBlock[];
11
11
  }
12
+ /**
13
+ * The base name of a datasource configuration key: a source added more than once gets an instance
14
+ * suffix (`health_data_discrete-1`), which names the same table.
15
+ */
16
+ export declare function getCrfBaseName(key: string): string;
17
+ /**
18
+ * The sources a JsonLogic node names directly — not counting the ones its children name.
19
+ *
20
+ * Three shapes carry one, and they are the same three `extractFormNamesFromConditions` reads to
21
+ * build the join list. **The two have to agree exactly**, or a source would be pruned from the tree
22
+ * while still being joined, or the reverse: the join list is derived from the pruned tree, so a
23
+ * name this function misses is a name that survives into it.
24
+ *
25
+ * It returns every source a node names, not the first: a `ConditionExpression` node carries one key
26
+ * per condition (`{"patient.a": …, "alert.b": …}`), and stopping at the first would leave the rest
27
+ * in a tree that the join list still reads them from.
28
+ */
29
+ export declare function sourcesNamedBy(node: Record<string, unknown>): string[];
30
+ /**
31
+ * Extracts the source names referenced in conditions, to build the query's join list — the crf
32
+ * forms joined to a crf axis, or the relations joined to an alert one.
33
+ *
34
+ * Which node shapes name a form is `sourcesNamedBy`'s to decide, and deliberately not restated
35
+ * here: the pruning of unfilterable sources reads the same answer, and this walks the tree that
36
+ * pruning produced. A shape one of the two recognised and the other did not would put a source in
37
+ * the join list that the tree no longer constrains on, or the reverse — which is exactly what
38
+ * happened while this was written twice.
39
+ *
40
+ * This one recurses; `sourcesNamedBy` answers for a single node.
41
+ */
42
+ export declare function extractFormNamesFromConditions(conditions: unknown): Set<string>;
12
43
  export declare function validateRequiredFilterParams(configByKey: Record<string, FilterableConfig | undefined>, paramValues: Record<string, unknown>): void;
13
- export declare function getAppliedRuleTrees(conditions: Record<string, unknown> | undefined, configByKey: Record<string, FilterableConfig | undefined>, paramValues: Record<string, unknown>): Record<string, unknown>[];
44
+ /**
45
+ * Options of `getAppliedRuleTrees`.
46
+ *
47
+ * `isFilterable` decides which sources a condition may constrain on (see
48
+ * `pruneUnfilterableSources`). Omitted, every source is filterable and the trees come back as they
49
+ * were — the shape the callers that compile a single relation's own filter need, where the tree is
50
+ * already scoped to one source.
51
+ */
52
+ interface AppliedRuleTreesOptions {
53
+ isFilterable?: (source: string) => boolean;
54
+ onDroppedSources?: (sources: string[]) => void;
55
+ }
56
+ export declare function getAppliedRuleTrees(conditions: Record<string, unknown> | undefined, configByKey: Record<string, FilterableConfig | undefined>, paramValues: Record<string, unknown>, options?: AppliedRuleTreesOptions): Record<string, unknown>[];
57
+ /**
58
+ * Compiles a source's own conditions onto the query of that source.
59
+ *
60
+ * Takes no pruning options, and does not need them: its only caller is `filterRelationsDataV2`,
61
+ * which is handed a crf already resolved from the database, so the tree cannot name a source the
62
+ * query is unable to filter by. The listing's main form is the one that needs the pruning, and it
63
+ * compiles the trees `getAppliedRuleTrees` returns directly.
64
+ */
14
65
  export declare function applyConditionsAndFilterParams<Q>(query: Q, conditions: Record<string, unknown> | undefined, configByKey: Record<string, FilterableConfig | undefined>, paramValues: Record<string, unknown>, compiler: SqlCompiler<Q>): void;
15
66
  export declare function deriveFinalParams(data: Record<string, FormListDataConfig> | undefined, designers: Record<string, any> | null | undefined): FinalParam[];
16
67
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"forms-data.helper.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/project/forms-data/forms-data.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAkB,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAQpG,qBAAa,2BAA4B,SAAQ,KAAK;IACjC,aAAa,EAAE,MAAM,EAAE;gBAAvB,aAAa,EAAE,MAAM,EAAE;CAI3C;AAED,UAAU,WAAW,CAAC,CAAC;IACrB,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CACxD;AAqBD,UAAU,gBAAgB;IACxB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAA;CACnC;AA+GD,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,EACzD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,IAAI,CA6BN;AA8DD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,EACzD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAmC3B;AAED,wBAAgB,8BAA8B,CAAC,CAAC,EAC9C,KAAK,EAAE,CAAC,EACR,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC/C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC,EACzD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GACvB,IAAI,CAKN;AA0HD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,SAAS,EACpD,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS,GAChD,UAAU,EAAE,CAwCd"}
1
+ {"version":3,"file":"forms-data.helper.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/project/forms-data/forms-data.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAkB,kBAAkB,EAAE,MAAM,aAAa,CAAA;AASpG,qBAAa,2BAA4B,SAAQ,KAAK;IACjC,aAAa,EAAE,MAAM,EAAE;gBAAvB,aAAa,EAAE,MAAM,EAAE;CAI3C;AAED,UAAU,WAAW,CAAC,CAAC;IACrB,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CACxD;AAqBD,UAAU,gBAAgB;IACxB,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAA;CACnC;AA8FD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,UAGzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAgCtE;AAED;;;;;;;;;;;GAWG;AACH,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AChD,UAAU,EAAE,CAwCd"}
@@ -0,0 +1,64 @@
1
+ import { default as RequestContext } from '../../../../../models/request/RequestContext';
2
+ import { default as FormService } from '../../../../../Services/FormService';
3
+ import { FormListDataConfig } from '../../../../../schemas';
4
+ type PatientsDataResponse = Awaited<ReturnType<typeof FormService.formsData>>[number];
5
+ /**
6
+ * The sources a listing loads for the patient of each of its rows, split by how they are fetched.
7
+ *
8
+ * - `sqlConfigMap`: forms of the project, read through `FormService`.
9
+ * - `externalConfigMap`: sources read outside `FormService`, one service each — `health_data_*`
10
+ * from the external service, and `alert` from the ecosystem database (`isPatientLoadedSource`).
11
+ */
12
+ export interface AssociatedSources {
13
+ sqlConfigMap: Record<string, FormListDataConfig>;
14
+ externalConfigMap: Record<string, FormListDataConfig>;
15
+ }
16
+ /**
17
+ * Whether a source is loaded for the patients of a listing by a service of its own, outside
18
+ * `FormService`: `health_data_*` and, when it is not the main source, `alert`.
19
+ */
20
+ export declare function isPatientLoadedSource(key: string): boolean;
21
+ /** Whether there is anything to load at all, so a listing without associated sources skips the queries. */
22
+ export declare function hasAssociatedSources({ sqlConfigMap, externalConfigMap }: AssociatedSources): boolean;
23
+ /**
24
+ * The fields `FormService` loads for a set of SQL-backed sources: every configured field of each,
25
+ * plus its `id`, which merging and aggregations like COUNT rely on.
26
+ */
27
+ export declare function collectFields(sqlConfigMap: Record<string, FormListDataConfig>): {
28
+ crfName: string;
29
+ field: string;
30
+ }[];
31
+ /**
32
+ * Reads every source loaded outside `FormService` for a set of patients, each from its own service,
33
+ * in the shape `FormService` returns so that `mergeForms` aggregates them alike (each item becomes a
34
+ * row of a repeatable source).
35
+ */
36
+ export declare function loadExternalRows(ctx: RequestContext, patientIds: number[], externalConfigMap: Record<string, FormListDataConfig>, paramValues: Record<string, unknown>): Promise<PatientsDataResponse[]>;
37
+ /**
38
+ * The key each configured external source always emits, empty when the patient has no data for it.
39
+ *
40
+ * Without it the key is absent and the front falls back to the base name, mixing two aliased
41
+ * discrete sources (e.g. steps vs sleep). SQL repeatable forms are unaffected: their shape is driven
42
+ * entirely by `mergeForms`.
43
+ */
44
+ export declare function externalDefaults(externalConfigMap: Record<string, FormListDataConfig>): Record<string, unknown[]>;
45
+ /**
46
+ * Loads the associated sources of a listing for the given patients, and answers with the values to
47
+ * spread into the row of each patient.
48
+ *
49
+ * **The patients are narrowed to the ones the caller may see first.** An axis other than a form of
50
+ * the project does not come from the patient subquery — an alert listing reaches patients through
51
+ * the alerts its reader may see, and a manager of alerts sees alerts of patients they cannot open in
52
+ * the project. `FormService` does not check access again, so without this a row would carry the
53
+ * forms of a patient its reader has no access to. A patient left out gets the same values as one
54
+ * with no data.
55
+ *
56
+ * Only the configured forms are merged into the row. `FormService` also reads the forms of the
57
+ * profile's patient list; the crf axis spreads those too, but here nothing asked for them.
58
+ */
59
+ declare function loadForReachablePatients(ctx: RequestContext, projectId: number, patientIds: number[], sources: AssociatedSources, paramValues: Record<string, unknown>): Promise<(patientId: number | null | undefined) => Record<string, unknown>>;
60
+ export declare const AssociatedSourcesService: {
61
+ loadForReachablePatients: typeof loadForReachablePatients;
62
+ };
63
+ export {};
64
+ //# sourceMappingURL=associated-sources.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"associated-sources.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAG9D,OAAO,WAAW,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAA4C,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAK1F,KAAK,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;AAIrF;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAChD,iBAAiB,EAAE,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L=associated-sources.service.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"associated-sources.service.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import { default as RequestContext } from '../../../../../models/request/RequestContext';
2
+ import { FormsDataQuery } from '../forms-data.schema';
3
+ /**
4
+ * Whether the main form's filter can constrain on a source.
5
+ *
6
+ * It can when the source is a crf of the project, which is what the compiled query is built over.
7
+ * A table of the platform is not one, so a condition naming it has nothing to compile against and
8
+ * gets pruned — see `pruneUnfilterableSources` for why that is a prune and not a rejection.
9
+ *
10
+ * The name arrives as it appears in the tree, which may carry the alias suffix a repeated source
11
+ * gets (`alert-2`), so it is compared by its base name.
12
+ */
13
+ export declare function isFilterableSource(name: string): boolean;
14
+ declare function get(ctx: RequestContext, { dashboardWidgetId, paramValues, ...pagination }: FormsDataQuery): Promise<{
15
+ results: any[];
16
+ total: number;
17
+ }>;
18
+ export declare const FormsDataService: {
19
+ get: typeof get;
20
+ };
21
+ export {};
22
+ //# sourceMappingURL=forms-data.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms-data.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/project/forms-data/forms-data.service/forms-data.service.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,mCAAmC,CAAA;AA0B9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAOrD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED,iBAAe,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,EAAE,iBAAiB,EAAE,WAAW,EAAE,GAAG,UAAU,EAAE,EAAE,cAAc;;;GAyLxG;AAED,eAAO,MAAM,gBAAgB;;CAE5B,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"forms-data.service.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/project/forms-data/forms-data.service/forms-data.service.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export { FormsDataService, isFilterableSource } from './forms-data.service';
2
+ export { AssociatedSourcesService, hasAssociatedSources, isPatientLoadedSource } from './associated-sources.service';
3
+ export type { AssociatedSources } from './associated-sources.service';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/project/forms-data/forms-data.service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACpH,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export * from './forms-data.controller';
2
2
  export * from './forms-data.schema';
3
+ export * from './forms-data.helper';
3
4
  export * from './forms-data.service';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/project/forms-data/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/project/forms-data/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA"}