@persei/perseed-api 5.0.27 → 5.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/ecosystem-alert.cjs +229 -0
  2. package/dist/ecosystem-alert.cjs.map +1 -0
  3. package/dist/ecosystem-alert.d.ts +1 -0
  4. package/dist/ecosystem-alert.mjs +229 -0
  5. package/dist/ecosystem-alert.mjs.map +1 -0
  6. package/dist/ecosystem-process-log.cjs.map +1 -1
  7. package/dist/ecosystem-process-log.mjs.map +1 -1
  8. package/dist/src/Services/AiService.d.ts.map +1 -1
  9. package/dist/src/Services/FileService.d.ts +1 -1
  10. package/dist/src/Services/FileService.d.ts.map +1 -1
  11. package/dist/src/app.d.ts.map +1 -1
  12. package/dist/src/controllers/IntrospectionController.d.ts +10 -1
  13. package/dist/src/controllers/IntrospectionController.d.ts.map +1 -1
  14. package/dist/src/schemas/container_widget/widgetTypes/PatientListProps.d.ts +20 -0
  15. package/dist/src/schemas/container_widget/widgetTypes/PatientListProps.d.ts.map +1 -1
  16. package/dist/src/test/test-helpers.d.ts.map +1 -1
  17. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts +22 -4
  18. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts.map +1 -1
  19. package/dist/src/v2/modules/ecosystem/action-system/action-system.schema.d.ts +14 -14
  20. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.d.ts +4 -4
  21. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.d.ts +5 -0
  22. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.d.ts.map +1 -1
  23. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.d.ts +4 -4
  24. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts +9 -2
  25. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts.map +1 -1
  26. package/dist/src/v2/modules/ecosystem/alert/alert.helper.d.ts +16 -0
  27. package/dist/src/v2/modules/ecosystem/alert/alert.helper.d.ts.map +1 -1
  28. package/dist/src/v2/modules/ecosystem/alert/alert.model.d.ts +42 -0
  29. package/dist/src/v2/modules/ecosystem/alert/alert.model.d.ts.map +1 -1
  30. package/dist/src/v2/modules/ecosystem/alert/alert.schema.d.ts.map +1 -1
  31. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.d.ts +52 -0
  32. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.d.ts.map +1 -0
  33. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.test.d.ts +2 -0
  34. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-listing.service.test.d.ts.map +1 -0
  35. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.d.ts +36 -0
  36. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.d.ts.map +1 -0
  37. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.test.d.ts +2 -0
  38. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert-patient-data.service.test.d.ts.map +1 -0
  39. package/dist/src/v2/modules/ecosystem/alert/{alert.service.d.ts → alert.service/alert.service.d.ts} +5 -5
  40. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert.service.d.ts.map +1 -0
  41. package/dist/src/v2/modules/ecosystem/alert/alert.service/alert.service.test.d.ts.map +1 -0
  42. package/dist/src/v2/modules/ecosystem/alert/alert.service/index.d.ts +5 -0
  43. package/dist/src/v2/modules/ecosystem/alert/alert.service/index.d.ts.map +1 -0
  44. package/dist/src/v2/modules/ecosystem/alert/index.d.ts +3 -2
  45. package/dist/src/v2/modules/ecosystem/alert/index.d.ts.map +1 -1
  46. package/dist/src/v2/modules/ecosystem/alert/lib.d.ts +2 -0
  47. package/dist/src/v2/modules/ecosystem/alert/lib.d.ts.map +1 -0
  48. package/dist/src/v2/modules/ecosystem/process-log/process-log.schema.d.ts.map +1 -1
  49. package/dist/src/v2/modules/project/forms-data/forms-data.helper.d.ts +52 -1
  50. package/dist/src/v2/modules/project/forms-data/forms-data.helper.d.ts.map +1 -1
  51. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.d.ts +64 -0
  52. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.d.ts.map +1 -0
  53. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.test.d.ts +2 -0
  54. package/dist/src/v2/modules/project/forms-data/forms-data.service/associated-sources.service.test.d.ts.map +1 -0
  55. package/dist/src/v2/modules/project/forms-data/forms-data.service/forms-data.service.d.ts +22 -0
  56. package/dist/src/v2/modules/project/forms-data/forms-data.service/forms-data.service.d.ts.map +1 -0
  57. package/dist/src/v2/modules/project/forms-data/forms-data.service/forms-data.service.test.d.ts.map +1 -0
  58. package/dist/src/v2/modules/project/forms-data/forms-data.service/index.d.ts +4 -0
  59. package/dist/src/v2/modules/project/forms-data/forms-data.service/index.d.ts.map +1 -0
  60. package/dist/src/v2/modules/project/forms-data/index.d.ts +1 -0
  61. package/dist/src/v2/modules/project/forms-data/index.d.ts.map +1 -1
  62. package/dist/v1/perseed-api.cjs +9 -0
  63. package/dist/v1/perseed-api.cjs.map +1 -1
  64. package/dist/v1/perseed-api.mjs +9 -0
  65. package/dist/v1/perseed-api.mjs.map +1 -1
  66. package/package.json +1 -1
  67. package/dist/src/v2/modules/ecosystem/alert/alert.service.d.ts.map +0 -1
  68. package/dist/src/v2/modules/ecosystem/alert/alert.service.test.d.ts.map +0 -1
  69. package/dist/src/v2/modules/project/forms-data/forms-data.service.d.ts +0 -12
  70. package/dist/src/v2/modules/project/forms-data/forms-data.service.d.ts.map +0 -1
  71. package/dist/src/v2/modules/project/forms-data/forms-data.service.test.d.ts.map +0 -1
  72. /package/dist/src/v2/modules/ecosystem/alert/{alert.service.test.d.ts → alert.service/alert.service.test.d.ts} +0 -0
  73. /package/dist/src/v2/modules/project/forms-data/{forms-data.service.test.d.ts → forms-data.service/forms-data.service.test.d.ts} +0 -0
