@persei/perseed-api 5.0.24 → 5.0.25

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.
@@ -147,25 +147,6 @@ const processLogSchema = typebox.Type.Object(
147
147
  description: "Id of this row's parent process_log row, when it has one"
148
148
  })
149
149
  ),
150
- // `subject_*` vs `related_*` (both #348, see README.md "`related_*` vs `subject_*`"):
151
- // `related_model`/`related_id` above name the row's own subject — the trigger or the action the
152
- // row is about. `subject_model`/`subject_id` name the domain entity that originated the
153
- // execution (a patient, a form...), so "what triggers ran from this entity" can be answered by
154
- // filtering on them. A `trigger_action` row inherits the same subject as the `trigger_evaluation`
155
- // row of the trigger that ran it — it is the batch's subject, not the action's own. Optional/
156
- // nullable for the same two reasons as `parent_id`: most rows have none (there may be no
157
- // resolvable subject for a batch, or the row predates this column), and the column is applied
158
- // out of band per ecosystem, so it may be entirely absent from a given row's database.
159
- subject_model: typebox.Type.Optional(
160
- typebox.Type.Union([typebox.Type.String({ maxLength: 255 }), typebox.Type.Null()], {
161
- description: "Domain entity kind that originated the execution (e.g. patient), when resolvable"
162
- })
163
- ),
164
- subject_id: typebox.Type.Optional(
165
- typebox.Type.Union([typebox.Type.String({ maxLength: 255 }), typebox.Type.Null()], {
166
- description: "Id of the domain entity that originated the execution, as a string, when resolvable"
167
- })
168
- ),
169
150
  expires_at: typebox.Type.Optional(
170
151
  typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()], {
171
152
  description: `Retention deadline; the row is purged after it, and never expires when null. ${dates_schema.EMITTED_DATETIME_NOTE}`,
@@ -194,12 +175,6 @@ const listProcessLogQuerySchema = typebox.Type.Object(
194
175
  related_model: typebox.Type.Optional(typebox.Type.String({ description: "Filter by the related entity kind" })),
195
176
  related_id: typebox.Type.Optional(typebox.Type.String({ description: "Filter by the id of the related entity" })),
196
177
  parent_id: typebox.Type.Optional(typebox.Type.Number({ description: "Filter by the id of the parent process_log row" })),
197
- subject_model: typebox.Type.Optional(
198
- typebox.Type.String({ description: "Filter by the domain entity kind that originated the execution" })
199
- ),
200
- subject_id: typebox.Type.Optional(
201
- typebox.Type.String({ description: "Filter by the id of the domain entity that originated the execution" })
202
- ),
203
178
  requires_attention: typebox.Type.Optional(typebox.Type.Boolean({ description: "Filter by whether the row needs review" })),
204
179
  reviewed: typebox.Type.Optional(typebox.Type.Boolean({ description: "Filter by whether the row has been reviewed" })),
205
180
  // `apiDateTime`, not a bare string: it carries `format: 'date-time'`, so a malformed value is
@@ -1 +1 @@
1
- {"version":3,"file":"ecosystem-process-log.cjs","sources":["../../src/v2/modules/ecosystem/process-log/process-log.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 place where `no-restricted-imports` has to give way, hence the disable.\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 in `@v1/log/debug` and, transitively, the server dependencies behind it; bundling that\n// fails, and it fails naming a transitive JSON file (`ent/reversed.json: Could not parse JSON\n// file`) rather than the import that dragged it in, so the message points nowhere near the cause.\n//\n// `global/dates`'s own `lib.ts` sidesteps the same barrel for the same reason. The alternative —\n// inlining the two description constants — would duplicate the wording the whole API documents its\n// datetimes with, and let this module's copy drift from it silently.\n// eslint-disable-next-line no-restricted-imports\nimport {\n EMITTED_DATETIME_NOTE,\n API_DATETIME_EXAMPLE,\n API_DATETIME_ACCEPTED_NOTE,\n apiDateTime,\n} from '@/modules/global/dates/dates.schema'\n\n// `process_log` is the ecosystem-wide execution log (see README.md): rows written by the trigger\n// engine, the actions it runs and the v1 bulk upload. This module owns the schema for the whole\n// table, not only the trigger-engine rows — `code` is what tells them apart.\n\n// ── ProcessLogType (severity, NOT layout) ───────────────────────────────\n// Mirrors the v1 enum (`src/schemas/process_log/types.ts`) verbatim: it already ships on the wire\n// (`type` column) and changing its numeric values would be a breaking change for every existing row\n// and consumer. Restated here as a TypeBox schema — not imported from v1 — because `lib.ts` may\n// only export pure TypeBox (see below); v1 has no schema module of its own to import from.\nexport const ProcessLogType = {\n LOG: 0,\n RESULT: 1,\n WARNING: -1,\n ERROR: -2,\n} as const\nexport const processLogTypeSchema = Type.Enum(Object.values(ProcessLogType), {\n title: 'ProcessLogType',\n description: 'Severity of the log row (not a layout/kind marker): LOG, RESULT, WARNING or ERROR',\n})\nexport type ProcessLogType = Static<typeof processLogTypeSchema>\n\n// ── ProcessLogCode ───────────────────────────────────────────────────────\n//\n// Canonical enum now lives HERE (v2), not in `src/schemas/process_log/types.ts` (v1).\n//\n// Why: this module (`process-log`) is the one being extended with the trigger-engine codes as part\n// of #348, it already owns the model/service half of `process_log`, and every v2 consumer that needs\n// a *typed* extra_data contract (this schema file) has to sit next to the code enum it is keyed by.\n// The two v1 importers (`BulkUploadController.ts` and `IntrospectionController.ts`) import it from\n// here rather than from `@v1/schemas`, which keeps one enum instead of two that could drift. v1's\n// `types.ts` deliberately does NOT re-export the value: doing so closes the cycle `@v1/schemas` →\n// this module's barrel → `process-log.model.ts` → `@v1/schemas`, under which the enum resolves to\n// `undefined` at runtime. It keeps an `import type` only, which is erased at compile time.\nexport const ProcessLogCode = {\n BULK_UPLOAD_BATCH: 'bulk_upload_batch',\n BULK_UPLOAD_SUCCESS: 'bulk_upload_success',\n BULK_UPLOAD_ERROR: 'bulk_upload_error',\n // Trigger engine (#348). Written by `TriggerEngineService` (`action-system` module): one\n // `TRIGGER_EVALUATION` row per trigger evaluated, one `TRIGGER_ACTION` row per action it ran, and a\n // `TRIGGER_ERROR` row when a trigger's evaluation throws.\n TRIGGER_EVALUATION: 'trigger_evaluation',\n TRIGGER_ERROR: 'trigger_error',\n TRIGGER_ACTION: 'trigger_action',\n} as const\nexport const processLogCodeSchema = Type.Enum(Object.values(ProcessLogCode), {\n title: 'ProcessLogCode',\n description: 'What kind of event a process_log row records, and what shape its extra_data takes',\n})\nexport type ProcessLogCode = Static<typeof processLogCodeSchema>\n\n// ── extra_data shapes, one per trigger-engine code ───────────────────────\n// Bulk upload codes carry no typed extra_data today (nothing writes them yet outside the\n// filter-by-code reads in `BulkUploadController.ts`), so they are left out of the discriminated\n// union below rather than given a placeholder shape that no writer populates.\n\nexport const triggerEvaluationExtraDataSchema = Type.Object(\n {\n source: Type.String({ description: 'What fired the event: a model row or a displayer/form save' }),\n target: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Model/displayer name the trigger is bound to' }),\n ),\n operation: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'create/update/delete that fired the event' }),\n ),\n matched: Type.Boolean({ description: 'Whether the trigger conditions matched' }),\n conditions: Type.Optional(\n Type.Union([Type.Unknown(), Type.Null()], {\n description: 'jsonLogic conditions the trigger was configured with',\n }),\n ),\n relations: Type.Optional(\n Type.Union([Type.Unknown(), Type.Null()], {\n description: 'Relations the trigger declared to load onto `current`',\n }),\n ),\n relationsSkipped: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: 'Reason a declared relation could not be loaded, when one was skipped',\n }),\n ),\n },\n {\n title: 'TriggerEvaluationExtraData',\n description:\n 'extra_data of a `trigger_evaluation` row — how a trigger resolved, never the entity data it resolved against',\n additionalProperties: false,\n },\n)\nexport type TriggerEvaluationExtraData = Static<typeof triggerEvaluationExtraDataSchema>\n\nexport const triggerErrorExtraDataSchema = Type.Object(\n { error: Type.String({ description: 'String representation of the exception the trigger evaluation threw' }) },\n { title: 'TriggerErrorExtraData', description: 'extra_data of a `trigger_error` row', additionalProperties: false },\n)\nexport type TriggerErrorExtraData = Static<typeof triggerErrorExtraDataSchema>\n\nexport const triggerActionExtraDataSchema = Type.Object(\n {\n actionId: Type.Number({ description: 'id of the action row that ran' }),\n triggerId: Type.Number({ description: 'id of the trigger that ran this action' }),\n // Needed because the engine is shared: `triggerId` alone is ambiguous, since automatic and\n // manual triggers are different tables (`automatic_trigger`, `manual_trigger`) with overlapping\n // id ranges. Paired with `triggerId` this is what a consumer needs to resolve the trigger row.\n triggerModel: Type.String({ description: 'Table the trigger belongs to (automatic_trigger or manual_trigger)' }),\n executionOrder: Type.Number({ description: 'Order of this action within the trigger' }),\n type: Type.String({ description: 'Type of the action (e.g. ApiAction)' }),\n validation: Type.Unknown({ description: 'Result of validating the action context before running it' }),\n // `ok`/`output` describe an action that ran; `aborted`/`reason` an action that never did,\n // because validating its context failed (`resolveActionOutcome`). The two pairs are mutually\n // exclusive in practice but declared as four optionals rather than a union: `additionalProperties:\n // false` is what makes this schema worth having, and a row whose outcome keys are undeclared is\n // one the debugging popup cannot show a reason for — which is exactly the aborted case.\n ok: Type.Optional(Type.Union([Type.Boolean(), Type.Null()], { description: 'Whether the action call succeeded' })),\n output: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Failure output, when the action ran and failed' }),\n ),\n aborted: Type.Optional(Type.Boolean({ description: 'True when the action never ran' })),\n reason: Type.Optional(Type.String({ description: 'Why the action was aborted, e.g. context_validation' })),\n },\n { title: 'TriggerActionExtraData', description: 'extra_data of a `trigger_action` row', additionalProperties: false },\n)\nexport type TriggerActionExtraData = Static<typeof triggerActionExtraDataSchema>\n\n// Discriminated (by `code`) union tying each trigger-engine code to its extra_data shape. Usable\n// both to validate a row being created and to type one being read. Bulk upload codes are\n// deliberately absent (see comment above the individual schemas).\nexport const processLogTriggerEngineExtraDataSchema = Type.Union(\n [\n Type.Object({\n code: Type.Literal(ProcessLogCode.TRIGGER_EVALUATION),\n extra_data: triggerEvaluationExtraDataSchema,\n }),\n Type.Object({ code: Type.Literal(ProcessLogCode.TRIGGER_ERROR), extra_data: triggerErrorExtraDataSchema }),\n Type.Object({ code: Type.Literal(ProcessLogCode.TRIGGER_ACTION), extra_data: triggerActionExtraDataSchema }),\n ],\n {\n title: 'ProcessLogTriggerEngineExtraData',\n description: 'Ties each trigger-engine `code` to the shape its `extra_data` takes',\n },\n)\nexport type ProcessLogTriggerEngineExtraData = Static<typeof processLogTriggerEngineExtraDataSchema>\n\n// ── process_log entity ────────────────────────────────────────────────────\n// Full row shape, for the read side of the (still to be implemented) list endpoint. `extra_data` is\n// left as a free record here — a response schema describes what every row of the table can hold,\n// including the untyped bulk_upload rows, unlike `processLogTriggerEngineExtraDataSchema` above\n// which narrows by `code` for a writer/reader that already knows it is on the trigger-engine path.\nexport const processLogSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the row' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'Project this row belongs to, when scoped to one' }),\n ),\n created_user: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'User who caused the row to be written, when a user did',\n }),\n ),\n related_model: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], { description: 'Table/entity kind the row is about' }),\n ),\n related_id: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Id of the related entity, as a string',\n }),\n ),\n code: Type.Optional(Type.Union([processLogCodeSchema, Type.Null()])),\n log: Type.String({ description: 'Short human-readable message' }),\n long_log: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Extended message, when needed' })),\n extra_data: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Structured data specific to `code` — see the per-code schemas for the trigger-engine codes',\n }),\n ),\n type: processLogTypeSchema,\n requires_attention: Type.Optional(Type.Boolean({ description: 'Whether the row needs a human to review it' })),\n reviewed: Type.Optional(Type.Boolean({ description: 'Whether the row has been reviewed' })),\n reviewed_date: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the row was reviewed. Null while unreviewed. ${EMITTED_DATETIME_NOTE}`,\n }),\n ),\n // Correlation to a parent row (#348): a `trigger_action` row's parent is the `trigger_evaluation`\n // (or `trigger_error`) row of the trigger that ran it, so an action's trace can always be walked\n // back to the evaluation that triggered it. Optional/nullable because most rows (bulk upload,\n // the trigger-evaluation row itself) have no parent, and because the column is applied out of\n // band per ecosystem — see README.md — so it may be entirely absent from a given row's database.\n parent_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: \"Id of this row's parent process_log row, when it has one\",\n }),\n ),\n // `subject_*` vs `related_*` (both #348, see README.md \"`related_*` vs `subject_*`\"):\n // `related_model`/`related_id` above name the row's own subject — the trigger or the action the\n // row is about. `subject_model`/`subject_id` name the domain entity that originated the\n // execution (a patient, a form...), so \"what triggers ran from this entity\" can be answered by\n // filtering on them. A `trigger_action` row inherits the same subject as the `trigger_evaluation`\n // row of the trigger that ran it — it is the batch's subject, not the action's own. Optional/\n // nullable for the same two reasons as `parent_id`: most rows have none (there may be no\n // resolvable subject for a batch, or the row predates this column), and the column is applied\n // out of band per ecosystem, so it may be entirely absent from a given row's database.\n subject_model: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Domain entity kind that originated the execution (e.g. patient), when resolvable',\n }),\n ),\n subject_id: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Id of the domain entity that originated the execution, as a string, when resolvable',\n }),\n ),\n expires_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `Retention deadline; the row is purged after it, and never expires when null. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\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: 'ProcessLog', description: 'A process_log row' },\n)\nexport type ProcessLogData = Static<typeof processLogSchema>\n\n// ── list query filters ────────────────────────────────────────────────────\n// Filters of the (upcoming) list endpoint, on top of the pagination query — see `alert.schema.ts`\n// `listAlertQuerySchema` for the sibling precedent. Everything is optional: with none of them the\n// endpoint lists everything in scope. Exported for the endpoint (implemented separately) to consume.\nexport const listProcessLogQuerySchema = Type.Object(\n {\n code: Type.Optional(processLogCodeSchema),\n type: Type.Optional(processLogTypeSchema),\n related_model: Type.Optional(Type.String({ description: 'Filter by the related entity kind' })),\n related_id: Type.Optional(Type.String({ description: 'Filter by the id of the related entity' })),\n parent_id: Type.Optional(Type.Number({ description: 'Filter by the id of the parent process_log row' })),\n subject_model: Type.Optional(\n Type.String({ description: 'Filter by the domain entity kind that originated the execution' }),\n ),\n subject_id: Type.Optional(\n Type.String({ description: 'Filter by the id of the domain entity that originated the execution' }),\n ),\n requires_attention: Type.Optional(Type.Boolean({ description: 'Filter by whether the row needs review' })),\n reviewed: Type.Optional(Type.Boolean({ description: 'Filter by whether the row has been reviewed' })),\n // `apiDateTime`, not a bare string: it carries `format: 'date-time'`, so a malformed value is\n // rejected by the validator as a 400. A plain `Type.String` accepts anything and hands it to\n // `getMySQLDateTime(value, true)`, which throws a `PublicApiError` with no `statusCode` — a 500\n // for what is a bad request. Same type `alert.schema.ts` uses for its datetime fields.\n created_from: Type.Optional(\n Type.Union([apiDateTime], {\n description: `Only rows created at or after this instant. ${API_DATETIME_ACCEPTED_NOTE}. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n created_to: Type.Optional(\n Type.Union([apiDateTime], {\n description: `Only rows created at or before this instant. ${API_DATETIME_ACCEPTED_NOTE}. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n },\n { title: 'ListProcessLogQuery', description: 'Filters available on the process_log list' },\n)\n// `StaticDecode`, not `Static`: this type describes what the *handler receives*, and the two date\n// bounds carry `apiDateTime`, so they arrive decoded to a `Date`. `Static` would type them as the\n// strings the client sent and the service would format something it never gets.\nexport type ListProcessLogQuery = StaticDecode<typeof listProcessLogQuerySchema>\n"],"names":["Type","EMITTED_DATETIME_NOTE","API_DATETIME_EXAMPLE","apiDateTime","API_DATETIME_ACCEPTED_NOTE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CAChC;AAAA,IAAA;AAAA,EACH;AAAA,EAEF,EAAE,OAAO,uBAAuB,aAAa,4CAAA;AAC/C;;;;;;;;;;;"}
1
+ {"version":3,"file":"ecosystem-process-log.cjs","sources":["../../src/v2/modules/ecosystem/process-log/process-log.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 place where `no-restricted-imports` has to give way, hence the disable.\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 in `@v1/log/debug` and, transitively, the server dependencies behind it; bundling that\n// fails, and it fails naming a transitive JSON file (`ent/reversed.json: Could not parse JSON\n// file`) rather than the import that dragged it in, so the message points nowhere near the cause.\n//\n// `global/dates`'s own `lib.ts` sidesteps the same barrel for the same reason. The alternative —\n// inlining the two description constants — would duplicate the wording the whole API documents its\n// datetimes with, and let this module's copy drift from it silently.\n// eslint-disable-next-line no-restricted-imports\nimport {\n EMITTED_DATETIME_NOTE,\n API_DATETIME_EXAMPLE,\n API_DATETIME_ACCEPTED_NOTE,\n apiDateTime,\n} from '@/modules/global/dates/dates.schema'\n\n// `process_log` is the ecosystem-wide execution log (see README.md): rows written by the trigger\n// engine, the actions it runs and the v1 bulk upload. This module owns the schema for the whole\n// table, not only the trigger-engine rows — `code` is what tells them apart.\n\n// ── ProcessLogType (severity, NOT layout) ───────────────────────────────\n// Mirrors the v1 enum (`src/schemas/process_log/types.ts`) verbatim: it already ships on the wire\n// (`type` column) and changing its numeric values would be a breaking change for every existing row\n// and consumer. Restated here as a TypeBox schema — not imported from v1 — because `lib.ts` may\n// only export pure TypeBox (see below); v1 has no schema module of its own to import from.\nexport const ProcessLogType = {\n LOG: 0,\n RESULT: 1,\n WARNING: -1,\n ERROR: -2,\n} as const\nexport const processLogTypeSchema = Type.Enum(Object.values(ProcessLogType), {\n title: 'ProcessLogType',\n description: 'Severity of the log row (not a layout/kind marker): LOG, RESULT, WARNING or ERROR',\n})\nexport type ProcessLogType = Static<typeof processLogTypeSchema>\n\n// ── ProcessLogCode ───────────────────────────────────────────────────────\n//\n// Canonical enum now lives HERE (v2), not in `src/schemas/process_log/types.ts` (v1).\n//\n// Why: this module (`process-log`) is the one being extended with the trigger-engine codes as part\n// of #348, it already owns the model/service half of `process_log`, and every v2 consumer that needs\n// a *typed* extra_data contract (this schema file) has to sit next to the code enum it is keyed by.\n// The two v1 importers (`BulkUploadController.ts` and `IntrospectionController.ts`) import it from\n// here rather than from `@v1/schemas`, which keeps one enum instead of two that could drift. v1's\n// `types.ts` deliberately does NOT re-export the value: doing so closes the cycle `@v1/schemas` →\n// this module's barrel → `process-log.model.ts` → `@v1/schemas`, under which the enum resolves to\n// `undefined` at runtime. It keeps an `import type` only, which is erased at compile time.\nexport const ProcessLogCode = {\n BULK_UPLOAD_BATCH: 'bulk_upload_batch',\n BULK_UPLOAD_SUCCESS: 'bulk_upload_success',\n BULK_UPLOAD_ERROR: 'bulk_upload_error',\n // Trigger engine (#348). Written by `TriggerEngineService` (`action-system` module): one\n // `TRIGGER_EVALUATION` row per trigger evaluated, one `TRIGGER_ACTION` row per action it ran, and a\n // `TRIGGER_ERROR` row when a trigger's evaluation throws.\n TRIGGER_EVALUATION: 'trigger_evaluation',\n TRIGGER_ERROR: 'trigger_error',\n TRIGGER_ACTION: 'trigger_action',\n} as const\nexport const processLogCodeSchema = Type.Enum(Object.values(ProcessLogCode), {\n title: 'ProcessLogCode',\n description: 'What kind of event a process_log row records, and what shape its extra_data takes',\n})\nexport type ProcessLogCode = Static<typeof processLogCodeSchema>\n\n// ── extra_data shapes, one per trigger-engine code ───────────────────────\n// Bulk upload codes carry no typed extra_data today (nothing writes them yet outside the\n// filter-by-code reads in `BulkUploadController.ts`), so they are left out of the discriminated\n// union below rather than given a placeholder shape that no writer populates.\n\nexport const triggerEvaluationExtraDataSchema = Type.Object(\n {\n source: Type.String({ description: 'What fired the event: a model row or a displayer/form save' }),\n target: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Model/displayer name the trigger is bound to' }),\n ),\n operation: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'create/update/delete that fired the event' }),\n ),\n matched: Type.Boolean({ description: 'Whether the trigger conditions matched' }),\n conditions: Type.Optional(\n Type.Union([Type.Unknown(), Type.Null()], {\n description: 'jsonLogic conditions the trigger was configured with',\n }),\n ),\n relations: Type.Optional(\n Type.Union([Type.Unknown(), Type.Null()], {\n description: 'Relations the trigger declared to load onto `current`',\n }),\n ),\n relationsSkipped: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: 'Reason a declared relation could not be loaded, when one was skipped',\n }),\n ),\n },\n {\n title: 'TriggerEvaluationExtraData',\n description:\n 'extra_data of a `trigger_evaluation` row — how a trigger resolved, never the entity data it resolved against',\n additionalProperties: false,\n },\n)\nexport type TriggerEvaluationExtraData = Static<typeof triggerEvaluationExtraDataSchema>\n\nexport const triggerErrorExtraDataSchema = Type.Object(\n { error: Type.String({ description: 'String representation of the exception the trigger evaluation threw' }) },\n { title: 'TriggerErrorExtraData', description: 'extra_data of a `trigger_error` row', additionalProperties: false },\n)\nexport type TriggerErrorExtraData = Static<typeof triggerErrorExtraDataSchema>\n\nexport const triggerActionExtraDataSchema = Type.Object(\n {\n actionId: Type.Number({ description: 'id of the action row that ran' }),\n triggerId: Type.Number({ description: 'id of the trigger that ran this action' }),\n // Needed because the engine is shared: `triggerId` alone is ambiguous, since automatic and\n // manual triggers are different tables (`automatic_trigger`, `manual_trigger`) with overlapping\n // id ranges. Paired with `triggerId` this is what a consumer needs to resolve the trigger row.\n triggerModel: Type.String({ description: 'Table the trigger belongs to (automatic_trigger or manual_trigger)' }),\n executionOrder: Type.Number({ description: 'Order of this action within the trigger' }),\n type: Type.String({ description: 'Type of the action (e.g. ApiAction)' }),\n validation: Type.Unknown({ description: 'Result of validating the action context before running it' }),\n // `ok`/`output` describe an action that ran; `aborted`/`reason` an action that never did,\n // because validating its context failed (`resolveActionOutcome`). The two pairs are mutually\n // exclusive in practice but declared as four optionals rather than a union: `additionalProperties:\n // false` is what makes this schema worth having, and a row whose outcome keys are undeclared is\n // one the debugging popup cannot show a reason for — which is exactly the aborted case.\n ok: Type.Optional(Type.Union([Type.Boolean(), Type.Null()], { description: 'Whether the action call succeeded' })),\n output: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Failure output, when the action ran and failed' }),\n ),\n aborted: Type.Optional(Type.Boolean({ description: 'True when the action never ran' })),\n reason: Type.Optional(Type.String({ description: 'Why the action was aborted, e.g. context_validation' })),\n },\n { title: 'TriggerActionExtraData', description: 'extra_data of a `trigger_action` row', additionalProperties: false },\n)\nexport type TriggerActionExtraData = Static<typeof triggerActionExtraDataSchema>\n\n// Discriminated (by `code`) union tying each trigger-engine code to its extra_data shape. Usable\n// both to validate a row being created and to type one being read. Bulk upload codes are\n// deliberately absent (see comment above the individual schemas).\nexport const processLogTriggerEngineExtraDataSchema = Type.Union(\n [\n Type.Object({\n code: Type.Literal(ProcessLogCode.TRIGGER_EVALUATION),\n extra_data: triggerEvaluationExtraDataSchema,\n }),\n Type.Object({ code: Type.Literal(ProcessLogCode.TRIGGER_ERROR), extra_data: triggerErrorExtraDataSchema }),\n Type.Object({ code: Type.Literal(ProcessLogCode.TRIGGER_ACTION), extra_data: triggerActionExtraDataSchema }),\n ],\n {\n title: 'ProcessLogTriggerEngineExtraData',\n description: 'Ties each trigger-engine `code` to the shape its `extra_data` takes',\n },\n)\nexport type ProcessLogTriggerEngineExtraData = Static<typeof processLogTriggerEngineExtraDataSchema>\n\n// ── process_log entity ────────────────────────────────────────────────────\n// Full row shape, for the read side of the (still to be implemented) list endpoint. `extra_data` is\n// left as a free record here — a response schema describes what every row of the table can hold,\n// including the untyped bulk_upload rows, unlike `processLogTriggerEngineExtraDataSchema` above\n// which narrows by `code` for a writer/reader that already knows it is on the trigger-engine path.\nexport const processLogSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the row' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'Project this row belongs to, when scoped to one' }),\n ),\n created_user: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'User who caused the row to be written, when a user did',\n }),\n ),\n related_model: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], { description: 'Table/entity kind the row is about' }),\n ),\n related_id: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Id of the related entity, as a string',\n }),\n ),\n code: Type.Optional(Type.Union([processLogCodeSchema, Type.Null()])),\n log: Type.String({ description: 'Short human-readable message' }),\n long_log: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Extended message, when needed' })),\n extra_data: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Structured data specific to `code` — see the per-code schemas for the trigger-engine codes',\n }),\n ),\n type: processLogTypeSchema,\n requires_attention: Type.Optional(Type.Boolean({ description: 'Whether the row needs a human to review it' })),\n reviewed: Type.Optional(Type.Boolean({ description: 'Whether the row has been reviewed' })),\n reviewed_date: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the row was reviewed. Null while unreviewed. ${EMITTED_DATETIME_NOTE}`,\n }),\n ),\n // Correlation to a parent row (#348): a `trigger_action` row's parent is the `trigger_evaluation`\n // (or `trigger_error`) row of the trigger that ran it, so an action's trace can always be walked\n // back to the evaluation that triggered it. Optional/nullable because most rows (bulk upload,\n // the trigger-evaluation row itself) have no parent, and because the column is applied out of\n // band per ecosystem — see README.md — so it may be entirely absent from a given row's database.\n parent_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: \"Id of this row's parent process_log row, when it has one\",\n }),\n ),\n expires_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `Retention deadline; the row is purged after it, and never expires when null. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\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: 'ProcessLog', description: 'A process_log row' },\n)\nexport type ProcessLogData = Static<typeof processLogSchema>\n\n// ── list query filters ────────────────────────────────────────────────────\n// Filters of the (upcoming) list endpoint, on top of the pagination query — see `alert.schema.ts`\n// `listAlertQuerySchema` for the sibling precedent. Everything is optional: with none of them the\n// endpoint lists everything in scope. Exported for the endpoint (implemented separately) to consume.\nexport const listProcessLogQuerySchema = Type.Object(\n {\n code: Type.Optional(processLogCodeSchema),\n type: Type.Optional(processLogTypeSchema),\n related_model: Type.Optional(Type.String({ description: 'Filter by the related entity kind' })),\n related_id: Type.Optional(Type.String({ description: 'Filter by the id of the related entity' })),\n parent_id: Type.Optional(Type.Number({ description: 'Filter by the id of the parent process_log row' })),\n requires_attention: Type.Optional(Type.Boolean({ description: 'Filter by whether the row needs review' })),\n reviewed: Type.Optional(Type.Boolean({ description: 'Filter by whether the row has been reviewed' })),\n // `apiDateTime`, not a bare string: it carries `format: 'date-time'`, so a malformed value is\n // rejected by the validator as a 400. A plain `Type.String` accepts anything and hands it to\n // `getMySQLDateTime(value, true)`, which throws a `PublicApiError` with no `statusCode` — a 500\n // for what is a bad request. Same type `alert.schema.ts` uses for its datetime fields.\n created_from: Type.Optional(\n Type.Union([apiDateTime], {\n description: `Only rows created at or after this instant. ${API_DATETIME_ACCEPTED_NOTE}. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n created_to: Type.Optional(\n Type.Union([apiDateTime], {\n description: `Only rows created at or before this instant. ${API_DATETIME_ACCEPTED_NOTE}. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n },\n { title: 'ListProcessLogQuery', description: 'Filters available on the process_log list' },\n)\n// `StaticDecode`, not `Static`: this type describes what the *handler receives*, and the two date\n// bounds carry `apiDateTime`, so they arrive decoded to a `Date`. `Static` would type them as the\n// strings the client sent and the service would format something it never gets.\nexport type ListProcessLogQuery = StaticDecode<typeof listProcessLogQuerySchema>\n"],"names":["Type","EMITTED_DATETIME_NOTE","API_DATETIME_EXAMPLE","apiDateTime","API_DATETIME_ACCEPTED_NOTE"],"mappings":";;;;AA8BO,MAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AACT;AACO,MAAM,uBAAuBA,QAAAA,KAAK,KAAK,OAAO,OAAO,cAAc,GAAG;AAAA,EAC3E,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAeM,MAAM,iBAAiB;AAAA,EAC5B,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,mBAAmB;AAAA;AAAA;AAAA;AAAA,EAInB,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,gBAAgB;AAClB;AACO,MAAM,uBAAuBA,QAAAA,KAAK,KAAK,OAAO,OAAO,cAAc,GAAG;AAAA,EAC3E,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAQM,MAAM,mCAAmCA,QAAAA,KAAK;AAAA,EACnD;AAAA,IACE,QAAQA,QAAAA,KAAK,OAAO,EAAE,aAAa,8DAA8D;AAAA,IACjG,QAAQA,QAAAA,KAAK;AAAA,MACXA,QAAAA,KAAK,MAAM,CAACA,QAAAA,KAAK,OAAA,GAAUA,aAAK,MAAM,GAAG,EAAE,aAAa,gDAAgD;AAAA,IAAA;AAAA,IAE1G,WAAWA,QAAAA,KAAK;AAAA,MACdA,QAAAA,KAAK,MAAM,CAACA,QAAAA,KAAK,OAAA,GAAUA,aAAK,MAAM,GAAG,EAAE,aAAa,6CAA6C;AAAA,IAAA;AAAA,IAEvG,SA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,QAAAA,KAAK,SAAS,oBAAoB;AAAA,IACxC,eAAeA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,EAAE,aAAa,oCAAA,CAAqC,CAAC;AAAA,IAC9F,YAAYA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,EAAE,aAAa,yCAAA,CAA0C,CAAC;AAAA,IAChG,WAAWA,QAAAA,KAAK,SAASA,QAAAA,KAAK,OAAO,EAAE,aAAa,iDAAA,CAAkD,CAAC;AAAA,IACvG,oBAAoBA,QAAAA,KAAK,SAASA,QAAAA,KAAK,QAAQ,EAAE,aAAa,yCAAA,CAA0C,CAAC;AAAA,IACzG,UAAUA,QAAAA,KAAK,SAASA,QAAAA,KAAK,QAAQ,EAAE,aAAa,8CAAA,CAA+C,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKpG,cAAcA,QAAAA,KAAK;AAAA,MACjBA,aAAK,MAAM,CAACG,aAAAA,WAAW,GAAG;AAAA,QACxB,aAAa,+CAA+CC,aAAAA,0BAA0B,KAAKH,aAAAA,qBAAqB;AAAA,QAChH,UAAU,CAACC,aAAAA,oBAAoB;AAAA,MAAA,CAChC;AAAA,IAAA;AAAA,IAEH,YAAYF,QAAAA,KAAK;AAAA,MACfA,aAAK,MAAM,CAACG,aAAAA,WAAW,GAAG;AAAA,QACxB,aAAa,gDAAgDC,aAAAA,0BAA0B,KAAKH,aAAAA,qBAAqB;AAAA,QACjH,UAAU,CAACC,aAAAA,oBAAoB;AAAA,MAAA,CAChC;AAAA,IAAA;AAAA,EACH;AAAA,EAEF,EAAE,OAAO,uBAAuB,aAAa,4CAAA;AAC/C;;;;;;;;;;;"}
@@ -145,25 +145,6 @@ const processLogSchema = Type.Object(
145
145
  description: "Id of this row's parent process_log row, when it has one"
146
146
  })
147
147
  ),
148
- // `subject_*` vs `related_*` (both #348, see README.md "`related_*` vs `subject_*`"):
149
- // `related_model`/`related_id` above name the row's own subject — the trigger or the action the
150
- // row is about. `subject_model`/`subject_id` name the domain entity that originated the
151
- // execution (a patient, a form...), so "what triggers ran from this entity" can be answered by
152
- // filtering on them. A `trigger_action` row inherits the same subject as the `trigger_evaluation`
153
- // row of the trigger that ran it — it is the batch's subject, not the action's own. Optional/
154
- // nullable for the same two reasons as `parent_id`: most rows have none (there may be no
155
- // resolvable subject for a batch, or the row predates this column), and the column is applied
156
- // out of band per ecosystem, so it may be entirely absent from a given row's database.
157
- subject_model: Type.Optional(
158
- Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {
159
- description: "Domain entity kind that originated the execution (e.g. patient), when resolvable"
160
- })
161
- ),
162
- subject_id: Type.Optional(
163
- Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {
164
- description: "Id of the domain entity that originated the execution, as a string, when resolvable"
165
- })
166
- ),
167
148
  expires_at: Type.Optional(
168
149
  Type.Union([Type.String(), Type.Null()], {
169
150
  description: `Retention deadline; the row is purged after it, and never expires when null. ${EMITTED_DATETIME_NOTE}`,
@@ -192,12 +173,6 @@ const listProcessLogQuerySchema = Type.Object(
192
173
  related_model: Type.Optional(Type.String({ description: "Filter by the related entity kind" })),
193
174
  related_id: Type.Optional(Type.String({ description: "Filter by the id of the related entity" })),
194
175
  parent_id: Type.Optional(Type.Number({ description: "Filter by the id of the parent process_log row" })),
195
- subject_model: Type.Optional(
196
- Type.String({ description: "Filter by the domain entity kind that originated the execution" })
197
- ),
198
- subject_id: Type.Optional(
199
- Type.String({ description: "Filter by the id of the domain entity that originated the execution" })
200
- ),
201
176
  requires_attention: Type.Optional(Type.Boolean({ description: "Filter by whether the row needs review" })),
202
177
  reviewed: Type.Optional(Type.Boolean({ description: "Filter by whether the row has been reviewed" })),
203
178
  // `apiDateTime`, not a bare string: it carries `format: 'date-time'`, so a malformed value is
@@ -1 +1 @@
1
- {"version":3,"file":"ecosystem-process-log.mjs","sources":["../../src/v2/modules/ecosystem/process-log/process-log.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 place where `no-restricted-imports` has to give way, hence the disable.\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 in `@v1/log/debug` and, transitively, the server dependencies behind it; bundling that\n// fails, and it fails naming a transitive JSON file (`ent/reversed.json: Could not parse JSON\n// file`) rather than the import that dragged it in, so the message points nowhere near the cause.\n//\n// `global/dates`'s own `lib.ts` sidesteps the same barrel for the same reason. The alternative —\n// inlining the two description constants — would duplicate the wording the whole API documents its\n// datetimes with, and let this module's copy drift from it silently.\n// eslint-disable-next-line no-restricted-imports\nimport {\n EMITTED_DATETIME_NOTE,\n API_DATETIME_EXAMPLE,\n API_DATETIME_ACCEPTED_NOTE,\n apiDateTime,\n} from '@/modules/global/dates/dates.schema'\n\n// `process_log` is the ecosystem-wide execution log (see README.md): rows written by the trigger\n// engine, the actions it runs and the v1 bulk upload. This module owns the schema for the whole\n// table, not only the trigger-engine rows — `code` is what tells them apart.\n\n// ── ProcessLogType (severity, NOT layout) ───────────────────────────────\n// Mirrors the v1 enum (`src/schemas/process_log/types.ts`) verbatim: it already ships on the wire\n// (`type` column) and changing its numeric values would be a breaking change for every existing row\n// and consumer. Restated here as a TypeBox schema — not imported from v1 — because `lib.ts` may\n// only export pure TypeBox (see below); v1 has no schema module of its own to import from.\nexport const ProcessLogType = {\n LOG: 0,\n RESULT: 1,\n WARNING: -1,\n ERROR: -2,\n} as const\nexport const processLogTypeSchema = Type.Enum(Object.values(ProcessLogType), {\n title: 'ProcessLogType',\n description: 'Severity of the log row (not a layout/kind marker): LOG, RESULT, WARNING or ERROR',\n})\nexport type ProcessLogType = Static<typeof processLogTypeSchema>\n\n// ── ProcessLogCode ───────────────────────────────────────────────────────\n//\n// Canonical enum now lives HERE (v2), not in `src/schemas/process_log/types.ts` (v1).\n//\n// Why: this module (`process-log`) is the one being extended with the trigger-engine codes as part\n// of #348, it already owns the model/service half of `process_log`, and every v2 consumer that needs\n// a *typed* extra_data contract (this schema file) has to sit next to the code enum it is keyed by.\n// The two v1 importers (`BulkUploadController.ts` and `IntrospectionController.ts`) import it from\n// here rather than from `@v1/schemas`, which keeps one enum instead of two that could drift. v1's\n// `types.ts` deliberately does NOT re-export the value: doing so closes the cycle `@v1/schemas` →\n// this module's barrel → `process-log.model.ts` → `@v1/schemas`, under which the enum resolves to\n// `undefined` at runtime. It keeps an `import type` only, which is erased at compile time.\nexport const ProcessLogCode = {\n BULK_UPLOAD_BATCH: 'bulk_upload_batch',\n BULK_UPLOAD_SUCCESS: 'bulk_upload_success',\n BULK_UPLOAD_ERROR: 'bulk_upload_error',\n // Trigger engine (#348). Written by `TriggerEngineService` (`action-system` module): one\n // `TRIGGER_EVALUATION` row per trigger evaluated, one `TRIGGER_ACTION` row per action it ran, and a\n // `TRIGGER_ERROR` row when a trigger's evaluation throws.\n TRIGGER_EVALUATION: 'trigger_evaluation',\n TRIGGER_ERROR: 'trigger_error',\n TRIGGER_ACTION: 'trigger_action',\n} as const\nexport const processLogCodeSchema = Type.Enum(Object.values(ProcessLogCode), {\n title: 'ProcessLogCode',\n description: 'What kind of event a process_log row records, and what shape its extra_data takes',\n})\nexport type ProcessLogCode = Static<typeof processLogCodeSchema>\n\n// ── extra_data shapes, one per trigger-engine code ───────────────────────\n// Bulk upload codes carry no typed extra_data today (nothing writes them yet outside the\n// filter-by-code reads in `BulkUploadController.ts`), so they are left out of the discriminated\n// union below rather than given a placeholder shape that no writer populates.\n\nexport const triggerEvaluationExtraDataSchema = Type.Object(\n {\n source: Type.String({ description: 'What fired the event: a model row or a displayer/form save' }),\n target: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Model/displayer name the trigger is bound to' }),\n ),\n operation: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'create/update/delete that fired the event' }),\n ),\n matched: Type.Boolean({ description: 'Whether the trigger conditions matched' }),\n conditions: Type.Optional(\n Type.Union([Type.Unknown(), Type.Null()], {\n description: 'jsonLogic conditions the trigger was configured with',\n }),\n ),\n relations: Type.Optional(\n Type.Union([Type.Unknown(), Type.Null()], {\n description: 'Relations the trigger declared to load onto `current`',\n }),\n ),\n relationsSkipped: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: 'Reason a declared relation could not be loaded, when one was skipped',\n }),\n ),\n },\n {\n title: 'TriggerEvaluationExtraData',\n description:\n 'extra_data of a `trigger_evaluation` row — how a trigger resolved, never the entity data it resolved against',\n additionalProperties: false,\n },\n)\nexport type TriggerEvaluationExtraData = Static<typeof triggerEvaluationExtraDataSchema>\n\nexport const triggerErrorExtraDataSchema = Type.Object(\n { error: Type.String({ description: 'String representation of the exception the trigger evaluation threw' }) },\n { title: 'TriggerErrorExtraData', description: 'extra_data of a `trigger_error` row', additionalProperties: false },\n)\nexport type TriggerErrorExtraData = Static<typeof triggerErrorExtraDataSchema>\n\nexport const triggerActionExtraDataSchema = Type.Object(\n {\n actionId: Type.Number({ description: 'id of the action row that ran' }),\n triggerId: Type.Number({ description: 'id of the trigger that ran this action' }),\n // Needed because the engine is shared: `triggerId` alone is ambiguous, since automatic and\n // manual triggers are different tables (`automatic_trigger`, `manual_trigger`) with overlapping\n // id ranges. Paired with `triggerId` this is what a consumer needs to resolve the trigger row.\n triggerModel: Type.String({ description: 'Table the trigger belongs to (automatic_trigger or manual_trigger)' }),\n executionOrder: Type.Number({ description: 'Order of this action within the trigger' }),\n type: Type.String({ description: 'Type of the action (e.g. ApiAction)' }),\n validation: Type.Unknown({ description: 'Result of validating the action context before running it' }),\n // `ok`/`output` describe an action that ran; `aborted`/`reason` an action that never did,\n // because validating its context failed (`resolveActionOutcome`). The two pairs are mutually\n // exclusive in practice but declared as four optionals rather than a union: `additionalProperties:\n // false` is what makes this schema worth having, and a row whose outcome keys are undeclared is\n // one the debugging popup cannot show a reason for — which is exactly the aborted case.\n ok: Type.Optional(Type.Union([Type.Boolean(), Type.Null()], { description: 'Whether the action call succeeded' })),\n output: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Failure output, when the action ran and failed' }),\n ),\n aborted: Type.Optional(Type.Boolean({ description: 'True when the action never ran' })),\n reason: Type.Optional(Type.String({ description: 'Why the action was aborted, e.g. context_validation' })),\n },\n { title: 'TriggerActionExtraData', description: 'extra_data of a `trigger_action` row', additionalProperties: false },\n)\nexport type TriggerActionExtraData = Static<typeof triggerActionExtraDataSchema>\n\n// Discriminated (by `code`) union tying each trigger-engine code to its extra_data shape. Usable\n// both to validate a row being created and to type one being read. Bulk upload codes are\n// deliberately absent (see comment above the individual schemas).\nexport const processLogTriggerEngineExtraDataSchema = Type.Union(\n [\n Type.Object({\n code: Type.Literal(ProcessLogCode.TRIGGER_EVALUATION),\n extra_data: triggerEvaluationExtraDataSchema,\n }),\n Type.Object({ code: Type.Literal(ProcessLogCode.TRIGGER_ERROR), extra_data: triggerErrorExtraDataSchema }),\n Type.Object({ code: Type.Literal(ProcessLogCode.TRIGGER_ACTION), extra_data: triggerActionExtraDataSchema }),\n ],\n {\n title: 'ProcessLogTriggerEngineExtraData',\n description: 'Ties each trigger-engine `code` to the shape its `extra_data` takes',\n },\n)\nexport type ProcessLogTriggerEngineExtraData = Static<typeof processLogTriggerEngineExtraDataSchema>\n\n// ── process_log entity ────────────────────────────────────────────────────\n// Full row shape, for the read side of the (still to be implemented) list endpoint. `extra_data` is\n// left as a free record here — a response schema describes what every row of the table can hold,\n// including the untyped bulk_upload rows, unlike `processLogTriggerEngineExtraDataSchema` above\n// which narrows by `code` for a writer/reader that already knows it is on the trigger-engine path.\nexport const processLogSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the row' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'Project this row belongs to, when scoped to one' }),\n ),\n created_user: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'User who caused the row to be written, when a user did',\n }),\n ),\n related_model: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], { description: 'Table/entity kind the row is about' }),\n ),\n related_id: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Id of the related entity, as a string',\n }),\n ),\n code: Type.Optional(Type.Union([processLogCodeSchema, Type.Null()])),\n log: Type.String({ description: 'Short human-readable message' }),\n long_log: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Extended message, when needed' })),\n extra_data: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Structured data specific to `code` — see the per-code schemas for the trigger-engine codes',\n }),\n ),\n type: processLogTypeSchema,\n requires_attention: Type.Optional(Type.Boolean({ description: 'Whether the row needs a human to review it' })),\n reviewed: Type.Optional(Type.Boolean({ description: 'Whether the row has been reviewed' })),\n reviewed_date: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the row was reviewed. Null while unreviewed. ${EMITTED_DATETIME_NOTE}`,\n }),\n ),\n // Correlation to a parent row (#348): a `trigger_action` row's parent is the `trigger_evaluation`\n // (or `trigger_error`) row of the trigger that ran it, so an action's trace can always be walked\n // back to the evaluation that triggered it. Optional/nullable because most rows (bulk upload,\n // the trigger-evaluation row itself) have no parent, and because the column is applied out of\n // band per ecosystem — see README.md — so it may be entirely absent from a given row's database.\n parent_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: \"Id of this row's parent process_log row, when it has one\",\n }),\n ),\n // `subject_*` vs `related_*` (both #348, see README.md \"`related_*` vs `subject_*`\"):\n // `related_model`/`related_id` above name the row's own subject — the trigger or the action the\n // row is about. `subject_model`/`subject_id` name the domain entity that originated the\n // execution (a patient, a form...), so \"what triggers ran from this entity\" can be answered by\n // filtering on them. A `trigger_action` row inherits the same subject as the `trigger_evaluation`\n // row of the trigger that ran it — it is the batch's subject, not the action's own. Optional/\n // nullable for the same two reasons as `parent_id`: most rows have none (there may be no\n // resolvable subject for a batch, or the row predates this column), and the column is applied\n // out of band per ecosystem, so it may be entirely absent from a given row's database.\n subject_model: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Domain entity kind that originated the execution (e.g. patient), when resolvable',\n }),\n ),\n subject_id: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Id of the domain entity that originated the execution, as a string, when resolvable',\n }),\n ),\n expires_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `Retention deadline; the row is purged after it, and never expires when null. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\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: 'ProcessLog', description: 'A process_log row' },\n)\nexport type ProcessLogData = Static<typeof processLogSchema>\n\n// ── list query filters ────────────────────────────────────────────────────\n// Filters of the (upcoming) list endpoint, on top of the pagination query — see `alert.schema.ts`\n// `listAlertQuerySchema` for the sibling precedent. Everything is optional: with none of them the\n// endpoint lists everything in scope. Exported for the endpoint (implemented separately) to consume.\nexport const listProcessLogQuerySchema = Type.Object(\n {\n code: Type.Optional(processLogCodeSchema),\n type: Type.Optional(processLogTypeSchema),\n related_model: Type.Optional(Type.String({ description: 'Filter by the related entity kind' })),\n related_id: Type.Optional(Type.String({ description: 'Filter by the id of the related entity' })),\n parent_id: Type.Optional(Type.Number({ description: 'Filter by the id of the parent process_log row' })),\n subject_model: Type.Optional(\n Type.String({ description: 'Filter by the domain entity kind that originated the execution' }),\n ),\n subject_id: Type.Optional(\n Type.String({ description: 'Filter by the id of the domain entity that originated the execution' }),\n ),\n requires_attention: Type.Optional(Type.Boolean({ description: 'Filter by whether the row needs review' })),\n reviewed: Type.Optional(Type.Boolean({ description: 'Filter by whether the row has been reviewed' })),\n // `apiDateTime`, not a bare string: it carries `format: 'date-time'`, so a malformed value is\n // rejected by the validator as a 400. A plain `Type.String` accepts anything and hands it to\n // `getMySQLDateTime(value, true)`, which throws a `PublicApiError` with no `statusCode` — a 500\n // for what is a bad request. Same type `alert.schema.ts` uses for its datetime fields.\n created_from: Type.Optional(\n Type.Union([apiDateTime], {\n description: `Only rows created at or after this instant. ${API_DATETIME_ACCEPTED_NOTE}. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n created_to: Type.Optional(\n Type.Union([apiDateTime], {\n description: `Only rows created at or before this instant. ${API_DATETIME_ACCEPTED_NOTE}. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n },\n { title: 'ListProcessLogQuery', description: 'Filters available on the process_log list' },\n)\n// `StaticDecode`, not `Static`: this type describes what the *handler receives*, and the two date\n// bounds carry `apiDateTime`, so they arrive decoded to a `Date`. `Static` would type them as the\n// strings the client sent and the service would format something it never gets.\nexport type ListProcessLogQuery = StaticDecode<typeof listProcessLogQuerySchema>\n"],"names":[],"mappings":";;AA8BO,MAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AACT;AACO,MAAM,uBAAuB,KAAK,KAAK,OAAO,OAAO,cAAc,GAAG;AAAA,EAC3E,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAeM,MAAM,iBAAiB;AAAA,EAC5B,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,mBAAmB;AAAA;AAAA;AAAA;AAAA,EAInB,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,gBAAgB;AAClB;AACO,MAAM,uBAAuB,KAAK,KAAK,OAAO,OAAO,cAAc,GAAG;AAAA,EAC3E,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAQM,MAAM,mCAAmC,KAAK;AAAA,EACnD;AAAA,IACE,QAAQ,K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,IAC9F,YAAY,KAAK,SAAS,KAAK,OAAO,EAAE,aAAa,yCAAA,CAA0C,CAAC;AAAA,IAChG,WAAW,KAAK,SAAS,KAAK,OAAO,EAAE,aAAa,iDAAA,CAAkD,CAAC;AAAA,IACvG,eAAe,KAAK;AAAA,MAClB,KAAK,OAAO,EAAE,aAAa,kEAAkE;AAAA,IAAA;AAAA,IAE/F,YAAY,KAAK;AAAA,MACf,KAAK,OAAO,EAAE,aAAa,uEAAuE;AAAA,IAAA;AAAA,IAEpG,oBAAoB,KAAK,SAAS,KAAK,QAAQ,EAAE,aAAa,yCAAA,CAA0C,CAAC;AAAA,IACzG,UAAU,KAAK,SAAS,KAAK,QAAQ,EAAE,aAAa,8CAAA,CAA+C,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKpG,cAAc,KAAK;AAAA,MACjB,KAAK,MAAM,CAAC,WAAW,GAAG;AAAA,QACxB,aAAa,+CAA+C,0BAA0B,KAAK,qBAAqB;AAAA,QAChH,UAAU,CAAC,oBAAoB;AAAA,MAAA,CAChC;AAAA,IAAA;AAAA,IAEH,YAAY,KAAK;AAAA,MACf,KAAK,MAAM,CAAC,WAAW,GAAG;AAAA,QACxB,aAAa,gDAAgD,0BAA0B,KAAK,qBAAqB;AAAA,QACjH,UAAU,CAAC,oBAAoB;AAAA,MAAA,CAChC;AAAA,IAAA;AAAA,EACH;AAAA,EAEF,EAAE,OAAO,uBAAuB,aAAa,4CAAA;AAC/C;"}
1
+ {"version":3,"file":"ecosystem-process-log.mjs","sources":["../../src/v2/modules/ecosystem/process-log/process-log.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 place where `no-restricted-imports` has to give way, hence the disable.\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 in `@v1/log/debug` and, transitively, the server dependencies behind it; bundling that\n// fails, and it fails naming a transitive JSON file (`ent/reversed.json: Could not parse JSON\n// file`) rather than the import that dragged it in, so the message points nowhere near the cause.\n//\n// `global/dates`'s own `lib.ts` sidesteps the same barrel for the same reason. The alternative —\n// inlining the two description constants — would duplicate the wording the whole API documents its\n// datetimes with, and let this module's copy drift from it silently.\n// eslint-disable-next-line no-restricted-imports\nimport {\n EMITTED_DATETIME_NOTE,\n API_DATETIME_EXAMPLE,\n API_DATETIME_ACCEPTED_NOTE,\n apiDateTime,\n} from '@/modules/global/dates/dates.schema'\n\n// `process_log` is the ecosystem-wide execution log (see README.md): rows written by the trigger\n// engine, the actions it runs and the v1 bulk upload. This module owns the schema for the whole\n// table, not only the trigger-engine rows — `code` is what tells them apart.\n\n// ── ProcessLogType (severity, NOT layout) ───────────────────────────────\n// Mirrors the v1 enum (`src/schemas/process_log/types.ts`) verbatim: it already ships on the wire\n// (`type` column) and changing its numeric values would be a breaking change for every existing row\n// and consumer. Restated here as a TypeBox schema — not imported from v1 — because `lib.ts` may\n// only export pure TypeBox (see below); v1 has no schema module of its own to import from.\nexport const ProcessLogType = {\n LOG: 0,\n RESULT: 1,\n WARNING: -1,\n ERROR: -2,\n} as const\nexport const processLogTypeSchema = Type.Enum(Object.values(ProcessLogType), {\n title: 'ProcessLogType',\n description: 'Severity of the log row (not a layout/kind marker): LOG, RESULT, WARNING or ERROR',\n})\nexport type ProcessLogType = Static<typeof processLogTypeSchema>\n\n// ── ProcessLogCode ───────────────────────────────────────────────────────\n//\n// Canonical enum now lives HERE (v2), not in `src/schemas/process_log/types.ts` (v1).\n//\n// Why: this module (`process-log`) is the one being extended with the trigger-engine codes as part\n// of #348, it already owns the model/service half of `process_log`, and every v2 consumer that needs\n// a *typed* extra_data contract (this schema file) has to sit next to the code enum it is keyed by.\n// The two v1 importers (`BulkUploadController.ts` and `IntrospectionController.ts`) import it from\n// here rather than from `@v1/schemas`, which keeps one enum instead of two that could drift. v1's\n// `types.ts` deliberately does NOT re-export the value: doing so closes the cycle `@v1/schemas` →\n// this module's barrel → `process-log.model.ts` → `@v1/schemas`, under which the enum resolves to\n// `undefined` at runtime. It keeps an `import type` only, which is erased at compile time.\nexport const ProcessLogCode = {\n BULK_UPLOAD_BATCH: 'bulk_upload_batch',\n BULK_UPLOAD_SUCCESS: 'bulk_upload_success',\n BULK_UPLOAD_ERROR: 'bulk_upload_error',\n // Trigger engine (#348). Written by `TriggerEngineService` (`action-system` module): one\n // `TRIGGER_EVALUATION` row per trigger evaluated, one `TRIGGER_ACTION` row per action it ran, and a\n // `TRIGGER_ERROR` row when a trigger's evaluation throws.\n TRIGGER_EVALUATION: 'trigger_evaluation',\n TRIGGER_ERROR: 'trigger_error',\n TRIGGER_ACTION: 'trigger_action',\n} as const\nexport const processLogCodeSchema = Type.Enum(Object.values(ProcessLogCode), {\n title: 'ProcessLogCode',\n description: 'What kind of event a process_log row records, and what shape its extra_data takes',\n})\nexport type ProcessLogCode = Static<typeof processLogCodeSchema>\n\n// ── extra_data shapes, one per trigger-engine code ───────────────────────\n// Bulk upload codes carry no typed extra_data today (nothing writes them yet outside the\n// filter-by-code reads in `BulkUploadController.ts`), so they are left out of the discriminated\n// union below rather than given a placeholder shape that no writer populates.\n\nexport const triggerEvaluationExtraDataSchema = Type.Object(\n {\n source: Type.String({ description: 'What fired the event: a model row or a displayer/form save' }),\n target: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Model/displayer name the trigger is bound to' }),\n ),\n operation: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'create/update/delete that fired the event' }),\n ),\n matched: Type.Boolean({ description: 'Whether the trigger conditions matched' }),\n conditions: Type.Optional(\n Type.Union([Type.Unknown(), Type.Null()], {\n description: 'jsonLogic conditions the trigger was configured with',\n }),\n ),\n relations: Type.Optional(\n Type.Union([Type.Unknown(), Type.Null()], {\n description: 'Relations the trigger declared to load onto `current`',\n }),\n ),\n relationsSkipped: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: 'Reason a declared relation could not be loaded, when one was skipped',\n }),\n ),\n },\n {\n title: 'TriggerEvaluationExtraData',\n description:\n 'extra_data of a `trigger_evaluation` row — how a trigger resolved, never the entity data it resolved against',\n additionalProperties: false,\n },\n)\nexport type TriggerEvaluationExtraData = Static<typeof triggerEvaluationExtraDataSchema>\n\nexport const triggerErrorExtraDataSchema = Type.Object(\n { error: Type.String({ description: 'String representation of the exception the trigger evaluation threw' }) },\n { title: 'TriggerErrorExtraData', description: 'extra_data of a `trigger_error` row', additionalProperties: false },\n)\nexport type TriggerErrorExtraData = Static<typeof triggerErrorExtraDataSchema>\n\nexport const triggerActionExtraDataSchema = Type.Object(\n {\n actionId: Type.Number({ description: 'id of the action row that ran' }),\n triggerId: Type.Number({ description: 'id of the trigger that ran this action' }),\n // Needed because the engine is shared: `triggerId` alone is ambiguous, since automatic and\n // manual triggers are different tables (`automatic_trigger`, `manual_trigger`) with overlapping\n // id ranges. Paired with `triggerId` this is what a consumer needs to resolve the trigger row.\n triggerModel: Type.String({ description: 'Table the trigger belongs to (automatic_trigger or manual_trigger)' }),\n executionOrder: Type.Number({ description: 'Order of this action within the trigger' }),\n type: Type.String({ description: 'Type of the action (e.g. ApiAction)' }),\n validation: Type.Unknown({ description: 'Result of validating the action context before running it' }),\n // `ok`/`output` describe an action that ran; `aborted`/`reason` an action that never did,\n // because validating its context failed (`resolveActionOutcome`). The two pairs are mutually\n // exclusive in practice but declared as four optionals rather than a union: `additionalProperties:\n // false` is what makes this schema worth having, and a row whose outcome keys are undeclared is\n // one the debugging popup cannot show a reason for — which is exactly the aborted case.\n ok: Type.Optional(Type.Union([Type.Boolean(), Type.Null()], { description: 'Whether the action call succeeded' })),\n output: Type.Optional(\n Type.Union([Type.String(), Type.Null()], { description: 'Failure output, when the action ran and failed' }),\n ),\n aborted: Type.Optional(Type.Boolean({ description: 'True when the action never ran' })),\n reason: Type.Optional(Type.String({ description: 'Why the action was aborted, e.g. context_validation' })),\n },\n { title: 'TriggerActionExtraData', description: 'extra_data of a `trigger_action` row', additionalProperties: false },\n)\nexport type TriggerActionExtraData = Static<typeof triggerActionExtraDataSchema>\n\n// Discriminated (by `code`) union tying each trigger-engine code to its extra_data shape. Usable\n// both to validate a row being created and to type one being read. Bulk upload codes are\n// deliberately absent (see comment above the individual schemas).\nexport const processLogTriggerEngineExtraDataSchema = Type.Union(\n [\n Type.Object({\n code: Type.Literal(ProcessLogCode.TRIGGER_EVALUATION),\n extra_data: triggerEvaluationExtraDataSchema,\n }),\n Type.Object({ code: Type.Literal(ProcessLogCode.TRIGGER_ERROR), extra_data: triggerErrorExtraDataSchema }),\n Type.Object({ code: Type.Literal(ProcessLogCode.TRIGGER_ACTION), extra_data: triggerActionExtraDataSchema }),\n ],\n {\n title: 'ProcessLogTriggerEngineExtraData',\n description: 'Ties each trigger-engine `code` to the shape its `extra_data` takes',\n },\n)\nexport type ProcessLogTriggerEngineExtraData = Static<typeof processLogTriggerEngineExtraDataSchema>\n\n// ── process_log entity ────────────────────────────────────────────────────\n// Full row shape, for the read side of the (still to be implemented) list endpoint. `extra_data` is\n// left as a free record here — a response schema describes what every row of the table can hold,\n// including the untyped bulk_upload rows, unlike `processLogTriggerEngineExtraDataSchema` above\n// which narrows by `code` for a writer/reader that already knows it is on the trigger-engine path.\nexport const processLogSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the row' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], { description: 'Project this row belongs to, when scoped to one' }),\n ),\n created_user: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'User who caused the row to be written, when a user did',\n }),\n ),\n related_model: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], { description: 'Table/entity kind the row is about' }),\n ),\n related_id: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Id of the related entity, as a string',\n }),\n ),\n code: Type.Optional(Type.Union([processLogCodeSchema, Type.Null()])),\n log: Type.String({ description: 'Short human-readable message' }),\n long_log: Type.Optional(Type.Union([Type.String(), Type.Null()], { description: 'Extended message, when needed' })),\n extra_data: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Structured data specific to `code` — see the per-code schemas for the trigger-engine codes',\n }),\n ),\n type: processLogTypeSchema,\n requires_attention: Type.Optional(Type.Boolean({ description: 'Whether the row needs a human to review it' })),\n reviewed: Type.Optional(Type.Boolean({ description: 'Whether the row has been reviewed' })),\n reviewed_date: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `When the row was reviewed. Null while unreviewed. ${EMITTED_DATETIME_NOTE}`,\n }),\n ),\n // Correlation to a parent row (#348): a `trigger_action` row's parent is the `trigger_evaluation`\n // (or `trigger_error`) row of the trigger that ran it, so an action's trace can always be walked\n // back to the evaluation that triggered it. Optional/nullable because most rows (bulk upload,\n // the trigger-evaluation row itself) have no parent, and because the column is applied out of\n // band per ecosystem — see README.md — so it may be entirely absent from a given row's database.\n parent_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: \"Id of this row's parent process_log row, when it has one\",\n }),\n ),\n expires_at: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: `Retention deadline; the row is purged after it, and never expires when null. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\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: 'ProcessLog', description: 'A process_log row' },\n)\nexport type ProcessLogData = Static<typeof processLogSchema>\n\n// ── list query filters ────────────────────────────────────────────────────\n// Filters of the (upcoming) list endpoint, on top of the pagination query — see `alert.schema.ts`\n// `listAlertQuerySchema` for the sibling precedent. Everything is optional: with none of them the\n// endpoint lists everything in scope. Exported for the endpoint (implemented separately) to consume.\nexport const listProcessLogQuerySchema = Type.Object(\n {\n code: Type.Optional(processLogCodeSchema),\n type: Type.Optional(processLogTypeSchema),\n related_model: Type.Optional(Type.String({ description: 'Filter by the related entity kind' })),\n related_id: Type.Optional(Type.String({ description: 'Filter by the id of the related entity' })),\n parent_id: Type.Optional(Type.Number({ description: 'Filter by the id of the parent process_log row' })),\n requires_attention: Type.Optional(Type.Boolean({ description: 'Filter by whether the row needs review' })),\n reviewed: Type.Optional(Type.Boolean({ description: 'Filter by whether the row has been reviewed' })),\n // `apiDateTime`, not a bare string: it carries `format: 'date-time'`, so a malformed value is\n // rejected by the validator as a 400. A plain `Type.String` accepts anything and hands it to\n // `getMySQLDateTime(value, true)`, which throws a `PublicApiError` with no `statusCode` — a 500\n // for what is a bad request. Same type `alert.schema.ts` uses for its datetime fields.\n created_from: Type.Optional(\n Type.Union([apiDateTime], {\n description: `Only rows created at or after this instant. ${API_DATETIME_ACCEPTED_NOTE}. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n created_to: Type.Optional(\n Type.Union([apiDateTime], {\n description: `Only rows created at or before this instant. ${API_DATETIME_ACCEPTED_NOTE}. ${EMITTED_DATETIME_NOTE}`,\n examples: [API_DATETIME_EXAMPLE],\n }),\n ),\n },\n { title: 'ListProcessLogQuery', description: 'Filters available on the process_log list' },\n)\n// `StaticDecode`, not `Static`: this type describes what the *handler receives*, and the two date\n// bounds carry `apiDateTime`, so they arrive decoded to a `Date`. `Static` would type them as the\n// strings the client sent and the service would format something it never gets.\nexport type ListProcessLogQuery = StaticDecode<typeof listProcessLogQuerySchema>\n"],"names":[],"mappings":";;AA8BO,MAAM,iBAAiB;AAAA,EAC5B,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AACT;AACO,MAAM,uBAAuB,KAAK,KAAK,OAAO,OAAO,cAAc,GAAG;AAAA,EAC3E,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AK,SAAS,KAAK,OAAO,EAAE,aAAa,yCAAA,CAA0C,CAAC;AAAA,IAChG,WAAW,KAAK,SAAS,KAAK,OAAO,EAAE,aAAa,iDAAA,CAAkD,CAAC;AAAA,IACvG,oBAAoB,KAAK,SAAS,KAAK,QAAQ,EAAE,aAAa,yCAAA,CAA0C,CAAC;AAAA,IACzG,UAAU,KAAK,SAAS,KAAK,QAAQ,EAAE,aAAa,8CAAA,CAA+C,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,IAKpG,cAAc,KAAK;AAAA,MACjB,KAAK,MAAM,CAAC,WAAW,GAAG;AAAA,QACxB,aAAa,+CAA+C,0BAA0B,KAAK,qBAAqB;AAAA,QAChH,UAAU,CAAC,oBAAoB;AAAA,MAAA,CAChC;AAAA,IAAA;AAAA,IAEH,YAAY,KAAK;AAAA,MACf,KAAK,MAAM,CAAC,WAAW,GAAG;AAAA,QACxB,aAAa,gDAAgD,0BAA0B,KAAK,qBAAqB;AAAA,QACjH,UAAU,CAAC,oBAAoB;AAAA,MAAA,CAChC;AAAA,IAAA;AAAA,EACH;AAAA,EAEF,EAAE,OAAO,uBAAuB,aAAa,4CAAA;AAC/C;"}
@@ -9526,14 +9526,6 @@ export type ListProcessLogsParams = {
9526
9526
  * Filter by the id of the parent process_log row
9527
9527
  */
9528
9528
  parent_id?: number;
9529
- /**
9530
- * Filter by the domain entity kind that originated the execution
9531
- */
9532
- subject_model?: string;
9533
- /**
9534
- * Filter by the id of the domain entity that originated the execution
9535
- */
9536
- subject_id?: string;
9537
9529
  /**
9538
9530
  * Filter by whether the row needs review
9539
9531
  */
@@ -9613,14 +9605,6 @@ export type ListProcessLogs200ResultsItemReviewedDate = string | null;
9613
9605
  * Id of this row's parent process_log row, when it has one
9614
9606
  */
9615
9607
  export type ListProcessLogs200ResultsItemParentId = number | null;
9616
- /**
9617
- * Domain entity kind that originated the execution (e.g. patient), when resolvable
9618
- */
9619
- export type ListProcessLogs200ResultsItemSubjectModel = string | null;
9620
- /**
9621
- * Id of the domain entity that originated the execution, as a string, when resolvable
9622
- */
9623
- export type ListProcessLogs200ResultsItemSubjectId = string | null;
9624
9608
  /**
9625
9609
  * Retention deadline; the row is purged after it, and never expires when null. Emitted as ISO-8601 in UTC
9626
9610
  */
@@ -9656,10 +9640,6 @@ export type ListProcessLogs200ResultsItem = {
9656
9640
  reviewed_date?: ListProcessLogs200ResultsItemReviewedDate;
9657
9641
  /** Id of this row's parent process_log row, when it has one */
9658
9642
  parent_id?: ListProcessLogs200ResultsItemParentId;
9659
- /** Domain entity kind that originated the execution (e.g. patient), when resolvable */
9660
- subject_model?: ListProcessLogs200ResultsItemSubjectModel;
9661
- /** Id of the domain entity that originated the execution, as a string, when resolvable */
9662
- subject_id?: ListProcessLogs200ResultsItemSubjectId;
9663
9643
  /** Retention deadline; the row is purged after it, and never expires when null. Emitted as ISO-8601 in UTC */
9664
9644
  expires_at?: ListProcessLogs200ResultsItemExpiresAt;
9665
9645
  /** When the row was created. Emitted as ISO-8601 in UTC */