@persei/perseed-api 5.0.29 → 5.0.30
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/ecosystem-alert.cjs +16 -0
- package/dist/ecosystem-alert.cjs.map +1 -1
- package/dist/ecosystem-alert.mjs +16 -0
- package/dist/ecosystem-alert.mjs.map +1 -1
- package/dist/src/controllers/ApiActionController.d.ts.map +1 -1
- package/dist/src/helpers/action-payload.test.d.ts +2 -0
- package/dist/src/helpers/action-payload.test.d.ts.map +1 -0
- package/dist/src/helpers/actionPayload.d.ts +11 -0
- package/dist/src/helpers/actionPayload.d.ts.map +1 -0
- package/dist/src/models/project/Displayer.d.ts.map +1 -1
- package/dist/src/models/project/encrypted-conditions.d.ts +21 -0
- package/dist/src/models/project/encrypted-conditions.d.ts.map +1 -0
- package/dist/src/models/project/encrypted-conditions.test.d.ts +2 -0
- package/dist/src/models/project/encrypted-conditions.test.d.ts.map +1 -0
- package/dist/src/schemas/notification_configuration/types.d.ts +3 -1
- package/dist/src/schemas/notification_configuration/types.d.ts.map +1 -1
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts +1 -1
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts.map +1 -1
- package/dist/src/v2/modules/ecosystem/alert/{alert.helper.d.ts → alert.helper/alert.helper.d.ts} +2 -2
- package/dist/src/v2/modules/ecosystem/alert/alert.helper/alert.helper.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.helper/alert.helper.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.helper/index.d.ts +3 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.helper/index.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.schema.d.ts +43 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.schema.d.ts.map +1 -1
- package/dist/src/v2/modules/ecosystem/alert/index.d.ts +2 -1
- package/dist/src/v2/modules/ecosystem/alert/index.d.ts.map +1 -1
- package/dist/src/v2/modules/global/jsonlogic-to-sql/jsonlogic-to-sql.helper.d.ts.map +1 -1
- package/dist/v1/perseed-api.cjs +2 -0
- package/dist/v1/perseed-api.cjs.map +1 -1
- package/dist/v1/perseed-api.mjs +2 -0
- package/dist/v1/perseed-api.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/src/v2/modules/ecosystem/alert/alert.helper.d.ts.map +0 -1
- package/dist/src/v2/modules/ecosystem/alert/alert.helper.test.d.ts.map +0 -1
- /package/dist/src/v2/modules/ecosystem/alert/{alert.helper.test.d.ts → alert.helper/alert.helper.test.d.ts} +0 -0
package/dist/ecosystem-alert.cjs
CHANGED
|
@@ -203,6 +203,20 @@ const resolveAlertSchema = typebox.Type.Object(
|
|
|
203
203
|
},
|
|
204
204
|
{ title: "ResolveAlert", description: "Payload to resolve an alert", additionalProperties: false }
|
|
205
205
|
);
|
|
206
|
+
const createAlertActionSchema = createAlertSchema;
|
|
207
|
+
const resolveAlertActionSchema = typebox.Type.Object(
|
|
208
|
+
{
|
|
209
|
+
id: typebox.Type.Number({ description: "Identifier of the alert to resolve" }),
|
|
210
|
+
resolution_note: typebox.Type.Optional(
|
|
211
|
+
typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()], { description: "Optional note explaining the resolution" })
|
|
212
|
+
)
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
title: "ResolveAlertAction",
|
|
216
|
+
description: "Payload of the action that resolves an alert",
|
|
217
|
+
additionalProperties: false
|
|
218
|
+
}
|
|
219
|
+
);
|
|
206
220
|
const listAlertQuerySchema = typebox.Type.Object(
|
|
207
221
|
{
|
|
208
222
|
status: typebox.Type.Optional(alertStatusSchema),
|
|
@@ -222,8 +236,10 @@ exports.alertEntityRefSchema = alertEntityRefSchema;
|
|
|
222
236
|
exports.alertSchema = alertSchema;
|
|
223
237
|
exports.alertSeveritySchema = alertSeveritySchema;
|
|
224
238
|
exports.alertStatusSchema = alertStatusSchema;
|
|
239
|
+
exports.createAlertActionSchema = createAlertActionSchema;
|
|
225
240
|
exports.createAlertSchema = createAlertSchema;
|
|
226
241
|
exports.listAlertQuerySchema = listAlertQuerySchema;
|
|
242
|
+
exports.resolveAlertActionSchema = resolveAlertActionSchema;
|
|
227
243
|
exports.resolveAlertSchema = resolveAlertSchema;
|
|
228
244
|
exports.updateAlertSchema = updateAlertSchema;
|
|
229
245
|
//# sourceMappingURL=ecosystem-alert.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecosystem-alert.cjs","sources":["../../src/v2/modules/ecosystem/alert/alert.schema.ts"],"sourcesContent":["import { Type, Static, StaticDecode } from 'typebox'\n// From the schema file, not the module barrel (`@/modules/global/dates`) that every other consumer\n// imports — the one case where `no-restricted-imports` has to give way, as `process-log.schema.ts`\n// already does for the same reason.\n//\n// This module has a `lib.ts`, so this file is an entry point of the published `@persei/perseed-api`\n// bundle, which is browser code. The barrel re-exports `dates.middleware`, a `fastify-plugin` that\n// pulls the server dependencies behind it into that bundle. `validate-v2-modules` enforces this.\n// eslint-disable-next-line no-restricted-imports\nimport {\n API_DATETIME_ACCEPTED_NOTE,\n API_DATETIME_EXAMPLE,\n EMITTED_DATETIME_NOTE,\n apiDateTime,\n} from '@/modules/global/dates/dates.schema'\n\n// An alert stores the alert and its state, nothing else. Everything that happens\n// *because* of an alert (notifications, calls to external services, writing a\n// form) belongs to the action system: an alert is one more trigger source.\n\n// ── Enums / literal unions ────────────────────────────────────────────\n// Same shape as the action-system module: a const object as the source of truth\n// (ergonomic dot access, `AlertStatus.ACTIVE`) plus the schema derived from it.\n\nexport const AlertStatus = {\n ACTIVE: 'active',\n RESOLVED: 'resolved',\n} as const\nexport const alertStatusSchema = Type.Enum(Object.values(AlertStatus), {\n title: 'AlertStatus',\n description: 'Lifecycle state of an alert. An alert is open until it is resolved',\n})\nexport type AlertStatus = Static<typeof alertStatusSchema>\n\nexport const AlertSeverity = {\n INFO: 'info',\n LOW: 'low',\n MEDIUM: 'medium',\n HIGH: 'high',\n CRITICAL: 'critical',\n} as const\nexport const alertSeveritySchema = Type.Enum(Object.values(AlertSeverity), {\n title: 'AlertSeverity',\n description: 'Severity of the alert, used to prioritise it',\n})\nexport type AlertSeverity = Static<typeof alertSeveritySchema>\n\n// Who raised the alert. Closed union: the three entry paths the system has.\n// `webhook` is declared because it is the emitter an ingress endpoint will record\n// — the endpoint itself is a later issue, but an alert created by any other means\n// on behalf of a device must already be able to say so.\nexport const AlertEmitterType = {\n TRIGGER: 'trigger',\n API: 'api',\n WEBHOOK: 'webhook',\n} as const\nexport const alertEmitterTypeSchema = Type.Enum(Object.values(AlertEmitterType), {\n title: 'AlertEmitterType',\n description: 'Kind of emitter that raised the alert',\n})\nexport type AlertEmitterType = Static<typeof alertEmitterTypeSchema>\n\n// ── Embedded structures ──────────────────────────────────────────────\n\nexport const alertEmitterSchema = Type.Object(\n {\n type: alertEmitterTypeSchema,\n id: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Identifier of the emitter within its type (trigger id, device id, service id…)',\n }),\n ),\n name: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Human readable name of the emitter',\n }),\n ),\n reference: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Identifier of the originating event in the emitting system, for traceability',\n }),\n ),\n },\n { title: 'AlertEmitter', description: 'Who raised the alert', additionalProperties: false },\n)\nexport type AlertEmitterData = Static<typeof alertEmitterSchema>\n\n// Recipients and related entities share this shape on purpose: both answer\n// \"which entity, and which one of them\", and the pair differs only in the role it\n// plays — a recipient is a natural addressee of the alert, a related entity is\n// connected to it without being addressed. Same shape means a trigger reading\n// either one reads it the same way.\n//\n// `type` is an open string (a phone, an email, a caaring user, a service…) and\n// `value` is its identifier, so a new kind of recipient needs no migration.\nexport const alertEntityRefSchema = Type.Object(\n {\n type: Type.String({ maxLength: 64, description: 'Kind of entity (user, phone, email, service…)' }),\n value: Type.String({ maxLength: 255, description: 'Identifier of the entity within its type' }),\n },\n {\n title: 'AlertEntityRef',\n description: 'Reference to an entity by kind and identifier',\n additionalProperties: false,\n },\n)\nexport type AlertEntityRefData = Static<typeof alertEntityRefSchema>\n\n// ── alert ─────────────────────────────────────────────────────────────\n\nexport const alertSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the alert' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Project this alert belongs to. Null for an ecosystem-wide alert, the ones created and read through the `/ecosystem/:ecosystemName/alert` mount, which belong to no project',\n }),\n ),\n alert_type_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Type of alert, as a row of the `alert_type` catalog of the ecosystem. Null for an alert that is not classified',\n }),\n ),\n user_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Caaring user the alert is about, and one of the two things that decide who may read it: this user always reads their own alerts. Null when the subject is a patient with no user account, in which case `patient_id` is the one that identifies them',\n }),\n ),\n patient_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Patient the alert is about, as the `id` of the `patient` CRF row of the project, and the other thing that decides who may read it: the professionals with access to that patient do. A patient may exist without a user account, so this is independent of `user_id`. It lives in the project database, so the column carries no foreign key and `project_id` is what says which database to read it from — an alert carrying it always carries a project',\n }),\n ),\n severity: Type.Optional(\n Type.Union([alertSeveritySchema, Type.Null()], { description: 'Severity of the alert. Null when not graded' }),\n ),\n status: Type.Optional(alertStatusSchema),\n title: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], { description: 'Short readable title' }),\n ),\n summary: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Longer readable description' })),\n emitter: alertEmitterSchema,\n recipients: Type.Optional(\n Type.Union([Type.Array(alertEntityRefSchema), Type.Null()], {\n description: 'Natural addressees of the alert. Null or empty when it has none',\n }),\n ),\n related_entities: Type.Optional(\n Type.Union([Type.Array(alertEntityRefSchema), Type.Null()], {\n description: 'Entities related to the alert without being addressees of it',\n }),\n ),\n payload: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Structured data that originated the alert (measured value, threshold, form answer…)',\n }),\n ),\n metadata: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Free extension point, so a new consumer does not need a schema change',\n }),\n ),\n dedup_key: Type.Optional(\n Type.String({\n maxLength: 255,\n description:\n 'Fingerprint used to avoid storing the same alert twice. A create carrying a key that is already open in the same scope answers with the stored alert; a resolved alert does not hold its key, so a condition that recurs after being dealt with raises a new one. Optional for the client: the server generates a UUID when it is absent, so the column always carries a usable value',\n }),\n ),\n triggered_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the event that originated the alert happened. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n viewed_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the alert was first viewed. Null while unseen. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n viewed_by: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who first viewed the alert' }),\n ),\n resolved_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the alert was resolved. Null while active. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n resolved_by: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who resolved the alert' }),\n ),\n resolution_note: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Optional note left when resolving the alert' }),\n ),\n created_user: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who created the alert, when a user did' }),\n ),\n created_at: Type.Optional(\n Type.String({\n description: `When the row was created. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n mod_time: Type.Optional(\n Type.String({\n description: `When the row was last modified. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n },\n { title: 'Alert', description: 'An alert and its state (ecosystem level)' },\n)\nexport type AlertData = Static<typeof alertSchema>\n\n// Written out rather than derived from `alertSchema`, for the same reason the action-system module\n// spells its request schemas out: an entity schema says what a row holds, a request schema says what\n// a client may send, and only the second can close itself. `Type.Omit` over an entity schema keeps\n// server-owned columns reachable through a body — here `status`, `resolved_*` and `viewed_*` are\n// absent because the server owns them, not because an `Omit` happened to remove them. Resolving\n// goes through its own endpoint; viewing is recorded by the read path.\nexport const createAlertSchema = Type.Object(\n {\n alert_type_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n user_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n patient_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n severity: Type.Optional(Type.Union([alertSeveritySchema, Type.Null()])),\n title: Type.Optional(Type.Union([Type.String({ maxLength: 255 }), Type.Null()])),\n summary: Type.Optional(Type.Union([Type.String(), Type.Null()])),\n emitter: alertEmitterSchema,\n recipients: Type.Optional(Type.Union([Type.Array(alertEntityRefSchema), Type.Null()])),\n related_entities: Type.Optional(Type.Union([Type.Array(alertEntityRefSchema), Type.Null()])),\n payload: Type.Optional(Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()])),\n metadata: Type.Optional(Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()])),\n dedup_key: Type.Optional(Type.String({ maxLength: 255 })),\n // `apiDateTime`, so the value reaches the service already a `Date` and no handler converts a\n // string by hand. The wrapped type is the same `format: 'date-time'` as before, so the 200s and\n // 400s of this field do not move — only what the service receives does.\n triggered_at: Type.Optional(\n Type.Union([apiDateTime, Type.Null()], {\n description: `When the event that originated the alert happened. RFC 3339 with a mandatory offset — \\`${API_DATETIME_EXAMPLE}\\` is the shape the API emits, so a value read from here can be sent straight back. ${API_DATETIME_ACCEPTED_NOTE}. Stored as UTC`,\n }),\n ),\n },\n { title: 'CreateAlert', description: 'Payload to create an alert', additionalProperties: false },\n)\n// `StaticDecode`, not `Static`: this type describes what a *handler receives*, and the handler\n// receives the decoded body — `triggered_at` is a `Date` there. `Static` resolves in the encode\n// direction, which is the string that travelled on the wire, so it would describe the value one\n// step earlier than the one this type is used for.\nexport type CreateAlertData = StaticDecode<typeof createAlertSchema>\n\n/**\n * The same payload as it travels on the wire, before the boundary decodes it: `triggered_at` is\n * still the RFC 3339 string a client sends.\n *\n * Only clients of the HTTP interface need this — tests that build a request body, and any caller\n * assembling JSON. Everything on the server side of the validator wants `CreateAlertData`, which is\n * the decoded shape.\n */\nexport type CreateAlertRequestBody = Static<typeof createAlertSchema>\n\n// `emitter` is `Type.Omit`-ted, not just made optional by `Type.Partial`: who raised the alert is\n// fixed at creation the same way `status`/`resolved_*`/`viewed_*` already are (see\n// `createAlertSchema` above) — a client rewriting it through a PATCH would falsify that provenance\n// for an entity that carries clinical data. `Type.Partial` alone would only make the key optional,\n// not absent, so it would still accept and apply a client-supplied `emitter`.\n// `Type.Partial` rebuilds the object and does NOT inherit `additionalProperties`, so it is restated.\nexport const updateAlertSchema = Type.Partial(Type.Omit(createAlertSchema, ['emitter']), {\n title: 'UpdateAlert',\n description: 'Payload to update an alert. Every field is optional. `emitter` cannot be changed after creation',\n additionalProperties: false,\n})\nexport type UpdateAlertData = StaticDecode<typeof updateAlertSchema>\n\n// Resolving is its own endpoint rather than a `status` field on the update: it is\n// the single transition of the lifecycle, and it writes three columns at once\n// (`status`, `resolved_at`, `resolved_by`) that must never disagree. A plain\n// `PATCH {status: 'resolved'}` would let a client set the state without the two\n// columns that say who closed it and when.\nexport const resolveAlertSchema = Type.Object(\n {\n resolution_note: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Optional note explaining the resolution' }),\n ),\n },\n { title: 'ResolveAlert', description: 'Payload to resolve an alert', additionalProperties: false },\n)\nexport type ResolveAlertData = Static<typeof resolveAlertSchema>\n\n// Filters of the list endpoint, on top of the pagination query. Everything is\n// optional: with none of them the endpoint lists the project's alerts.\nexport const listAlertQuerySchema = Type.Object(\n {\n status: Type.Optional(alertStatusSchema),\n severity: Type.Optional(alertSeveritySchema),\n user_id: Type.Optional(Type.Number({ description: 'Filter by the user the alert is about' })),\n patient_id: Type.Optional(Type.Number({ description: 'Filter by the patient the alert is about' })),\n alert_type_id: Type.Optional(Type.Number({ description: 'Filter by the type of the alert' })),\n },\n { title: 'ListAlertQuery', description: 'Filters available on the alert list' },\n)\nexport type ListAlertQuery = Static<typeof listAlertQuerySchema>\n"],"names":["Type","EMITTED_DATETIME_NOTE","API_DATETIME_EXAMPLE","apiDateTime","API_DATETIME_ACCEPTED_NOTE"],"mappings":";;;;AAwBO,MAAM,cAAc;AAAA,EACzB,QAAQ;AAAA,EACR,UAAU;AACZ;AACO,MAAM,oBAAoBA,QAAAA,KAAK,KAAK,OAAO,OAAO,WAAW,GAAG;AAAA,EACrE,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAGM,MAAM,gBAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AACZ;AACO,MAAM,sBAAsBA,QAAAA,KAAK,KAAK,OAAO,OAAO,aAAa,GAAG;AAAA,EACzE,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAOM,MAAM,mBAAmB;AAAA,EAC9B,SAAS;AAAA,EACT,KAAK;AAAA,EACL,SAAS;AACX;AACO,MAAM,yBAAyBA,QAAAA,KAAK,KAAK,OAAO,OAAO,gBAAgB,GAAG;AAAA,EAC/E,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAKM,MAAM,qBAAqBA,QAAAA,KAAK;AAAA,EACrC;AAAA,IACE,MAAM;AAAA,IACN,IAAIA,QAAAA,KAAK;AAAA,MACPA,QAAAA,KAAK,MAAM,CAACA,QAAAA,KAAK,OAAO,EAAE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BAAkB,aAAa,sCAAA;AAC1C;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ecosystem-alert.cjs","sources":["../../src/v2/modules/ecosystem/alert/alert.schema.ts"],"sourcesContent":["import { Type, Static, StaticDecode } from 'typebox'\n// From the schema file, not the module barrel (`@/modules/global/dates`) that every other consumer\n// imports — the one case where `no-restricted-imports` has to give way, as `process-log.schema.ts`\n// already does for the same reason.\n//\n// This module has a `lib.ts`, so this file is an entry point of the published `@persei/perseed-api`\n// bundle, which is browser code. The barrel re-exports `dates.middleware`, a `fastify-plugin` that\n// pulls the server dependencies behind it into that bundle. `validate-v2-modules` enforces this.\n// eslint-disable-next-line no-restricted-imports\nimport {\n API_DATETIME_ACCEPTED_NOTE,\n API_DATETIME_EXAMPLE,\n EMITTED_DATETIME_NOTE,\n apiDateTime,\n} from '@/modules/global/dates/dates.schema'\n\n// An alert stores the alert and its state, nothing else. Everything that happens\n// *because* of an alert (notifications, calls to external services, writing a\n// form) belongs to the action system: an alert is one more trigger source.\n\n// ── Enums / literal unions ────────────────────────────────────────────\n// Same shape as the action-system module: a const object as the source of truth\n// (ergonomic dot access, `AlertStatus.ACTIVE`) plus the schema derived from it.\n\nexport const AlertStatus = {\n ACTIVE: 'active',\n RESOLVED: 'resolved',\n} as const\nexport const alertStatusSchema = Type.Enum(Object.values(AlertStatus), {\n title: 'AlertStatus',\n description: 'Lifecycle state of an alert. An alert is open until it is resolved',\n})\nexport type AlertStatus = Static<typeof alertStatusSchema>\n\nexport const AlertSeverity = {\n INFO: 'info',\n LOW: 'low',\n MEDIUM: 'medium',\n HIGH: 'high',\n CRITICAL: 'critical',\n} as const\nexport const alertSeveritySchema = Type.Enum(Object.values(AlertSeverity), {\n title: 'AlertSeverity',\n description: 'Severity of the alert, used to prioritise it',\n})\nexport type AlertSeverity = Static<typeof alertSeveritySchema>\n\n// Who raised the alert. Closed union: the three entry paths the system has.\n// `webhook` is declared because it is the emitter an ingress endpoint will record\n// — the endpoint itself is a later issue, but an alert created by any other means\n// on behalf of a device must already be able to say so.\nexport const AlertEmitterType = {\n TRIGGER: 'trigger',\n API: 'api',\n WEBHOOK: 'webhook',\n} as const\nexport const alertEmitterTypeSchema = Type.Enum(Object.values(AlertEmitterType), {\n title: 'AlertEmitterType',\n description: 'Kind of emitter that raised the alert',\n})\nexport type AlertEmitterType = Static<typeof alertEmitterTypeSchema>\n\n// ── Embedded structures ──────────────────────────────────────────────\n\nexport const alertEmitterSchema = Type.Object(\n {\n type: alertEmitterTypeSchema,\n id: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Identifier of the emitter within its type (trigger id, device id, service id…)',\n }),\n ),\n name: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Human readable name of the emitter',\n }),\n ),\n reference: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Identifier of the originating event in the emitting system, for traceability',\n }),\n ),\n },\n { title: 'AlertEmitter', description: 'Who raised the alert', additionalProperties: false },\n)\nexport type AlertEmitterData = Static<typeof alertEmitterSchema>\n\n// Recipients and related entities share this shape on purpose: both answer\n// \"which entity, and which one of them\", and the pair differs only in the role it\n// plays — a recipient is a natural addressee of the alert, a related entity is\n// connected to it without being addressed. Same shape means a trigger reading\n// either one reads it the same way.\n//\n// `type` is an open string (a phone, an email, a caaring user, a service…) and\n// `value` is its identifier, so a new kind of recipient needs no migration.\nexport const alertEntityRefSchema = Type.Object(\n {\n type: Type.String({ maxLength: 64, description: 'Kind of entity (user, phone, email, service…)' }),\n value: Type.String({ maxLength: 255, description: 'Identifier of the entity within its type' }),\n },\n {\n title: 'AlertEntityRef',\n description: 'Reference to an entity by kind and identifier',\n additionalProperties: false,\n },\n)\nexport type AlertEntityRefData = Static<typeof alertEntityRefSchema>\n\n// ── alert ─────────────────────────────────────────────────────────────\n\nexport const alertSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the alert' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Project this alert belongs to. Null for an ecosystem-wide alert, the ones created and read through the `/ecosystem/:ecosystemName/alert` mount, which belong to no project',\n }),\n ),\n alert_type_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Type of alert, as a row of the `alert_type` catalog of the ecosystem. Null for an alert that is not classified',\n }),\n ),\n user_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Caaring user the alert is about, and one of the two things that decide who may read it: this user always reads their own alerts. Null when the subject is a patient with no user account, in which case `patient_id` is the one that identifies them',\n }),\n ),\n patient_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Patient the alert is about, as the `id` of the `patient` CRF row of the project, and the other thing that decides who may read it: the professionals with access to that patient do. A patient may exist without a user account, so this is independent of `user_id`. It lives in the project database, so the column carries no foreign key and `project_id` is what says which database to read it from — an alert carrying it always carries a project',\n }),\n ),\n severity: Type.Optional(\n Type.Union([alertSeveritySchema, Type.Null()], { description: 'Severity of the alert. Null when not graded' }),\n ),\n status: Type.Optional(alertStatusSchema),\n title: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], { description: 'Short readable title' }),\n ),\n summary: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Longer readable description' })),\n emitter: alertEmitterSchema,\n recipients: Type.Optional(\n Type.Union([Type.Array(alertEntityRefSchema), Type.Null()], {\n description: 'Natural addressees of the alert. Null or empty when it has none',\n }),\n ),\n related_entities: Type.Optional(\n Type.Union([Type.Array(alertEntityRefSchema), Type.Null()], {\n description: 'Entities related to the alert without being addressees of it',\n }),\n ),\n payload: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Structured data that originated the alert (measured value, threshold, form answer…)',\n }),\n ),\n metadata: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Free extension point, so a new consumer does not need a schema change',\n }),\n ),\n dedup_key: Type.Optional(\n Type.String({\n maxLength: 255,\n description:\n 'Fingerprint used to avoid storing the same alert twice. A create carrying a key that is already open in the same scope answers with the stored alert; a resolved alert does not hold its key, so a condition that recurs after being dealt with raises a new one. Optional for the client: the server generates a UUID when it is absent, so the column always carries a usable value',\n }),\n ),\n triggered_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the event that originated the alert happened. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n viewed_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the alert was first viewed. Null while unseen. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n viewed_by: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who first viewed the alert' }),\n ),\n resolved_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the alert was resolved. Null while active. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n resolved_by: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who resolved the alert' }),\n ),\n resolution_note: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Optional note left when resolving the alert' }),\n ),\n created_user: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who created the alert, when a user did' }),\n ),\n created_at: Type.Optional(\n Type.String({\n description: `When the row was created. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n mod_time: Type.Optional(\n Type.String({\n description: `When the row was last modified. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n },\n { title: 'Alert', description: 'An alert and its state (ecosystem level)' },\n)\nexport type AlertData = Static<typeof alertSchema>\n\n// Written out rather than derived from `alertSchema`, for the same reason the action-system module\n// spells its request schemas out: an entity schema says what a row holds, a request schema says what\n// a client may send, and only the second can close itself. `Type.Omit` over an entity schema keeps\n// server-owned columns reachable through a body — here `status`, `resolved_*` and `viewed_*` are\n// absent because the server owns them, not because an `Omit` happened to remove them. Resolving\n// goes through its own endpoint; viewing is recorded by the read path.\nexport const createAlertSchema = Type.Object(\n {\n alert_type_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n user_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n patient_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n severity: Type.Optional(Type.Union([alertSeveritySchema, Type.Null()])),\n title: Type.Optional(Type.Union([Type.String({ maxLength: 255 }), Type.Null()])),\n summary: Type.Optional(Type.Union([Type.String(), Type.Null()])),\n emitter: alertEmitterSchema,\n recipients: Type.Optional(Type.Union([Type.Array(alertEntityRefSchema), Type.Null()])),\n related_entities: Type.Optional(Type.Union([Type.Array(alertEntityRefSchema), Type.Null()])),\n payload: Type.Optional(Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()])),\n metadata: Type.Optional(Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()])),\n dedup_key: Type.Optional(Type.String({ maxLength: 255 })),\n // `apiDateTime`, so the value reaches the service already a `Date` and no handler converts a\n // string by hand. The wrapped type is the same `format: 'date-time'` as before, so the 200s and\n // 400s of this field do not move — only what the service receives does.\n triggered_at: Type.Optional(\n Type.Union([apiDateTime, Type.Null()], {\n description: `When the event that originated the alert happened. RFC 3339 with a mandatory offset — \\`${API_DATETIME_EXAMPLE}\\` is the shape the API emits, so a value read from here can be sent straight back. ${API_DATETIME_ACCEPTED_NOTE}. Stored as UTC`,\n }),\n ),\n },\n { title: 'CreateAlert', description: 'Payload to create an alert', additionalProperties: false },\n)\n// `StaticDecode`, not `Static`: this type describes what a *handler receives*, and the handler\n// receives the decoded body — `triggered_at` is a `Date` there. `Static` resolves in the encode\n// direction, which is the string that travelled on the wire, so it would describe the value one\n// step earlier than the one this type is used for.\nexport type CreateAlertData = StaticDecode<typeof createAlertSchema>\n\n/**\n * The same payload as it travels on the wire, before the boundary decodes it: `triggered_at` is\n * still the RFC 3339 string a client sends.\n *\n * Only clients of the HTTP interface need this — tests that build a request body, and any caller\n * assembling JSON. Everything on the server side of the validator wants `CreateAlertData`, which is\n * the decoded shape.\n */\nexport type CreateAlertRequestBody = Static<typeof createAlertSchema>\n\n// `emitter` is `Type.Omit`-ted, not just made optional by `Type.Partial`: who raised the alert is\n// fixed at creation the same way `status`/`resolved_*`/`viewed_*` already are (see\n// `createAlertSchema` above) — a client rewriting it through a PATCH would falsify that provenance\n// for an entity that carries clinical data. `Type.Partial` alone would only make the key optional,\n// not absent, so it would still accept and apply a client-supplied `emitter`.\n// `Type.Partial` rebuilds the object and does NOT inherit `additionalProperties`, so it is restated.\nexport const updateAlertSchema = Type.Partial(Type.Omit(createAlertSchema, ['emitter']), {\n title: 'UpdateAlert',\n description: 'Payload to update an alert. Every field is optional. `emitter` cannot be changed after creation',\n additionalProperties: false,\n})\nexport type UpdateAlertData = StaticDecode<typeof updateAlertSchema>\n\n// Resolving is its own endpoint rather than a `status` field on the update: it is\n// the single transition of the lifecycle, and it writes three columns at once\n// (`status`, `resolved_at`, `resolved_by`) that must never disagree. A plain\n// `PATCH {status: 'resolved'}` would let a client set the state without the two\n// columns that say who closed it and when.\nexport const resolveAlertSchema = Type.Object(\n {\n resolution_note: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Optional note explaining the resolution' }),\n ),\n },\n { title: 'ResolveAlert', description: 'Payload to resolve an alert', additionalProperties: false },\n)\nexport type ResolveAlertData = Static<typeof resolveAlertSchema>\n\n// ── Action payloads ───────────────────────────────────────────────────\n// What an action of the action system carries. Published with the module, so the administration UI\n// builds its form from the very schema the execution validates against: which fields exist, which\n// are required and what values an enum takes are one definition.\n\n/**\n * Payload of the `alert.create` action — the create body as it is, `emitter` included: an action is\n * one more client of the endpoint, and nothing is filled in on its behalf. Configuring an action\n * without an emitter fails the same way a request without one does.\n */\nexport const createAlertActionSchema = createAlertSchema\nexport type CreateAlertActionData = CreateAlertData\n\n/**\n * Payload of the `alert.resolve` action: which alert, and the optional note.\n *\n * `id` is required here and absent from `resolveAlertSchema` because the endpoint takes it from the\n * URL and an action has none — it names the alert in its payload, typically `{{current.id}}`.\n */\nexport const resolveAlertActionSchema = Type.Object(\n {\n id: Type.Number({ description: 'Identifier of the alert to resolve' }),\n resolution_note: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Optional note explaining the resolution' }),\n ),\n },\n {\n title: 'ResolveAlertAction',\n description: 'Payload of the action that resolves an alert',\n additionalProperties: false,\n },\n)\nexport type ResolveAlertActionData = StaticDecode<typeof resolveAlertActionSchema>\n\n// Filters of the list endpoint, on top of the pagination query. Everything is\n// optional: with none of them the endpoint lists the project's alerts.\nexport const listAlertQuerySchema = Type.Object(\n {\n status: Type.Optional(alertStatusSchema),\n severity: Type.Optional(alertSeveritySchema),\n user_id: Type.Optional(Type.Number({ description: 'Filter by the user the alert is about' })),\n patient_id: Type.Optional(Type.Number({ description: 'Filter by the patient the alert is about' })),\n alert_type_id: Type.Optional(Type.Number({ description: 'Filter by the type of the alert' })),\n },\n { title: 'ListAlertQuery', description: 'Filters available on the alert list' },\n)\nexport type ListAlertQuery = Static<typeof listAlertQuerySchema>\n"],"names":["Type","EMITTED_DATETIME_NOTE","API_DATETIME_EXAMPLE","apiDateTime","API_DATETIME_ACCEPTED_NOTE"],"mappings":";;;;AAwBO,MAAM,cAAc;AAAA,EACzB,QAAQ;AAAA,EACR,UAAU;AACZ;AACO,MAAM,oBAAoBA,QAAAA,KAAK,KAAK,OAAO,OAAO,WAAW,GAAG;AAAA,EACrE,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAGM,MAAM,gBAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AACZ;AACO,MAAM,sBAAsBA,QAAAA,KAAK,KAAK,OAAO,OAAO,aAAa,GAAG;AAAA,EAC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A,EAC3C;AAAA,IACE,IAAIA,QAAAA,KAAK,OAAO,EAAE,aAAa,sCAAsC;AAAA,IACrE,iBAAiBA,QAAAA,KAAK;AAAA,MACpBA,QAAAA,KAAK,MAAM,CAACA,QAAAA,KAAK,OAAA,GAAUA,aAAK,MAAM,GAAG,EAAE,aAAa,2CAA2C;AAAA,IAAA;AAAA,EACrG;AAAA,EAEF;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,sBAAsB;AAAA,EAAA;AAE1B;AAKO,MAAM,uBAAuBA,QAAAA,KAAK;AAAA,EACvC;AAAA,IACE,QAAQA,QAAAA,KAAK,SAAS,iBAAiB;AAAA,IACvC,UAAUA,QAAAA,KAAK,SAAS,mBAAmB;AAAA,IAC3C,SAASA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,EAAE,aAAa,wCAAA,CAAyC,CAAC;AAAA,IAC5F,YAAYA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,EAAE,aAAa,2CAAA,CAA4C,CAAC;AAAA,IAClG,eAAeA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,EAAE,aAAa,mCAAmC,CAAC;AAAA,EAAA;AAAA,EAE9F,EAAE,OAAO,kBAAkB,aAAa,sCAAA;AAC1C;;;;;;;;;;;;;;;;"}
|
package/dist/ecosystem-alert.mjs
CHANGED
|
@@ -201,6 +201,20 @@ const resolveAlertSchema = Type.Object(
|
|
|
201
201
|
},
|
|
202
202
|
{ title: "ResolveAlert", description: "Payload to resolve an alert", additionalProperties: false }
|
|
203
203
|
);
|
|
204
|
+
const createAlertActionSchema = createAlertSchema;
|
|
205
|
+
const resolveAlertActionSchema = Type.Object(
|
|
206
|
+
{
|
|
207
|
+
id: Type.Number({ description: "Identifier of the alert to resolve" }),
|
|
208
|
+
resolution_note: Type.Optional(
|
|
209
|
+
Type.Union([Type.String(), Type.Null()], { description: "Optional note explaining the resolution" })
|
|
210
|
+
)
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
title: "ResolveAlertAction",
|
|
214
|
+
description: "Payload of the action that resolves an alert",
|
|
215
|
+
additionalProperties: false
|
|
216
|
+
}
|
|
217
|
+
);
|
|
204
218
|
const listAlertQuerySchema = Type.Object(
|
|
205
219
|
{
|
|
206
220
|
status: Type.Optional(alertStatusSchema),
|
|
@@ -221,8 +235,10 @@ export {
|
|
|
221
235
|
alertSchema,
|
|
222
236
|
alertSeveritySchema,
|
|
223
237
|
alertStatusSchema,
|
|
238
|
+
createAlertActionSchema,
|
|
224
239
|
createAlertSchema,
|
|
225
240
|
listAlertQuerySchema,
|
|
241
|
+
resolveAlertActionSchema,
|
|
226
242
|
resolveAlertSchema,
|
|
227
243
|
updateAlertSchema
|
|
228
244
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecosystem-alert.mjs","sources":["../../src/v2/modules/ecosystem/alert/alert.schema.ts"],"sourcesContent":["import { Type, Static, StaticDecode } from 'typebox'\n// From the schema file, not the module barrel (`@/modules/global/dates`) that every other consumer\n// imports — the one case where `no-restricted-imports` has to give way, as `process-log.schema.ts`\n// already does for the same reason.\n//\n// This module has a `lib.ts`, so this file is an entry point of the published `@persei/perseed-api`\n// bundle, which is browser code. The barrel re-exports `dates.middleware`, a `fastify-plugin` that\n// pulls the server dependencies behind it into that bundle. `validate-v2-modules` enforces this.\n// eslint-disable-next-line no-restricted-imports\nimport {\n API_DATETIME_ACCEPTED_NOTE,\n API_DATETIME_EXAMPLE,\n EMITTED_DATETIME_NOTE,\n apiDateTime,\n} from '@/modules/global/dates/dates.schema'\n\n// An alert stores the alert and its state, nothing else. Everything that happens\n// *because* of an alert (notifications, calls to external services, writing a\n// form) belongs to the action system: an alert is one more trigger source.\n\n// ── Enums / literal unions ────────────────────────────────────────────\n// Same shape as the action-system module: a const object as the source of truth\n// (ergonomic dot access, `AlertStatus.ACTIVE`) plus the schema derived from it.\n\nexport const AlertStatus = {\n ACTIVE: 'active',\n RESOLVED: 'resolved',\n} as const\nexport const alertStatusSchema = Type.Enum(Object.values(AlertStatus), {\n title: 'AlertStatus',\n description: 'Lifecycle state of an alert. An alert is open until it is resolved',\n})\nexport type AlertStatus = Static<typeof alertStatusSchema>\n\nexport const AlertSeverity = {\n INFO: 'info',\n LOW: 'low',\n MEDIUM: 'medium',\n HIGH: 'high',\n CRITICAL: 'critical',\n} as const\nexport const alertSeveritySchema = Type.Enum(Object.values(AlertSeverity), {\n title: 'AlertSeverity',\n description: 'Severity of the alert, used to prioritise it',\n})\nexport type AlertSeverity = Static<typeof alertSeveritySchema>\n\n// Who raised the alert. Closed union: the three entry paths the system has.\n// `webhook` is declared because it is the emitter an ingress endpoint will record\n// — the endpoint itself is a later issue, but an alert created by any other means\n// on behalf of a device must already be able to say so.\nexport const AlertEmitterType = {\n TRIGGER: 'trigger',\n API: 'api',\n WEBHOOK: 'webhook',\n} as const\nexport const alertEmitterTypeSchema = Type.Enum(Object.values(AlertEmitterType), {\n title: 'AlertEmitterType',\n description: 'Kind of emitter that raised the alert',\n})\nexport type AlertEmitterType = Static<typeof alertEmitterTypeSchema>\n\n// ── Embedded structures ──────────────────────────────────────────────\n\nexport const alertEmitterSchema = Type.Object(\n {\n type: alertEmitterTypeSchema,\n id: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Identifier of the emitter within its type (trigger id, device id, service id…)',\n }),\n ),\n name: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Human readable name of the emitter',\n }),\n ),\n reference: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Identifier of the originating event in the emitting system, for traceability',\n }),\n ),\n },\n { title: 'AlertEmitter', description: 'Who raised the alert', additionalProperties: false },\n)\nexport type AlertEmitterData = Static<typeof alertEmitterSchema>\n\n// Recipients and related entities share this shape on purpose: both answer\n// \"which entity, and which one of them\", and the pair differs only in the role it\n// plays — a recipient is a natural addressee of the alert, a related entity is\n// connected to it without being addressed. Same shape means a trigger reading\n// either one reads it the same way.\n//\n// `type` is an open string (a phone, an email, a caaring user, a service…) and\n// `value` is its identifier, so a new kind of recipient needs no migration.\nexport const alertEntityRefSchema = Type.Object(\n {\n type: Type.String({ maxLength: 64, description: 'Kind of entity (user, phone, email, service…)' }),\n value: Type.String({ maxLength: 255, description: 'Identifier of the entity within its type' }),\n },\n {\n title: 'AlertEntityRef',\n description: 'Reference to an entity by kind and identifier',\n additionalProperties: false,\n },\n)\nexport type AlertEntityRefData = Static<typeof alertEntityRefSchema>\n\n// ── alert ─────────────────────────────────────────────────────────────\n\nexport const alertSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the alert' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Project this alert belongs to. Null for an ecosystem-wide alert, the ones created and read through the `/ecosystem/:ecosystemName/alert` mount, which belong to no project',\n }),\n ),\n alert_type_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Type of alert, as a row of the `alert_type` catalog of the ecosystem. Null for an alert that is not classified',\n }),\n ),\n user_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Caaring user the alert is about, and one of the two things that decide who may read it: this user always reads their own alerts. Null when the subject is a patient with no user account, in which case `patient_id` is the one that identifies them',\n }),\n ),\n patient_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Patient the alert is about, as the `id` of the `patient` CRF row of the project, and the other thing that decides who may read it: the professionals with access to that patient do. A patient may exist without a user account, so this is independent of `user_id`. It lives in the project database, so the column carries no foreign key and `project_id` is what says which database to read it from — an alert carrying it always carries a project',\n }),\n ),\n severity: Type.Optional(\n Type.Union([alertSeveritySchema, Type.Null()], { description: 'Severity of the alert. Null when not graded' }),\n ),\n status: Type.Optional(alertStatusSchema),\n title: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], { description: 'Short readable title' }),\n ),\n summary: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Longer readable description' })),\n emitter: alertEmitterSchema,\n recipients: Type.Optional(\n Type.Union([Type.Array(alertEntityRefSchema), Type.Null()], {\n description: 'Natural addressees of the alert. Null or empty when it has none',\n }),\n ),\n related_entities: Type.Optional(\n Type.Union([Type.Array(alertEntityRefSchema), Type.Null()], {\n description: 'Entities related to the alert without being addressees of it',\n }),\n ),\n payload: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Structured data that originated the alert (measured value, threshold, form answer…)',\n }),\n ),\n metadata: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Free extension point, so a new consumer does not need a schema change',\n }),\n ),\n dedup_key: Type.Optional(\n Type.String({\n maxLength: 255,\n description:\n 'Fingerprint used to avoid storing the same alert twice. A create carrying a key that is already open in the same scope answers with the stored alert; a resolved alert does not hold its key, so a condition that recurs after being dealt with raises a new one. Optional for the client: the server generates a UUID when it is absent, so the column always carries a usable value',\n }),\n ),\n triggered_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the event that originated the alert happened. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n viewed_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the alert was first viewed. Null while unseen. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n viewed_by: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who first viewed the alert' }),\n ),\n resolved_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the alert was resolved. Null while active. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n resolved_by: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who resolved the alert' }),\n ),\n resolution_note: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Optional note left when resolving the alert' }),\n ),\n created_user: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who created the alert, when a user did' }),\n ),\n created_at: Type.Optional(\n Type.String({\n description: `When the row was created. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n mod_time: Type.Optional(\n Type.String({\n description: `When the row was last modified. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n },\n { title: 'Alert', description: 'An alert and its state (ecosystem level)' },\n)\nexport type AlertData = Static<typeof alertSchema>\n\n// Written out rather than derived from `alertSchema`, for the same reason the action-system module\n// spells its request schemas out: an entity schema says what a row holds, a request schema says what\n// a client may send, and only the second can close itself. `Type.Omit` over an entity schema keeps\n// server-owned columns reachable through a body — here `status`, `resolved_*` and `viewed_*` are\n// absent because the server owns them, not because an `Omit` happened to remove them. Resolving\n// goes through its own endpoint; viewing is recorded by the read path.\nexport const createAlertSchema = Type.Object(\n {\n alert_type_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n user_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n patient_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n severity: Type.Optional(Type.Union([alertSeveritySchema, Type.Null()])),\n title: Type.Optional(Type.Union([Type.String({ maxLength: 255 }), Type.Null()])),\n summary: Type.Optional(Type.Union([Type.String(), Type.Null()])),\n emitter: alertEmitterSchema,\n recipients: Type.Optional(Type.Union([Type.Array(alertEntityRefSchema), Type.Null()])),\n related_entities: Type.Optional(Type.Union([Type.Array(alertEntityRefSchema), Type.Null()])),\n payload: Type.Optional(Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()])),\n metadata: Type.Optional(Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()])),\n dedup_key: Type.Optional(Type.String({ maxLength: 255 })),\n // `apiDateTime`, so the value reaches the service already a `Date` and no handler converts a\n // string by hand. The wrapped type is the same `format: 'date-time'` as before, so the 200s and\n // 400s of this field do not move — only what the service receives does.\n triggered_at: Type.Optional(\n Type.Union([apiDateTime, Type.Null()], {\n description: `When the event that originated the alert happened. RFC 3339 with a mandatory offset — \\`${API_DATETIME_EXAMPLE}\\` is the shape the API emits, so a value read from here can be sent straight back. ${API_DATETIME_ACCEPTED_NOTE}. Stored as UTC`,\n }),\n ),\n },\n { title: 'CreateAlert', description: 'Payload to create an alert', additionalProperties: false },\n)\n// `StaticDecode`, not `Static`: this type describes what a *handler receives*, and the handler\n// receives the decoded body — `triggered_at` is a `Date` there. `Static` resolves in the encode\n// direction, which is the string that travelled on the wire, so it would describe the value one\n// step earlier than the one this type is used for.\nexport type CreateAlertData = StaticDecode<typeof createAlertSchema>\n\n/**\n * The same payload as it travels on the wire, before the boundary decodes it: `triggered_at` is\n * still the RFC 3339 string a client sends.\n *\n * Only clients of the HTTP interface need this — tests that build a request body, and any caller\n * assembling JSON. Everything on the server side of the validator wants `CreateAlertData`, which is\n * the decoded shape.\n */\nexport type CreateAlertRequestBody = Static<typeof createAlertSchema>\n\n// `emitter` is `Type.Omit`-ted, not just made optional by `Type.Partial`: who raised the alert is\n// fixed at creation the same way `status`/`resolved_*`/`viewed_*` already are (see\n// `createAlertSchema` above) — a client rewriting it through a PATCH would falsify that provenance\n// for an entity that carries clinical data. `Type.Partial` alone would only make the key optional,\n// not absent, so it would still accept and apply a client-supplied `emitter`.\n// `Type.Partial` rebuilds the object and does NOT inherit `additionalProperties`, so it is restated.\nexport const updateAlertSchema = Type.Partial(Type.Omit(createAlertSchema, ['emitter']), {\n title: 'UpdateAlert',\n description: 'Payload to update an alert. Every field is optional. `emitter` cannot be changed after creation',\n additionalProperties: false,\n})\nexport type UpdateAlertData = StaticDecode<typeof updateAlertSchema>\n\n// Resolving is its own endpoint rather than a `status` field on the update: it is\n// the single transition of the lifecycle, and it writes three columns at once\n// (`status`, `resolved_at`, `resolved_by`) that must never disagree. A plain\n// `PATCH {status: 'resolved'}` would let a client set the state without the two\n// columns that say who closed it and when.\nexport const resolveAlertSchema = Type.Object(\n {\n resolution_note: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Optional note explaining the resolution' }),\n ),\n },\n { title: 'ResolveAlert', description: 'Payload to resolve an alert', additionalProperties: false },\n)\nexport type ResolveAlertData = Static<typeof resolveAlertSchema>\n\n// Filters of the list endpoint, on top of the pagination query. Everything is\n// optional: with none of them the endpoint lists the project's alerts.\nexport const listAlertQuerySchema = Type.Object(\n {\n status: Type.Optional(alertStatusSchema),\n severity: Type.Optional(alertSeveritySchema),\n user_id: Type.Optional(Type.Number({ description: 'Filter by the user the alert is about' })),\n patient_id: Type.Optional(Type.Number({ description: 'Filter by the patient the alert is about' })),\n alert_type_id: Type.Optional(Type.Number({ description: 'Filter by the type of the alert' })),\n },\n { title: 'ListAlertQuery', description: 'Filters available on the alert list' },\n)\nexport type ListAlertQuery = Static<typeof listAlertQuerySchema>\n"],"names":[],"mappings":";;AAwBO,MAAM,cAAc;AAAA,EACzB,QAAQ;AAAA,EACR,UAAU;AACZ;AACO,MAAM,oBAAoB,KAAK,KAAK,OAAO,OAAO,WAAW,GAAG;AAAA,EACrE,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAGM,MAAM,gBAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AACZ;AACO,MAAM,sBAAsB,KAAK,KAAK,OAAO,OAAO,aAAa,GAAG;AAAA,EACzE,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAOM,MAAM,mBAAmB;AAAA,EAC9B,SAAS;AAAA,EACT,KAAK;AAAA,EACL,SAAS;AACX;AACO,MAAM,yBAAyB,KAAK,KAAK,OAAO,OAAO,gBAAgB,GAAG;AAAA,EAC/E,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAKM,MAAM,qBAAqB,KAAK;AAAA,EACrC;AAAA,IACE,MAAM;AAAA,IACN,IAAI,KAAK;AAAA,MACP,KAAK,MAAM,CAA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O,kBAAkB,aAAa,sCAAA;AAC1C;"}
|
|
1
|
+
{"version":3,"file":"ecosystem-alert.mjs","sources":["../../src/v2/modules/ecosystem/alert/alert.schema.ts"],"sourcesContent":["import { Type, Static, StaticDecode } from 'typebox'\n// From the schema file, not the module barrel (`@/modules/global/dates`) that every other consumer\n// imports — the one case where `no-restricted-imports` has to give way, as `process-log.schema.ts`\n// already does for the same reason.\n//\n// This module has a `lib.ts`, so this file is an entry point of the published `@persei/perseed-api`\n// bundle, which is browser code. The barrel re-exports `dates.middleware`, a `fastify-plugin` that\n// pulls the server dependencies behind it into that bundle. `validate-v2-modules` enforces this.\n// eslint-disable-next-line no-restricted-imports\nimport {\n API_DATETIME_ACCEPTED_NOTE,\n API_DATETIME_EXAMPLE,\n EMITTED_DATETIME_NOTE,\n apiDateTime,\n} from '@/modules/global/dates/dates.schema'\n\n// An alert stores the alert and its state, nothing else. Everything that happens\n// *because* of an alert (notifications, calls to external services, writing a\n// form) belongs to the action system: an alert is one more trigger source.\n\n// ── Enums / literal unions ────────────────────────────────────────────\n// Same shape as the action-system module: a const object as the source of truth\n// (ergonomic dot access, `AlertStatus.ACTIVE`) plus the schema derived from it.\n\nexport const AlertStatus = {\n ACTIVE: 'active',\n RESOLVED: 'resolved',\n} as const\nexport const alertStatusSchema = Type.Enum(Object.values(AlertStatus), {\n title: 'AlertStatus',\n description: 'Lifecycle state of an alert. An alert is open until it is resolved',\n})\nexport type AlertStatus = Static<typeof alertStatusSchema>\n\nexport const AlertSeverity = {\n INFO: 'info',\n LOW: 'low',\n MEDIUM: 'medium',\n HIGH: 'high',\n CRITICAL: 'critical',\n} as const\nexport const alertSeveritySchema = Type.Enum(Object.values(AlertSeverity), {\n title: 'AlertSeverity',\n description: 'Severity of the alert, used to prioritise it',\n})\nexport type AlertSeverity = Static<typeof alertSeveritySchema>\n\n// Who raised the alert. Closed union: the three entry paths the system has.\n// `webhook` is declared because it is the emitter an ingress endpoint will record\n// — the endpoint itself is a later issue, but an alert created by any other means\n// on behalf of a device must already be able to say so.\nexport const AlertEmitterType = {\n TRIGGER: 'trigger',\n API: 'api',\n WEBHOOK: 'webhook',\n} as const\nexport const alertEmitterTypeSchema = Type.Enum(Object.values(AlertEmitterType), {\n title: 'AlertEmitterType',\n description: 'Kind of emitter that raised the alert',\n})\nexport type AlertEmitterType = Static<typeof alertEmitterTypeSchema>\n\n// ── Embedded structures ──────────────────────────────────────────────\n\nexport const alertEmitterSchema = Type.Object(\n {\n type: alertEmitterTypeSchema,\n id: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Identifier of the emitter within its type (trigger id, device id, service id…)',\n }),\n ),\n name: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Human readable name of the emitter',\n }),\n ),\n reference: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Identifier of the originating event in the emitting system, for traceability',\n }),\n ),\n },\n { title: 'AlertEmitter', description: 'Who raised the alert', additionalProperties: false },\n)\nexport type AlertEmitterData = Static<typeof alertEmitterSchema>\n\n// Recipients and related entities share this shape on purpose: both answer\n// \"which entity, and which one of them\", and the pair differs only in the role it\n// plays — a recipient is a natural addressee of the alert, a related entity is\n// connected to it without being addressed. Same shape means a trigger reading\n// either one reads it the same way.\n//\n// `type` is an open string (a phone, an email, a caaring user, a service…) and\n// `value` is its identifier, so a new kind of recipient needs no migration.\nexport const alertEntityRefSchema = Type.Object(\n {\n type: Type.String({ maxLength: 64, description: 'Kind of entity (user, phone, email, service…)' }),\n value: Type.String({ maxLength: 255, description: 'Identifier of the entity within its type' }),\n },\n {\n title: 'AlertEntityRef',\n description: 'Reference to an entity by kind and identifier',\n additionalProperties: false,\n },\n)\nexport type AlertEntityRefData = Static<typeof alertEntityRefSchema>\n\n// ── alert ─────────────────────────────────────────────────────────────\n\nexport const alertSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the alert' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Project this alert belongs to. Null for an ecosystem-wide alert, the ones created and read through the `/ecosystem/:ecosystemName/alert` mount, which belong to no project',\n }),\n ),\n alert_type_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Type of alert, as a row of the `alert_type` catalog of the ecosystem. Null for an alert that is not classified',\n }),\n ),\n user_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Caaring user the alert is about, and one of the two things that decide who may read it: this user always reads their own alerts. Null when the subject is a patient with no user account, in which case `patient_id` is the one that identifies them',\n }),\n ),\n patient_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Patient the alert is about, as the `id` of the `patient` CRF row of the project, and the other thing that decides who may read it: the professionals with access to that patient do. A patient may exist without a user account, so this is independent of `user_id`. It lives in the project database, so the column carries no foreign key and `project_id` is what says which database to read it from — an alert carrying it always carries a project',\n }),\n ),\n severity: Type.Optional(\n Type.Union([alertSeveritySchema, Type.Null()], { description: 'Severity of the alert. Null when not graded' }),\n ),\n status: Type.Optional(alertStatusSchema),\n title: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], { description: 'Short readable title' }),\n ),\n summary: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Longer readable description' })),\n emitter: alertEmitterSchema,\n recipients: Type.Optional(\n Type.Union([Type.Array(alertEntityRefSchema), Type.Null()], {\n description: 'Natural addressees of the alert. Null or empty when it has none',\n }),\n ),\n related_entities: Type.Optional(\n Type.Union([Type.Array(alertEntityRefSchema), Type.Null()], {\n description: 'Entities related to the alert without being addressees of it',\n }),\n ),\n payload: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Structured data that originated the alert (measured value, threshold, form answer…)',\n }),\n ),\n metadata: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Free extension point, so a new consumer does not need a schema change',\n }),\n ),\n dedup_key: Type.Optional(\n Type.String({\n maxLength: 255,\n description:\n 'Fingerprint used to avoid storing the same alert twice. A create carrying a key that is already open in the same scope answers with the stored alert; a resolved alert does not hold its key, so a condition that recurs after being dealt with raises a new one. Optional for the client: the server generates a UUID when it is absent, so the column always carries a usable value',\n }),\n ),\n triggered_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the event that originated the alert happened. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n viewed_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the alert was first viewed. Null while unseen. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n viewed_by: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who first viewed the alert' }),\n ),\n resolved_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the alert was resolved. Null while active. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n resolved_by: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who resolved the alert' }),\n ),\n resolution_note: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Optional note left when resolving the alert' }),\n ),\n created_user: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'User who created the alert, when a user did' }),\n ),\n created_at: Type.Optional(\n Type.String({\n description: `When the row was created. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n mod_time: Type.Optional(\n Type.String({\n description: `When the row was last modified. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n },\n { title: 'Alert', description: 'An alert and its state (ecosystem level)' },\n)\nexport type AlertData = Static<typeof alertSchema>\n\n// Written out rather than derived from `alertSchema`, for the same reason the action-system module\n// spells its request schemas out: an entity schema says what a row holds, a request schema says what\n// a client may send, and only the second can close itself. `Type.Omit` over an entity schema keeps\n// server-owned columns reachable through a body — here `status`, `resolved_*` and `viewed_*` are\n// absent because the server owns them, not because an `Omit` happened to remove them. Resolving\n// goes through its own endpoint; viewing is recorded by the read path.\nexport const createAlertSchema = Type.Object(\n {\n alert_type_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n user_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n patient_id: Type.Optional(Type.Union([Type.Number(), Type.Null()])),\n severity: Type.Optional(Type.Union([alertSeveritySchema, Type.Null()])),\n title: Type.Optional(Type.Union([Type.String({ maxLength: 255 }), Type.Null()])),\n summary: Type.Optional(Type.Union([Type.String(), Type.Null()])),\n emitter: alertEmitterSchema,\n recipients: Type.Optional(Type.Union([Type.Array(alertEntityRefSchema), Type.Null()])),\n related_entities: Type.Optional(Type.Union([Type.Array(alertEntityRefSchema), Type.Null()])),\n payload: Type.Optional(Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()])),\n metadata: Type.Optional(Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()])),\n dedup_key: Type.Optional(Type.String({ maxLength: 255 })),\n // `apiDateTime`, so the value reaches the service already a `Date` and no handler converts a\n // string by hand. The wrapped type is the same `format: 'date-time'` as before, so the 200s and\n // 400s of this field do not move — only what the service receives does.\n triggered_at: Type.Optional(\n Type.Union([apiDateTime, Type.Null()], {\n description: `When the event that originated the alert happened. RFC 3339 with a mandatory offset — \\`${API_DATETIME_EXAMPLE}\\` is the shape the API emits, so a value read from here can be sent straight back. ${API_DATETIME_ACCEPTED_NOTE}. Stored as UTC`,\n }),\n ),\n },\n { title: 'CreateAlert', description: 'Payload to create an alert', additionalProperties: false },\n)\n// `StaticDecode`, not `Static`: this type describes what a *handler receives*, and the handler\n// receives the decoded body — `triggered_at` is a `Date` there. `Static` resolves in the encode\n// direction, which is the string that travelled on the wire, so it would describe the value one\n// step earlier than the one this type is used for.\nexport type CreateAlertData = StaticDecode<typeof createAlertSchema>\n\n/**\n * The same payload as it travels on the wire, before the boundary decodes it: `triggered_at` is\n * still the RFC 3339 string a client sends.\n *\n * Only clients of the HTTP interface need this — tests that build a request body, and any caller\n * assembling JSON. Everything on the server side of the validator wants `CreateAlertData`, which is\n * the decoded shape.\n */\nexport type CreateAlertRequestBody = Static<typeof createAlertSchema>\n\n// `emitter` is `Type.Omit`-ted, not just made optional by `Type.Partial`: who raised the alert is\n// fixed at creation the same way `status`/`resolved_*`/`viewed_*` already are (see\n// `createAlertSchema` above) — a client rewriting it through a PATCH would falsify that provenance\n// for an entity that carries clinical data. `Type.Partial` alone would only make the key optional,\n// not absent, so it would still accept and apply a client-supplied `emitter`.\n// `Type.Partial` rebuilds the object and does NOT inherit `additionalProperties`, so it is restated.\nexport const updateAlertSchema = Type.Partial(Type.Omit(createAlertSchema, ['emitter']), {\n title: 'UpdateAlert',\n description: 'Payload to update an alert. Every field is optional. `emitter` cannot be changed after creation',\n additionalProperties: false,\n})\nexport type UpdateAlertData = StaticDecode<typeof updateAlertSchema>\n\n// Resolving is its own endpoint rather than a `status` field on the update: it is\n// the single transition of the lifecycle, and it writes three columns at once\n// (`status`, `resolved_at`, `resolved_by`) that must never disagree. A plain\n// `PATCH {status: 'resolved'}` would let a client set the state without the two\n// columns that say who closed it and when.\nexport const resolveAlertSchema = Type.Object(\n {\n resolution_note: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Optional note explaining the resolution' }),\n ),\n },\n { title: 'ResolveAlert', description: 'Payload to resolve an alert', additionalProperties: false },\n)\nexport type ResolveAlertData = Static<typeof resolveAlertSchema>\n\n// ── Action payloads ───────────────────────────────────────────────────\n// What an action of the action system carries. Published with the module, so the administration UI\n// builds its form from the very schema the execution validates against: which fields exist, which\n// are required and what values an enum takes are one definition.\n\n/**\n * Payload of the `alert.create` action — the create body as it is, `emitter` included: an action is\n * one more client of the endpoint, and nothing is filled in on its behalf. Configuring an action\n * without an emitter fails the same way a request without one does.\n */\nexport const createAlertActionSchema = createAlertSchema\nexport type CreateAlertActionData = CreateAlertData\n\n/**\n * Payload of the `alert.resolve` action: which alert, and the optional note.\n *\n * `id` is required here and absent from `resolveAlertSchema` because the endpoint takes it from the\n * URL and an action has none — it names the alert in its payload, typically `{{current.id}}`.\n */\nexport const resolveAlertActionSchema = Type.Object(\n {\n id: Type.Number({ description: 'Identifier of the alert to resolve' }),\n resolution_note: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Optional note explaining the resolution' }),\n ),\n },\n {\n title: 'ResolveAlertAction',\n description: 'Payload of the action that resolves an alert',\n additionalProperties: false,\n },\n)\nexport type ResolveAlertActionData = StaticDecode<typeof resolveAlertActionSchema>\n\n// Filters of the list endpoint, on top of the pagination query. Everything is\n// optional: with none of them the endpoint lists the project's alerts.\nexport const listAlertQuerySchema = Type.Object(\n {\n status: Type.Optional(alertStatusSchema),\n severity: Type.Optional(alertSeveritySchema),\n user_id: Type.Optional(Type.Number({ description: 'Filter by the user the alert is about' })),\n patient_id: Type.Optional(Type.Number({ description: 'Filter by the patient the alert is about' })),\n alert_type_id: Type.Optional(Type.Number({ description: 'Filter by the type of the alert' })),\n },\n { title: 'ListAlertQuery', description: 'Filters available on the alert list' },\n)\nexport type ListAlertQuery = Static<typeof listAlertQuerySchema>\n"],"names":[],"mappings":";;AAwBO,MAAM,cAAc;AAAA,EACzB,QAAQ;AAAA,EACR,UAAU;AACZ;AACO,MAAM,oBAAoB,KAAK,KAAK,OAAO,OAAO,WAAW,GAAG;AAAA,EACrE,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAGM,MAAM,gBAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,UAAU;AACZ;AACO,MAAM,sBAAsB,KAAK,KAAK,OAAO,OAAO,aAAa,GAAG;AAAA,EACzE,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAOM,MAAM,mBAAmB;AAAA,EAC9B,SAAS;AAAA,EACT,KAAK;AAAA,EACL,SAA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MAAM,CAAC,KAAK,OAAA,GAAU,KAAK,MAAM,GAAG,EAAE,aAAa,2CAA2C;AAAA,IAAA;AAAA,EACrG;AAAA,EAEF;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,sBAAsB;AAAA,EAAA;AAE1B;AAKO,MAAM,uBAAuB,KAAK;AAAA,EACvC;AAAA,IACE,QAAQ,KAAK,SAAS,iBAAiB;AAAA,IACvC,UAAU,KAAK,SAAS,mBAAmB;AAAA,IAC3C,SAAS,KAAK,SAAS,KAAK,OAAO,EAAE,aAAa,wCAAA,CAAyC,CAAC;AAAA,IAC5F,YAAY,KAAK,SAAS,KAAK,OAAO,EAAE,aAAa,2CAAA,CAA4C,CAAC;AAAA,IAClG,eAAe,KAAK,SAAS,KAAK,OAAO,EAAE,aAAa,mCAAmC,CAAC;AAAA,EAAA;AAAA,EAE9F,EAAE,OAAO,kBAAkB,aAAa,sCAAA;AAC1C;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiActionController.d.ts","sourceRoot":"","sources":["../../../../src/controllers/ApiActionController.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,kCAAkC,CAAA;AAI7D,OAAO,EACL,SAAS,EAKT,oBAAoB,EAGrB,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"ApiActionController.d.ts","sourceRoot":"","sources":["../../../../src/controllers/ApiActionController.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,kCAAkC,CAAA;AAI7D,OAAO,EACL,SAAS,EAKT,oBAAoB,EAGrB,MAAM,YAAY,CAAA;AAgBnB,iBAAe,WAAW,CACxB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,WAAW,CAAC,EAAE,oBAAoB,GACjC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAkG1B;AAED,QAAA,MAAM,mBAAmB;;CAExB,CAAA;AAED,eAAe,mBAAmB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-payload.test.d.ts","sourceRoot":"","sources":["../../../../src/helpers/action-payload.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TSchema } from 'typebox';
|
|
2
|
+
/**
|
|
3
|
+
* Turns the Handlebars-compiled payload of an action into the typed shape its schema declares, so
|
|
4
|
+
* the action receives values and not the strings every template renders.
|
|
5
|
+
*
|
|
6
|
+
* `Value.Check` runs before `Value.Decode` because the decode throws an error naming nothing, while
|
|
7
|
+
* `Value.Errors` names the field — and that message is what an administrator reads in `process_log`
|
|
8
|
+
* to find out why their action did not run.
|
|
9
|
+
*/
|
|
10
|
+
export declare function decodePayload<T>(schema: TSchema, compiled: Record<string, unknown>, keys: Record<string, unknown>, action: string): T;
|
|
11
|
+
//# sourceMappingURL=actionPayload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionPayload.d.ts","sourceRoot":"","sources":["../../../../src/helpers/actionPayload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AA6CtC;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,MAAM,GACb,CAAC,CAyBH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Displayer.d.ts","sourceRoot":"","sources":["../../../../../src/models/project/Displayer.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,eAAe,CAAA;AAYvC,OAAO,cAAc,EAAE,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAoBhF;;;GAGG;AAEH;;;;GAIG;AAEH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,oBAAoB,EAC/B,QAAQ,EAAE,MAAM,EAChB,WAAW,UAAQ,EACnB,UAAU,CAAC,EAAE,GAAG,EAAE,OAixBnB;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,cAAc,EACnB,gBAAgB,CAAC,EAAE,MAAM,EACzB,WAAW,UAAQ,EACnB,UAAU,CAAC,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"Displayer.d.ts","sourceRoot":"","sources":["../../../../../src/models/project/Displayer.ts"],"names":[],"mappings":"AAIA,OAAO,WAAW,MAAM,eAAe,CAAA;AAYvC,OAAO,cAAc,EAAE,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAoBhF;;;GAGG;AAEH;;;;GAIG;AAEH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,oBAAoB,EAC/B,QAAQ,EAAE,MAAM,EAChB,WAAW,UAAQ,EACnB,UAAU,CAAC,EAAE,GAAG,EAAE,OAixBnB;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,cAAc,EACnB,gBAAgB,CAAC,EAAE,MAAM,EACzB,WAAW,UAAQ,EACnB,UAAU,CAAC,EAAE,WAAW,EAAE,OAwG3B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Answers whether the column a condition names is stored encrypted. */
|
|
2
|
+
type IsEncryptedColumn = (column: string) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Rewrites, in place, every condition of a query that reads an encrypted column so that it reads
|
|
5
|
+
* the decrypted value instead.
|
|
6
|
+
*
|
|
7
|
+
* **Why in place, and not by replacing the operation.** An encrypted condition can sit inside a
|
|
8
|
+
* nested `AND`/`OR` group. Removing it and appending a `whereRaw` would move it to whichever
|
|
9
|
+
* builder is being visited, changing which group it belongs to — and with it the boolean meaning of
|
|
10
|
+
* the filter. Swapping the operand leaves the condition exactly where the caller put it.
|
|
11
|
+
*
|
|
12
|
+
* **Why it recurses through callbacks.** A nested group reaches `onBuild` as a single operation
|
|
13
|
+
* whose only argument is a function; its conditions do not exist yet. Wrapping that callback is
|
|
14
|
+
* what lets the rewrite reach them, at any depth, when the group is finally built. The wrapper is
|
|
15
|
+
* installed once per operation, so building the same query twice does not stack wrappers, and the
|
|
16
|
+
* rewrite itself is idempotent: a column already swapped for its decrypted expression no longer
|
|
17
|
+
* looks like a column name.
|
|
18
|
+
*/
|
|
19
|
+
export declare function rewriteEncryptedConditions(builder: any, isEncryptedColumn: IsEncryptedColumn): void;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=encrypted-conditions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encrypted-conditions.d.ts","sourceRoot":"","sources":["../../../../../src/models/project/encrypted-conditions.ts"],"names":[],"mappings":"AAKA,wEAAwE;AACxE,KAAK,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAA;AAwHpD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,GAAG,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAmDnG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encrypted-conditions.test.d.ts","sourceRoot":"","sources":["../../../../../src/models/project/encrypted-conditions.test.ts"],"names":[],"mappings":""}
|
|
@@ -8,7 +8,9 @@ export declare enum ApiAction {
|
|
|
8
8
|
EXTERNAL_API_CALL = "external_api_call",
|
|
9
9
|
LOG_CREATE = "log.create",
|
|
10
10
|
BULK_UPLOAD_UPDATE = "bulk_upload.update",
|
|
11
|
-
INVOKE_LAMBDA = "invoke_lambda"
|
|
11
|
+
INVOKE_LAMBDA = "invoke_lambda",
|
|
12
|
+
ALERT_CREATE = "alert.create",
|
|
13
|
+
ALERT_RESOLVE = "alert.resolve"
|
|
12
14
|
}
|
|
13
15
|
export type NotifiedAboutType = `model_${ModelName}` | `model_displayer_${ModelName}` | `model_${ModelName}_${TriggerAction}` | `model_displayer_${ModelName}_${TriggerAction}`;
|
|
14
16
|
export interface CreateTriggerPayload {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/schemas/notification_configuration/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,mCAAmC,CAAA;AAE3F,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B,oBAAY,SAAS;IACnB,oBAAoB,yBAAyB;IAC7C,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,iBAAiB,sBAAsB;IACvC,UAAU,eAAe;IACzB,kBAAkB,uBAAuB;IACzC,aAAa,kBAAkB;CAChC;AAED,MAAM,MAAM,iBAAiB,GACzB,SAAS,SAAS,EAAE,GACpB,mBAAmB,SAAS,EAAE,GAC9B,SAAS,SAAS,IAAI,aAAa,EAAE,GACrC,mBAAmB,SAAS,IAAI,aAAa,EAAE,CAAA;AAEnD,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,iBAAiB,CAAA;IACjC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,6BAA6B,CAAA;CAC9C;AAED,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;AAEhE,MAAM,WAAW,mBAAmB;IAClC,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAAA;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,UAAU,EAAE,CAAA;IAClB,EAAE,CAAC,EAAE,UAAU,EAAE,CAAA;IACjB,GAAG,CAAC,EAAE,UAAU,EAAE,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;CACZ;AAED,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;IACb,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,WAAW,gBAAgB;IAC3B,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,4BAA4B,CAAA;IAClC,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACrD,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,kBAAkB,EAAE,CAAA;IAC5B,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAA;IACjC,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAA;IAChD,YAAY,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,EAAE,CAAA;IAC9E,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC7C"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/schemas/notification_configuration/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAoB,MAAM,mCAAmC,CAAA;AAE3F,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B,oBAAY,SAAS;IACnB,oBAAoB,yBAAyB;IAC7C,UAAU,e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KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,kBAAkB,EAAE,CAAA;IAC5B,SAAS,CAAC,EAAE,mBAAmB,EAAE,CAAA;IACjC,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAA;IAChD,YAAY,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,EAAE,CAAA;IAC9E,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC7C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as RequestContext } from '../../../../../models/request/RequestContext';
|
|
2
|
-
import { ApiActionContextData } from '../../../../../schemas/api_action
|
|
2
|
+
import { ApiActionContextData } from '../../../../../schemas/api_action';
|
|
3
3
|
import { EvaluableTrigger, TriggerBatch, TriggerExecutionResult, TriggerRelations, TriggerSource } from '../action-system.schema';
|
|
4
4
|
import { PatientCache } from '../action-system.helper';
|
|
5
5
|
/**
|
|
@@ -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,
|
|
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,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AM,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"}
|
package/dist/src/v2/modules/ecosystem/alert/{alert.helper.d.ts → alert.helper/alert.helper.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryBuilder } from 'objection';
|
|
2
|
-
import { default as RequestContext } from '
|
|
3
|
-
import { Alert } from '
|
|
2
|
+
import { default as RequestContext } from '../../../../../models/request/RequestContext';
|
|
3
|
+
import { Alert } from '../alert.model';
|
|
4
4
|
/**
|
|
5
5
|
* Permission preHandler of the write endpoints of this module (create, update, resolve). Reads go
|
|
6
6
|
* through `resolveAlertReadScope` instead, which narrows what is returned rather than refusing.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.helper.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.helper/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,gBAAgB,CAAA;AAEtC;;;;;;;;;;;;;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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.helper.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.helper/alert.helper.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/alert/alert.helper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5F,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -132,6 +132,49 @@ export declare const resolveAlertSchema: Type.TObject<{
|
|
|
132
132
|
resolution_note: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
133
133
|
}>;
|
|
134
134
|
export type ResolveAlertData = Static<typeof resolveAlertSchema>;
|
|
135
|
+
/**
|
|
136
|
+
* Payload of the `alert.create` action — the create body as it is, `emitter` included: an action is
|
|
137
|
+
* one more client of the endpoint, and nothing is filled in on its behalf. Configuring an action
|
|
138
|
+
* without an emitter fails the same way a request without one does.
|
|
139
|
+
*/
|
|
140
|
+
export declare const createAlertActionSchema: Type.TObject<{
|
|
141
|
+
alert_type_id: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
|
|
142
|
+
user_id: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
|
|
143
|
+
patient_id: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
|
|
144
|
+
severity: Type.TOptional<Type.TUnion<[Type.TEnum<("info" | "low" | "medium" | "high" | "critical")[]>, Type.TNull]>>;
|
|
145
|
+
title: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
146
|
+
summary: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
147
|
+
emitter: Type.TObject<{
|
|
148
|
+
type: Type.TEnum<("trigger" | "api" | "webhook")[]>;
|
|
149
|
+
id: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
150
|
+
name: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
151
|
+
reference: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
152
|
+
}>;
|
|
153
|
+
recipients: Type.TOptional<Type.TUnion<[Type.TArray<Type.TObject<{
|
|
154
|
+
type: Type.TString;
|
|
155
|
+
value: Type.TString;
|
|
156
|
+
}>>, Type.TNull]>>;
|
|
157
|
+
related_entities: Type.TOptional<Type.TUnion<[Type.TArray<Type.TObject<{
|
|
158
|
+
type: Type.TString;
|
|
159
|
+
value: Type.TString;
|
|
160
|
+
}>>, Type.TNull]>>;
|
|
161
|
+
payload: Type.TOptional<Type.TUnion<[Type.TRecord<"^.*$", Type.TUnknown>, Type.TNull]>>;
|
|
162
|
+
metadata: Type.TOptional<Type.TUnion<[Type.TRecord<"^.*$", Type.TUnknown>, Type.TNull]>>;
|
|
163
|
+
dedup_key: Type.TOptional<Type.TString>;
|
|
164
|
+
triggered_at: Type.TOptional<Type.TUnion<[Type.TCodec<Type.TString, Date>, Type.TNull]>>;
|
|
165
|
+
}>;
|
|
166
|
+
export type CreateAlertActionData = CreateAlertData;
|
|
167
|
+
/**
|
|
168
|
+
* Payload of the `alert.resolve` action: which alert, and the optional note.
|
|
169
|
+
*
|
|
170
|
+
* `id` is required here and absent from `resolveAlertSchema` because the endpoint takes it from the
|
|
171
|
+
* URL and an action has none — it names the alert in its payload, typically `{{current.id}}`.
|
|
172
|
+
*/
|
|
173
|
+
export declare const resolveAlertActionSchema: Type.TObject<{
|
|
174
|
+
id: Type.TNumber;
|
|
175
|
+
resolution_note: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
|
|
176
|
+
}>;
|
|
177
|
+
export type ResolveAlertActionData = StaticDecode<typeof resolveAlertActionSchema>;
|
|
135
178
|
export declare const listAlertQuerySchema: Type.TObject<{
|
|
136
179
|
status: Type.TOptional<Type.TEnum<("active" | "resolved")[]>>;
|
|
137
180
|
severity: Type.TOptional<Type.TEnum<("info" | "low" | "medium" | "high" | "critical")[]>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.schema.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/alert/alert.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAwBpD,eAAO,MAAM,WAAW;;;CAGd,CAAA;AACV,eAAO,MAAM,iBAAiB,uCAG5B,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE1D,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAA;AACV,eAAO,MAAM,mBAAmB,iEAG9B,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAM9D,eAAO,MAAM,gBAAgB;;;;CAInB,CAAA;AACV,eAAO,MAAM,sBAAsB,+CAGjC,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAIpE,eAAO,MAAM,kBAAkB;;;;;EAoB9B,CAAA;AACD,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAUhE,eAAO,MAAM,oBAAoB;;;EAUhC,CAAA;AACD,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,C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AAC,CAAA"}
|
|
@@ -4,5 +4,6 @@ export { Alert } from './alert.model';
|
|
|
4
4
|
export { AlertController } from './alert.controller';
|
|
5
5
|
export { requireAlertsManagement, resolveAlertReadScope, scopedQuery } from './alert.helper';
|
|
6
6
|
export { AlertStatus, AlertSeverity, AlertEmitterType } from './alert.schema';
|
|
7
|
-
export
|
|
7
|
+
export { createAlertActionSchema, resolveAlertActionSchema } from './alert.schema';
|
|
8
|
+
export type { AlertData, AlertEmitterData, AlertEntityRefData, CreateAlertData, CreateAlertRequestBody, UpdateAlertData, CreateAlertActionData, ResolveAlertActionData, } from './alert.schema';
|
|
8
9
|
//# 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,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,
|
|
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,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAClF,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonlogic-to-sql.helper.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/global/jsonlogic-to-sql/jsonlogic-to-sql.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAA8B,MAAM,WAAW,CAAA;AAKvF,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;AACrD,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,SAAS,EAAE,GAAG;IAAE,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAEjF,KAAK,EAAE,GAAG,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;AAEtC,KAAK,cAAc,GAAG;IACpB,EAAE,EAAE,EAAE,CAAA;IACN,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,CAAA;CACzB,CAAA;AAED,KAAK,eAAe,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,IAAI,CAAA;AAsCvE,wBAAgB,WAAW,CAAC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,CAAC,MAAM;IAKd,OAAO,CAAC,qBAAqB;IA2J7B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,iBAAiB;CAsE1B"}
|
package/dist/v1/perseed-api.cjs
CHANGED
|
@@ -1340,6 +1340,8 @@ var ApiAction = /* @__PURE__ */ ((ApiAction2) => {
|
|
|
1340
1340
|
ApiAction2["LOG_CREATE"] = "log.create";
|
|
1341
1341
|
ApiAction2["BULK_UPLOAD_UPDATE"] = "bulk_upload.update";
|
|
1342
1342
|
ApiAction2["INVOKE_LAMBDA"] = "invoke_lambda";
|
|
1343
|
+
ApiAction2["ALERT_CREATE"] = "alert.create";
|
|
1344
|
+
ApiAction2["ALERT_RESOLVE"] = "alert.resolve";
|
|
1343
1345
|
return ApiAction2;
|
|
1344
1346
|
})(ApiAction || {});
|
|
1345
1347
|
const TriggerAction = {
|