@@ -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 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,IA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;AAAA,IACxC,MAAMA,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;;;;;;;;;;;"}
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 case where `no-restricted-imports` has to give way, as `alert.schema.ts` also\n// 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 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_N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AAO,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;;;;;;;;;;;"}
@@ -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 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,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAeM,MAAM,iBAAiB;AAAA,EAC5B,mBAAmB;AAAA,EACnB,qBAAqB;AAAA,EACrB,mBAAmB;AAAA;AAAA;AAA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A,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;"}
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 case where `no-restricted-imports` has to give way, as `alert.schema.ts` also\n// 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 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":";;AA+BO,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;AAC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A;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 +1 @@
1
- {"version":3,"file":"AiService.d.ts","sourceRoot":"","sources":["../../../../src/Services/AiService.ts"],"names":[],"mappings":"AAIA,OAAO,cAAc,MAAM,kCAAkC,CAAA;AAC7D,OAA0B,EAAqB,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAWrF,OAAO,aAAa,MAAM,iCAAiC,CAAA;AAE3D,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAyB5B,eAAO,MAAM,sBAAsB,wBAAwB,CAAA;AAC3D,eAAO,MAAM,oBAAoB,uBAAuB,CAAA;AAqZxD,QAAA,MAAM,SAAS;IACb;;OAEG;6CAEI,cAAc,SACZ,aAAa,YACV,MAAM,aACL,MAAM,SACV,MAAM,eACA,MAAM,aACR,MAAM,cACL,MAAM,UACV,MAAM,iBACC,SAAS,CAAC,YAAY;6BAkER,cAAc,KAAK,SAAS,QAAQ,GAAG;4BA8JxC,cAAc,KAAK,SAAS,QAAQ,GAAG;CAmJtE,CAAA;AAED,eAAe,SAAS,CAAA"}
1
+ {"version":3,"file":"AiService.d.ts","sourceRoot":"","sources":["../../../../src/Services/AiService.ts"],"names":[],"mappings":"AAIA,OAAO,cAAc,MAAM,kCAAkC,CAAA;AAC7D,OAA0B,EAAqB,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAWrF,OAAO,aAAa,MAAM,iCAAiC,CAAA;AAE3D,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAyB5B,eAAO,MAAM,sBAAsB,wBAAwB,CAAA;AAC3D,eAAO,MAAM,oBAAoB,uBAAuB,CAAA;AAqZxD,QAAA,MAAM,SAAS;IACb;;OAEG;6CAEI,cAAc,SACZ,aAAa,YACV,MAAM,aACL,MAAM,SACV,MAAM,eACA,MAAM,aACR,MAAM,cACL,MAAM,UACV,MAAM,iBACC,SAAS,CAAC,YAAY;6BAkER,cAAc,KAAK,SAAS,QAAQ,GAAG;4BA8JxC,cAAc,KAAK,SAAS,QAAQ,GAAG;CAsJtE,CAAA;AAED,eAAe,SAAS,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { default as RequestContext, NoUserRequestContext } from '../models/request/RequestContext';
2
2
  import { Readable } from 'stream';
3
3
  declare function stream2buffer(stream: Readable): Promise<Buffer>;
4
- declare function createThumbnail(buffer: Buffer): Promise<Buffer<ArrayBufferLike>>;
4
+ declare function createThumbnail(buffer: Buffer): Promise<Buffer<ArrayBuffer>>;
5
5
  export type DestinationPathContext = Record<string, unknown> & {
6
6
  fileName: string;
7
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"FileService.d.ts","sourceRoot":"","sources":["../../../../src/Services/FileService.ts"],"names":[],"mappings":"AAIA,OAAO,cAAc,EAAE,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAUvF,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAMjC,iBAAe,aAAa,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAO9D;AAqBD,iBAAe,eAAe,CAAC,MAAM,EAAE,MAAM,oCAQ5C;AAMD,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAA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,CAAC,EAAE,OAAO,mTA+N5D;AAED,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;AAkCrB,OAAO,EAAE,2BAA2B,EAAoD,MAAM,wBAAwB,CAAA;AAQtH,iBAAe,MAAM,CAAC,QAAQ,UAAQ,EAAE,WAAW,CAAC,EAAE,OAAO,mTAkO5D;AAED,eAAe,MAAM,CAAA"}
@@ -1,7 +1,16 @@
1
1
  import { IntrospectionSchema } from '../schemas';
2
2
  import { TFunction } from 'i18next';
3
3
  import { FastifyReply, FastifyRequest } from 'fastify';
4
- export declare function getIntrospectionSchema(t: TFunction): IntrospectionSchema;
4
+ /** An alert type as the condition builder offers it: the id a condition compares, the name it shows. */
5
+ export interface AlertTypeOption {
6
+ id: number;
7
+ name: string;
8
+ }
9
+ /**
10
+ * `alertTypes` is the catalog of alert types of the ecosystem, offered as the options of an alert's
11
+ * `alert_type_id`. It is data rather than schema, so the caller reads it and passes it in.
12
+ */
13
+ export declare function getIntrospectionSchema(t: TFunction, alertTypes?: AlertTypeOption[]): IntrospectionSchema;
5
14
  declare const IntrospectionController: {
6
15
  getIntrospectionSchema: (req: FastifyRequest, res: FastifyReply) => Promise<void>;
7
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"IntrospectionController.d.ts","sourceRoot":"","sources":["../../../../src/controllers/IntrospectionController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAgD,MAAM,aAAa,CAAA;AAM/F,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAOtD,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,SAAS,GAAG,mBAAmB,CA2TxE;AAED,QAAA,MAAM,uBAAuB;kCACS,cAAc,OAAO,YAAY;CAGtE,CAAA;AAED,eAAe,uBAAuB,CAAA"}
1
+ {"version":3,"file":"IntrospectionController.d.ts","sourceRoot":"","sources":["../../../../src/controllers/IntrospectionController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAgD,MAAM,aAAa,CAAA;AAM/F,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAQtD,wGAAwG;AACxG,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,GAAE,eAAe,EAAO,GAAG,mBAAmB,CAsW5G;AAED,QAAA,MAAM,uBAAuB;kCACS,cAAc,OAAO,YAAY;CAMtE,CAAA;AAED,eAAe,uBAAuB,CAAA"}
@@ -42,6 +42,26 @@ export interface SortBy {
42
42
  }
43
43
  export declare const EXTERNAL_SOURCE_KEYS: readonly ["health_data_daily", "health_data_discrete"];
44
44
  export type ExternalSourceType = (typeof EXTERNAL_SOURCE_KEYS)[number];
45
+ /**
46
+ * Datasources that stand for a table of the platform rather than a form of the project.
47
+ *
48
+ * The listing compiles its main form's conditions into a query over the **project** database,
49
+ * resolving every source the tree names as a crf of that project (`DesignerCrf.getDesigner`, via
50
+ * the join list). None of these is one: `user` and `user_profile` live in the ecosystem database,
51
+ * `alert` too, `health_data_*` are not a table at all but an external service, `patient_adherence`
52
+ * is a computed shape with no table behind it, and `process_log` is a first-class table no crf
53
+ * describes. A condition naming any of them therefore has nothing to compile against — see
54
+ * `isFilterableSource` in the `forms-data` module for what the listing does with one.
55
+ *
56
+ * `patient` is deliberately absent: it *is* a crf of the project (`displayer_patient`), so a
57
+ * condition on it compiles like any other form's.
58
+ *
59
+ * Kept apart from `EXTERNAL_SOURCE_KEYS`, which is a narrower statement: those two are fetched
60
+ * from elsewhere after pagination and still emit their own column. This list answers a different
61
+ * question — whether the main form's filter can constrain on the source at all.
62
+ */
63
+ export declare const PLATFORM_TABLE_SOURCE_KEYS: readonly ["user", "user_profile", "patient_adherence", "process_log", "alert", "health_data_daily", "health_data_discrete"];
64
+ export type PlatformTableSourceType = (typeof PLATFORM_TABLE_SOURCE_KEYS)[number];
45
65
  export interface FormListDataConfig {
46
66
  fields: string[];
47
67
  conditions?: Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"PatientListProps.d.ts","sourceRoot":"","sources":["../../../../../../src/schemas/container_widget/widgetTypes/PatientListProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,4BAA4B,EAC5B,oCAAoC,EACpC,2BAA2B,EAC5B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAA;AAE9F;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAA;IACtC,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC7B,UAAU,CAAC,EAAE,qBAAqB,CAAA;IAClC,aAAa,CAAC,EAAE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ACX,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,eAAe,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
1
+ {"version":3,"file":"PatientListProps.d.ts","sourceRoot":"","sources":["../../../../../../src/schemas/container_widget/widgetTypes/PatientListProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAA;AACxE,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,4BAA4B,EAC5B,oCAAoC,EACpC,2BAA2B,EAC5B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAA;AAE9F;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,CAAA;IACtC,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC7B,UAAU,CAAC,EAAE,qBAAqB,CAAA;IAClC,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,MAAM,CAAC,E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AAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,eAAe,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
@@ -1 +1 @@
1
- {"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../../../src/test/test-helpers.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,2BAA2B,EAA6B,MAAM,wBAAwB,CAAA;AAE/F,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,QAIxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,IAC7B,wBAAqB,KAAG,CAAC,GAAG,SAAS,CAM9C;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,yRAI/B"}
1
+ {"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../../../src/test/test-helpers.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,2BAA2B,EAA6B,MAAM,wBAAwB,CAAA;AAE/F,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,eAAe,QAKxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,IAC7B,wBAAqB,KAAG,CAAC,GAAG,SAAS,CAM9C;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,yRAI/B"}
@@ -12,6 +12,18 @@ import { default as RequestContext, RequestContextData } from '../../../../../mo
12
12
  * cannot be narrowed and stays reachable across the projects of one ecosystem; see the README.
13
13
  */
14
14
  export declare function loadTriggerEntity(ctx: RequestContext, source: TriggerSource, target: string, entityId: number): Promise<Record<string, unknown> | undefined>;
15
+ /**
16
+ * Memo of the patient rows resolved while evaluating one batch, keyed by the entity they were
17
+ * resolved from.
18
+ *
19
+ * Every trigger of a batch is evaluated against the same row, so without it a batch of N triggers
20
+ * on one alert repeats the same `user_patient` lookup and the same displayer read N times — and
21
+ * since `canJoinPatient` makes the admin UI prepend `patient` to any relation selection, that is
22
+ * the common case and not an edge one. Its lifetime is the batch: it is created by the caller and
23
+ * dropped with it, so a later batch never reads a row this one saw.
24
+ */
25
+ export type PatientCache = Map<string, Record<string, unknown> | undefined>;
26
+ export declare function createPatientCache(): PatientCache;
15
27
  /**
16
28
  * Eager-loads the relations declared in `relations.join` onto `current`, each under its own name,
17
29
  * so conditions and action payloads can reference them as `current.patient.name`.
@@ -19,11 +31,17 @@ export declare function loadTriggerEntity(ctx: RequestContext, source: TriggerSo
19
31
  * The model is resolved by `resolveTargetQuery`, with the joins passed up front so a displayer
20
32
  * target builds its model with them already in place.
21
33
  *
22
- * Never throws: returns `current` untouched, with a `skipped` reason, when there is nothing to
23
- * load or no way to load it. The trigger is then evaluated without the relations instead of
24
- * aborting the whole batch.
34
+ * `patient` on a model source is the one name not eager-loaded: it is resolved separately against
35
+ * the project database (see `PATIENT_RELATION`) and merged in under the same name, so a condition
36
+ * reads `current.patient.x` without caring which side of the boundary the row came from.
37
+ *
38
+ * Returns `current` untouched, with a `skipped` reason, when there is nothing to load or no way to
39
+ * load it — including a patient that cannot be reached. The trigger is then evaluated without the
40
+ * relations instead of aborting the whole batch. A relation name the model does not declare is the
41
+ * exception: Objection throws and the error is left to propagate, which the engine records as an
42
+ * ERROR row for that trigger.
25
43
  */
26
- export declare function loadRelations(ctx: RequestContext, source: TriggerSource, target: string | null | undefined, current: Record<string, unknown>, relations?: TriggerRelations | null): Promise<{
44
+ export declare function loadRelations(ctx: RequestContext, source: TriggerSource, target: string | null | undefined, current: Record<string, unknown>, relations?: TriggerRelations | null, patientCache?: PatientCache): Promise<{
27
45
  current: Record<string, unknown>;
28
46
  skipped?: string;
29
47
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"action-system.helper.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EACL,UAAU,EAGV,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAa3E,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAiE9E;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAqB9C;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CACjC,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,CAAC,EAAE,gBAAgB,GAAG,IAAI,GAClC,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,OAAO,CAAC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I,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,gBAAgB,GAAG,SAAS,GACnC,uBAAuB,CAiCzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,yBAAyB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAOlF"}
1
+ {"version":3,"file":"action-system.helper.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EACL,UAAU,EAGV,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAgB3E,OAAO,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAiE9E;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAqB9C;AAkBD;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAAA;AAE3E,wBAAgB,kB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AI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAanH;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAMpG;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,GAAG,qBAAqB,CAiBpF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,gBAAgB,GAAG,SAAS,GACnC,uBAAuB,CAiCzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,yBAAyB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAOlF"}
@@ -106,8 +106,8 @@ export declare const createActionSchema: Type.TObject<{
106
106
  }>, Type.TObject<{
107
107
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
108
108
  }>]>]>;
109
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
110
109
  library: Type.TOptional<Type.TBoolean>;
110
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
111
111
  }>;
112
112
  export type CreateActionData = Static<typeof createActionSchema>;
113
113
  export declare const updateActionSchema: Type.TObject<{
@@ -121,8 +121,8 @@ export declare const updateActionSchema: Type.TObject<{
121
121
  }>, Type.TObject<{
122
122
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
123
123
  }>]>]>>;
124
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
125
124
  library: Type.TOptional<Type.TBoolean>;
125
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
126
126
  }>;
127
127
  export type UpdateActionData = Static<typeof updateActionSchema>;
128
128
  export declare const triggerActionInputSchema: Type.TUnion<[Type.TNumber, Type.TObject<{
@@ -136,8 +136,8 @@ export declare const triggerActionInputSchema: Type.TUnion<[Type.TNumber, Type.T
136
136
  }>, Type.TObject<{
137
137
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
138
138
  }>]>]>;
139
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
140
139
  library: Type.TOptional<Type.TBoolean>;
140
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
141
141
  }>, Type.TObject<{
142
142
  type: Type.TOptional<Type.TEnum<"ApiAction"[]>>;
143
143
  name: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
@@ -149,8 +149,8 @@ export declare const triggerActionInputSchema: Type.TUnion<[Type.TNumber, Type.T
149
149
  }>, Type.TObject<{
150
150
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
151
151
  }>]>]>>;
152
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
153
152
  library: Type.TOptional<Type.TBoolean>;
153
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
154
154
  id: Type.TNumber;
155
155
  }>]>;
156
156
  export type TriggerActionInput = Static<typeof triggerActionInputSchema>;
@@ -165,8 +165,8 @@ export declare const triggerActionsInputSchema: Type.TArray<Type.TUnion<[Type.TN
165
165
  }>, Type.TObject<{
166
166
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
167
167
  }>]>]>;
168
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
169
168
  library: Type.TOptional<Type.TBoolean>;
169
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
170
170
  }>, Type.TObject<{
171
171
  type: Type.TOptional<Type.TEnum<"ApiAction"[]>>;
172
172
  name: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
@@ -178,8 +178,8 @@ export declare const triggerActionsInputSchema: Type.TArray<Type.TUnion<[Type.TN
178
178
  }>, Type.TObject<{
179
179
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
180
180
  }>]>]>>;
181
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
182
181
  library: Type.TOptional<Type.TBoolean>;
182
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
183
183
  id: Type.TNumber;
184
184
  }>]>>;
185
185
  export declare const automaticTriggerSchema: Type.TObject<{
@@ -224,8 +224,8 @@ export declare const createAutomaticTriggerSchema: Type.TObject<{
224
224
  }>, Type.TObject<{
225
225
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
226
226
  }>]>]>;
227
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
228
227
  library: Type.TOptional<Type.TBoolean>;
228
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
229
229
  }>, Type.TObject<{
230
230
  type: Type.TOptional<Type.TEnum<"ApiAction"[]>>;
231
231
  name: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
@@ -237,8 +237,8 @@ export declare const createAutomaticTriggerSchema: Type.TObject<{
237
237
  }>, Type.TObject<{
238
238
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
239
239
  }>]>]>>;
240
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
241
240
  library: Type.TOptional<Type.TBoolean>;
241
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
242
242
  id: Type.TNumber;
243
243
  }>]>>>;
244
244
  }>;
@@ -266,8 +266,8 @@ export declare const updateAutomaticTriggerSchema: Type.TObject<{
266
266
  }>, Type.TObject<{
267
267
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
268
268
  }>]>]>;
269
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
270
269
  library: Type.TOptional<Type.TBoolean>;
270
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
271
271
  }>, Type.TObject<{
272
272
  type: Type.TOptional<Type.TEnum<"ApiAction"[]>>;
273
273
  name: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
@@ -279,8 +279,8 @@ export declare const updateAutomaticTriggerSchema: Type.TObject<{
279
279
  }>, Type.TObject<{
280
280
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
281
281
  }>]>]>>;
282
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
283
282
  library: Type.TOptional<Type.TBoolean>;
283
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
284
284
  id: Type.TNumber;
285
285
  }>]>>>;
286
286
  }>;
@@ -431,8 +431,8 @@ export declare const createManualTriggerSchema: Type.TObject<{
431
431
  }>, Type.TObject<{
432
432
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
433
433
  }>]>]>;
434
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
435
434
  library: Type.TOptional<Type.TBoolean>;
435
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
436
436
  }>, Type.TObject<{
437
437
  type: Type.TOptional<Type.TEnum<"ApiAction"[]>>;
438
438
  name: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
@@ -444,8 +444,8 @@ export declare const createManualTriggerSchema: Type.TObject<{
444
444
  }>, Type.TObject<{
445
445
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
446
446
  }>]>]>>;
447
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
448
447
  library: Type.TOptional<Type.TBoolean>;
448
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
449
449
  id: Type.TNumber;
450
450
  }>]>>>;
451
451
  }>;
@@ -494,8 +494,8 @@ export declare const updateManualTriggerSchema: Type.TObject<{
494
494
  }>, Type.TObject<{
495
495
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
496
496
  }>]>]>;
497
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
498
497
  library: Type.TOptional<Type.TBoolean>;
498
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
499
499
  }>, Type.TObject<{
500
500
  type: Type.TOptional<Type.TEnum<"ApiAction"[]>>;
501
501
  name: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
@@ -507,8 +507,8 @@ export declare const updateManualTriggerSchema: Type.TObject<{
507
507
  }>, Type.TObject<{
508
508
  payload: Type.TRecord<"^.*$", Type.TUnknown>;
509
509
  }>]>]>>;
510
- retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
511
510
  library: Type.TOptional<Type.TBoolean>;
511
+ retention_days: Type.TOptional<Type.TUnion<[Type.TNumber, Type.TNull]>>;
512
512
  id: Type.TNumber;
513
513
  }>]>>>;
514
514
  }>;
@@ -21,8 +21,8 @@ declare function listAutomaticTriggers(ctx: RequestContext, pagination: Paginate
21
21
  actions?: {
22
22
  name?: string | null | undefined;
23
23
  project_id?: number | null | undefined;
24
- retention_days?: number | null | undefined;
25
24
  library?: boolean | undefined;
25
+ retention_days?: number | null | undefined;
26
26
  id: number;
27
27
  type: "ApiAction";
28
28
  config: {
@@ -55,8 +55,8 @@ declare function getAutomaticTriggerById(ctx: RequestContext, id: number, includ
55
55
  actions?: {
56
56
  name?: string | null | undefined;
57
57
  project_id?: number | null | undefined;
58
- retention_days?: number | null | undefined;
59
58
  library?: boolean | undefined;
59
+ retention_days?: number | null | undefined;
60
60
  id: number;
61
61
  type: "ApiAction";
62
62
  config: {
@@ -73,8 +73,8 @@ declare function createAutomaticTrigger(ctx: RequestContext, data: CreateAutomat
73
73
  actions: {
74
74
  name?: string | null | undefined;
75
75
  project_id?: number | null | undefined;
76
- retention_days?: number | null | undefined;
77
76
  library?: boolean | undefined;
77
+ retention_days?: number | null | undefined;
78
78
  id: number;
79
79
  type: "ApiAction";
80
80
  config: {
@@ -105,8 +105,8 @@ declare function updateAutomaticTrigger(ctx: RequestContext, id: number, data: U
105
105
  actions: {
106
106
  name?: string | null | undefined;
107
107
  project_id?: number | null | undefined;
108
- retention_days?: number | null | undefined;
109
108
  library?: boolean | undefined;
109
+ retention_days?: number | null | undefined;
110
110
  id: number;
111
111
  type: "ApiAction";
112
112
  config: {
@@ -17,6 +17,11 @@ declare function resolveManualTriggers(ctx: RequestContext, source: TriggerSourc
17
17
  * before its style is resolved — a button nobody will see does not pay for its
18
18
  * own presentation. What survives with `matched: false` is therefore always a
19
19
  * button shown disabled.
20
+ *
21
+ * Every trigger is evaluated against the same entity, so the patient it resolves to is
22
+ * memoised for the call: N buttons cost one `user_patient` read and one displayer read,
23
+ * not N of each. It matters more here than in a batch — this runs on every render, while
24
+ * a batch runs once per save. The memo lives and dies with the call.
20
25
  */
21
26
  declare function listAvailable(ctx: RequestContext, query: ManualTriggerAvailabilityQuery): Promise<ManualTriggerAvailability[]>;
22
27
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"manual-trigger-engine.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAA;AAInE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEtD,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAEnB,MAAM,yBAAyB,CAAA;AAOhC;;;;GAIG;AACH,iBAAe,qBAAqB,CAClC,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,EAAE,CAAC,CAS1B;AAoBD;;;;;;;;;;GAUG;AACH,iBAAe,aAAa,CAC1B,GAAG,EAAE,cAAc,EACnB,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAqCtC;AAED;;;;GAIG;AACH,iBAAe,gBAAgB,CAC7B,GAAG,EAAE,cAAc,EACnB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,GAAG,GAAE,IAAiB,GACrB,OAAO,CAAC,sBAAsB,CAAC,CA8CjC;AAED,eAAO,MAAM,0BAA0B;;;;CAItC,CAAA"}
1
+ {"version":3,"file":"manual-trigger-engine.service.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAA;AAInE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEtD,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,8BAA8B,EACnC,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAEnB,MAAM,yBAAyB,CAAA;AAOhC;;;;GAIG;AACH,iBAAe,qBAAqB,CAClC,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,EAAE,CAAC,CAS1B;AAoBD;;;;;;;;;;;;;;;GAeG;AACH,iBAAe,aAAa,CAC1B,GAAG,EAAE,cAAc,EACnB,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAuCtC;AAED;;;;GAIG;AACH,iBAAe,gBAAgB,CAC7B,GAAG,EAAE,cAAc,EACnB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,GAAG,GAAE,IAAiB,GACrB,OAAO,CAAC,sBAAsB,CAAC,CA8CjC;AAED,eAAO,MAAM,0BAA0B;;;;CAItC,CAAA"}