@persei/perseed-api 5.0.21 → 5.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.cjs +678 -37
- package/dist/client.cjs.map +1 -1
- package/dist/client.mjs +678 -37
- package/dist/client.mjs.map +1 -1
- package/dist/{lib-CDM5aEJG.cjs → dates.helper-CDM5aEJG.cjs} +1 -1
- package/dist/dates.helper-CDM5aEJG.cjs.map +1 -0
- package/dist/{lib-XRCJ_UAQ.js → dates.helper-XRCJ_UAQ.js} +1 -1
- package/dist/dates.helper-XRCJ_UAQ.js.map +1 -0
- package/dist/ecosystem-action-system.cjs +42 -32
- package/dist/ecosystem-action-system.cjs.map +1 -1
- package/dist/ecosystem-action-system.mjs +42 -32
- package/dist/ecosystem-action-system.mjs.map +1 -1
- package/dist/ecosystem-container-widget.cjs +6 -6
- package/dist/ecosystem-container-widget.cjs.map +1 -1
- package/dist/ecosystem-container-widget.mjs +1 -1
- package/dist/global-dates.cjs +9 -3
- package/dist/global-dates.cjs.map +1 -1
- package/dist/global-dates.mjs +7 -1
- package/dist/global-dates.mjs.map +1 -1
- package/dist/lib/src/generated/client.d.ts +5338 -879
- package/dist/lib/src/generated/client.d.ts.map +1 -1
- package/dist/src/Services/TriggerService.d.ts.map +1 -1
- package/dist/src/config/apiPublicKey.d.ts +19 -4
- package/dist/src/config/apiPublicKey.d.ts.map +1 -1
- package/dist/src/config/apiPublicKey.test.d.ts +2 -0
- package/dist/src/config/apiPublicKey.test.d.ts.map +1 -0
- package/dist/src/constants/SeedPrivilege.d.ts +1 -0
- package/dist/src/constants/SeedPrivilege.d.ts.map +1 -1
- package/dist/src/controllers/IntrospectionController.d.ts.map +1 -1
- package/dist/src/controllers/UserController.d.ts.map +1 -1
- package/dist/src/schemas/container_widget/create_widget_payload.schema.json +1 -1
- package/dist/src/schemas/container_widget/update_widget_payload.schema.json +1 -1
- package/dist/src/schemas/container_widget/widgetTypes/PatientListProps.d.ts +2 -1
- package/dist/src/schemas/container_widget/widgetTypes/PatientListProps.d.ts.map +1 -1
- package/dist/src/test/e2e-permissions.d.ts +32 -3
- package/dist/src/test/e2e-permissions.d.ts.map +1 -1
- package/dist/src/test/test-helpers.d.ts +12 -0
- package/dist/src/test/test-helpers.d.ts.map +1 -1
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts +1 -1
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts.map +1 -1
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/manual-trigger.helper.d.ts.map +1 -1
- package/dist/src/v2/modules/ecosystem/action-system/action-system.model.d.ts +5 -2
- package/dist/src/v2/modules/ecosystem/action-system/action-system.model.d.ts.map +1 -1
- package/dist/src/v2/modules/ecosystem/action-system/action-system.model.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.model.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.schema.d.ts +69 -58
- package/dist/src/v2/modules/ecosystem/action-system/action-system.schema.d.ts.map +1 -1
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.d.ts +14 -6
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.d.ts.map +1 -1
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.d.ts +18 -10
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.d.ts.map +1 -1
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts.map +1 -1
- package/dist/src/v2/modules/ecosystem/alert/alert.controller.d.ts +12 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.controller.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.controller.e2e.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.controller.e2e.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.controller.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.controller.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.helper.d.ts +55 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.helper.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.helper.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.helper.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.model.d.ts +61 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.model.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.model.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.model.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.schema.d.ts +134 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.schema.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.service.d.ts +73 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.service.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.service.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/alert/alert.service.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert/index.d.ts +7 -0
- package/dist/src/v2/modules/ecosystem/alert/index.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.controller.d.ts +6 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.controller.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.controller.e2e.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.controller.e2e.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.controller.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.controller.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.helper.d.ts +14 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.helper.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.helper.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.helper.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.model.d.ts +18 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.model.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.schema.d.ts +29 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.schema.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.service.d.ts +38 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.service.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.service.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/alert-type/alert-type.service.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/alert-type/index.d.ts +6 -0
- package/dist/src/v2/modules/ecosystem/alert-type/index.d.ts.map +1 -0
- package/dist/src/v2/modules/global/auth-token/auth-token.controller.d.ts.map +1 -1
- package/dist/src/v2/modules/global/dates/dates.helper.d.ts.map +1 -1
- package/dist/src/v2/modules/global/dates/dates.schema.d.ts +39 -0
- package/dist/src/v2/modules/global/dates/dates.schema.d.ts.map +1 -1
- package/dist/src/v2/modules/global/permissions/index.d.ts +2 -0
- package/dist/src/v2/modules/global/permissions/index.d.ts.map +1 -0
- package/dist/src/v2/modules/global/permissions/permissions.helper.d.ts +32 -0
- package/dist/src/v2/modules/global/permissions/permissions.helper.d.ts.map +1 -0
- package/dist/src/v2/modules/global/permissions/permissions.helper.test.d.ts +2 -0
- package/dist/src/v2/modules/global/permissions/permissions.helper.test.d.ts.map +1 -0
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/alert/index.d.ts +3 -0
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/alert/index.d.ts.map +1 -0
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/alert-type/index.d.ts +3 -0
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/alert-type/index.d.ts.map +1 -0
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/alert/index.d.ts +3 -0
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/alert/index.d.ts.map +1 -0
- package/dist/v1/perseed-api.cjs +2 -0
- package/dist/v1/perseed-api.cjs.map +1 -1
- package/dist/v1/perseed-api.mjs +2 -0
- package/dist/v1/perseed-api.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/lib-CDM5aEJG.cjs.map +0 -1
- package/dist/lib-XRCJ_UAQ.js.map +0 -1
- package/dist/src/test/global-setup.d.ts +0 -2
- package/dist/src/test/global-setup.d.ts.map +0 -1
|
@@ -24,4 +24,4 @@ function subtractPeriods(ms, value, unit, utc = false) {
|
|
|
24
24
|
exports.getPeriodStart = getPeriodStart;
|
|
25
25
|
exports.subtractPeriods = subtractPeriods;
|
|
26
26
|
exports.toCalendar = toCalendar;
|
|
27
|
-
//# sourceMappingURL=
|
|
27
|
+
//# sourceMappingURL=dates.helper-CDM5aEJG.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates.helper-CDM5aEJG.cjs","sources":["../../src/v2/modules/global/dates/dates.helper.ts"],"sourcesContent":["import dayjs from 'dayjs'\nimport utcPlugin from 'dayjs/plugin/utc'\nimport type { PeriodUnit } from './dates.schema'\n\n/**\n * Generic calendar primitives — period alignment and whole-period arithmetic. Built on `dayjs`\n * (already used by every consumer), so calendar arithmetic and month-end clamping come for free.\n *\n * These functions are locale-agnostic: the week start is always an injected number (1 = Monday …\n * 7 = Sunday), never derived here. Callers that need a locale-aware week start resolve it with\n * `global/locale`'s `getWeekStart(locale)` and pass the result in. That keeps this module free of\n * any dependency on other v2 modules.\n *\n * The `utc` flag selects the calendar the alignment runs in: `false` (default) uses the ambient\n * local calendar (a viewer's timezone); `true` uses UTC (the backend). Everything else is shared.\n */\n\ndayjs.extend(utcPlugin)\n\n// ISO Monday — the week start assumed when the caller doesn't inject a locale-derived one. Matches\n// DEFAULT_LOCALE (es-ES), whose week also starts on Monday.\nexport const DEFAULT_WEEK_START = 1\n\n// Builds the dayjs instance in the requested calendar (UTC or ambient local).\nexport function toCalendar(ms: number, utc: boolean): dayjs.Dayjs {\n return utc ? dayjs.utc(ms) : dayjs(ms)\n}\n\n// dayjs `.day()` is 0 = Sunday … 6 = Saturday; convert to ISO 1 = Monday … 7 = Sunday.\nfunction isoWeekday(d: dayjs.Dayjs): number {\n const day = d.day()\n return day === 0 ? 7 : day\n}\n\n/**\n * Aligns an instant to the start of the calendar period it falls in:\n * weeks → the injected first weekday at midnight, months → the 1st at midnight,\n * days → midnight, hours → the start of the hour. `utc` runs the alignment in UTC.\n */\nexport function getPeriodStart(\n ms: number,\n unit: PeriodUnit,\n weekStart: number = DEFAULT_WEEK_START,\n utc = false,\n): number {\n const d = toCalendar(ms, utc)\n if (unit === 'week') {\n // Not `startOf('week')`: that follows the dayjs locale, but the week start here is caller-driven.\n const diff = (isoWeekday(d) - weekStart + 7) % 7\n return d.subtract(diff, 'day').startOf('day').valueOf()\n }\n return d.startOf(unit).valueOf()\n}\n\n/**\n * Subtracts `value` whole calendar periods from an instant, without aligning. Month subtraction\n * clamps to the last day of the target month (e.g. 31 Mar − 1 month → 28 Feb), which dayjs does\n * natively. `utc` runs the arithmetic in UTC.\n */\nexport function subtractPeriods(ms: number, value: number, unit: PeriodUnit, utc = false): number {\n return toCalendar(ms, utc).subtract(value, unit).valueOf()\n}\n"],"names":[],"mappings":";;;AAiBA,MAAM,OAAO,SAAS;AAIf,MAAM,qBAAqB;AAG3B,SAAS,WAAW,IAAY,KAA2B;AAChE,SAAO,MAAM,MAAM,IAAI,EAAE,IAAI,MAAM,EAAE;AACvC;AAGA,SAAS,WAAW,GAAwB;AAC1C,QAAM,MAAM,EAAE,IAAA;AACd,SAAO,QAAQ,IAAI,IAAI;AACzB;AAOO,SAAS,eACd,IACA,MACA,YAAoB,oBACpB,MAAM,OACE;AACR,QAAM,IAAI,WAAW,IAAI,GAAG;AAC5B,MAAI,SAAS,QAAQ;AAEnB,UAAM,QAAQ,WAAW,CAAC,IAAI,YAAY,KAAK;AAC/C,WAAO,EAAE,SAAS,MAAM,KAAK,EAAE,QAAQ,KAAK,EAAE,QAAA;AAAA,EAChD;AACA,SAAO,EAAE,QAAQ,IAAI,EAAE,QAAA;AACzB;AAOO,SAAS,gBAAgB,IAAY,OAAe,MAAkB,MAAM,OAAe;AAChG,SAAO,WAAW,IAAI,GAAG,EAAE,SAAS,OAAO,IAAI,EAAE,QAAA;AACnD;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dates.helper-XRCJ_UAQ.js","sources":["../../src/v2/modules/global/dates/dates.helper.ts"],"sourcesContent":["import dayjs from 'dayjs'\nimport utcPlugin from 'dayjs/plugin/utc'\nimport type { PeriodUnit } from './dates.schema'\n\n/**\n * Generic calendar primitives — period alignment and whole-period arithmetic. Built on `dayjs`\n * (already used by every consumer), so calendar arithmetic and month-end clamping come for free.\n *\n * These functions are locale-agnostic: the week start is always an injected number (1 = Monday …\n * 7 = Sunday), never derived here. Callers that need a locale-aware week start resolve it with\n * `global/locale`'s `getWeekStart(locale)` and pass the result in. That keeps this module free of\n * any dependency on other v2 modules.\n *\n * The `utc` flag selects the calendar the alignment runs in: `false` (default) uses the ambient\n * local calendar (a viewer's timezone); `true` uses UTC (the backend). Everything else is shared.\n */\n\ndayjs.extend(utcPlugin)\n\n// ISO Monday — the week start assumed when the caller doesn't inject a locale-derived one. Matches\n// DEFAULT_LOCALE (es-ES), whose week also starts on Monday.\nexport const DEFAULT_WEEK_START = 1\n\n// Builds the dayjs instance in the requested calendar (UTC or ambient local).\nexport function toCalendar(ms: number, utc: boolean): dayjs.Dayjs {\n return utc ? dayjs.utc(ms) : dayjs(ms)\n}\n\n// dayjs `.day()` is 0 = Sunday … 6 = Saturday; convert to ISO 1 = Monday … 7 = Sunday.\nfunction isoWeekday(d: dayjs.Dayjs): number {\n const day = d.day()\n return day === 0 ? 7 : day\n}\n\n/**\n * Aligns an instant to the start of the calendar period it falls in:\n * weeks → the injected first weekday at midnight, months → the 1st at midnight,\n * days → midnight, hours → the start of the hour. `utc` runs the alignment in UTC.\n */\nexport function getPeriodStart(\n ms: number,\n unit: PeriodUnit,\n weekStart: number = DEFAULT_WEEK_START,\n utc = false,\n): number {\n const d = toCalendar(ms, utc)\n if (unit === 'week') {\n // Not `startOf('week')`: that follows the dayjs locale, but the week start here is caller-driven.\n const diff = (isoWeekday(d) - weekStart + 7) % 7\n return d.subtract(diff, 'day').startOf('day').valueOf()\n }\n return d.startOf(unit).valueOf()\n}\n\n/**\n * Subtracts `value` whole calendar periods from an instant, without aligning. Month subtraction\n * clamps to the last day of the target month (e.g. 31 Mar − 1 month → 28 Feb), which dayjs does\n * natively. `utc` runs the arithmetic in UTC.\n */\nexport function subtractPeriods(ms: number, value: number, unit: PeriodUnit, utc = false): number {\n return toCalendar(ms, utc).subtract(value, unit).valueOf()\n}\n"],"names":[],"mappings":";;AAiBA,MAAM,OAAO,SAAS;AAIf,MAAM,qBAAqB;AAG3B,SAAS,WAAW,IAAY,KAA2B;AAChE,SAAO,MAAM,MAAM,IAAI,EAAE,IAAI,MAAM,EAAE;AACvC;AAGA,SAAS,WAAW,GAAwB;AAC1C,QAAM,MAAM,EAAE,IAAA;AACd,SAAO,QAAQ,IAAI,IAAI;AACzB;AAOO,SAAS,eACd,IACA,MACA,YAAoB,oBACpB,MAAM,OACE;AACR,QAAM,IAAI,WAAW,IAAI,GAAG;AAC5B,MAAI,SAAS,QAAQ;AAEnB,UAAM,QAAQ,WAAW,CAAC,IAAI,YAAY,KAAK;AAC/C,WAAO,EAAE,SAAS,MAAM,KAAK,EAAE,QAAQ,KAAK,EAAE,QAAA;AAAA,EAChD;AACA,SAAO,EAAE,QAAQ,IAAI,EAAE,QAAA;AACzB;AAOO,SAAS,gBAAgB,IAAY,OAAe,MAAkB,MAAM,OAAe;AAChG,SAAO,WAAW,IAAI,GAAG,EAAE,SAAS,OAAO,IAAI,EAAE,QAAA;AACnD;"}
|
|
@@ -26,7 +26,6 @@ const conditionsFormatSchema = typebox.Type.Enum(Object.values(ConditionsFormat)
|
|
|
26
26
|
});
|
|
27
27
|
const TriggerSource = {
|
|
28
28
|
MODEL: "model",
|
|
29
|
-
DESIGNER: "designer",
|
|
30
29
|
DISPLAYER: "displayer"
|
|
31
30
|
};
|
|
32
31
|
const triggerSourceSchema = typebox.Type.Enum(Object.values(TriggerSource), {
|
|
@@ -150,12 +149,19 @@ const actionSchema = typebox.Type.Object(
|
|
|
150
149
|
description: "Project this action belongs to. Null when it is ecosystem-wide"
|
|
151
150
|
})
|
|
152
151
|
),
|
|
153
|
-
|
|
152
|
+
// Optional for the same reason as the trigger's: it labels the action where it is
|
|
153
|
+
// administered, and nothing renders it to whoever fires the trigger, so requiring it only
|
|
154
|
+
// forced a placeholder. Null when it has none.
|
|
155
|
+
name: typebox.Type.Optional(
|
|
156
|
+
typebox.Type.Union([typebox.Type.String({ maxLength: 255 }), typebox.Type.Null()], {
|
|
157
|
+
description: "Human-readable label of the action. Null when it has none"
|
|
158
|
+
})
|
|
159
|
+
),
|
|
154
160
|
type: actionTypeSchema,
|
|
155
161
|
config: actionConfigSchema,
|
|
156
162
|
retention_days: typebox.Type.Optional(
|
|
157
163
|
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
158
|
-
description: "Retention in days for the process_log entries of this action
|
|
164
|
+
description: "Retention in days for the process_log entries of this action. Null = inherit (use the firing trigger retention; never if the trigger is null/0); 0 = disabled (never expires, regardless of the trigger); N (>0) = enabled (expires N days after write)."
|
|
159
165
|
})
|
|
160
166
|
),
|
|
161
167
|
// Mirrors `dashboard_widget.library`. False by default, so an action created
|
|
@@ -203,6 +209,16 @@ const triggerActionInputSchema = typebox.Type.Union(
|
|
|
203
209
|
const triggerActionsInputSchema = typebox.Type.Array(triggerActionInputSchema, {
|
|
204
210
|
description: "Full ordered set of actions the trigger runs; the array position is the execution order. An empty array leaves the trigger with none"
|
|
205
211
|
});
|
|
212
|
+
const triggerNameSchema = typebox.Type.Optional(
|
|
213
|
+
typebox.Type.Union([typebox.Type.String({ maxLength: 255 }), typebox.Type.Null()], {
|
|
214
|
+
description: "Human-readable label of the trigger. Null when it has none"
|
|
215
|
+
})
|
|
216
|
+
);
|
|
217
|
+
const triggerDescriptionSchema = typebox.Type.Optional(
|
|
218
|
+
typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()], {
|
|
219
|
+
description: "What the trigger is for, for whoever administers it. Null when it has none"
|
|
220
|
+
})
|
|
221
|
+
);
|
|
206
222
|
const automaticTriggerSchema = typebox.Type.Object(
|
|
207
223
|
{
|
|
208
224
|
id: typebox.Type.Number({ description: "Unique identifier of the automatic trigger" }),
|
|
@@ -211,6 +227,8 @@ const automaticTriggerSchema = typebox.Type.Object(
|
|
|
211
227
|
description: "Project this trigger belongs to. Null when it is ecosystem-wide"
|
|
212
228
|
})
|
|
213
229
|
),
|
|
230
|
+
name: triggerNameSchema,
|
|
231
|
+
description: triggerDescriptionSchema,
|
|
214
232
|
source: triggerSourceSchema,
|
|
215
233
|
target: typebox.Type.Optional(
|
|
216
234
|
typebox.Type.Union([typebox.Type.String({ maxLength: 255 }), typebox.Type.Null()], {
|
|
@@ -235,7 +253,7 @@ const automaticTriggerSchema = typebox.Type.Object(
|
|
|
235
253
|
enabled: typebox.Type.Optional(typebox.Type.Boolean({ description: "Whether the trigger is active" })),
|
|
236
254
|
retention_days: typebox.Type.Optional(
|
|
237
255
|
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
238
|
-
description: "Retention in days for the process_log entries of this trigger
|
|
256
|
+
description: "Retention in days for the process_log entries of this trigger. Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write)."
|
|
239
257
|
})
|
|
240
258
|
)
|
|
241
259
|
},
|
|
@@ -254,6 +272,8 @@ const includeActionsQuerySchema = typebox.Type.Object(
|
|
|
254
272
|
);
|
|
255
273
|
const createAutomaticTriggerSchema = typebox.Type.Object(
|
|
256
274
|
{
|
|
275
|
+
name: triggerNameSchema,
|
|
276
|
+
description: triggerDescriptionSchema,
|
|
257
277
|
source: triggerSourceSchema,
|
|
258
278
|
target: typebox.Type.Optional(
|
|
259
279
|
typebox.Type.Union([typebox.Type.String({ maxLength: 255 }), typebox.Type.Null()], {
|
|
@@ -278,7 +298,7 @@ const createAutomaticTriggerSchema = typebox.Type.Object(
|
|
|
278
298
|
enabled: typebox.Type.Optional(typebox.Type.Boolean({ description: "Whether the trigger is active" })),
|
|
279
299
|
retention_days: typebox.Type.Optional(
|
|
280
300
|
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
281
|
-
description: "Retention in days for the process_log entries of this trigger
|
|
301
|
+
description: "Retention in days for the process_log entries of this trigger. Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write)."
|
|
282
302
|
})
|
|
283
303
|
),
|
|
284
304
|
actions: typebox.Type.Optional(triggerActionsInputSchema)
|
|
@@ -313,6 +333,11 @@ const iconPositionSchema = typebox.Type.Enum(Object.values(IconPosition), {
|
|
|
313
333
|
const manualTriggerButtonStyleSchema = typebox.Type.Object(
|
|
314
334
|
{
|
|
315
335
|
text: typebox.Type.Optional(typebox.Type.String({ description: "Handlebars template rendered as the button label" })),
|
|
336
|
+
tooltip: typebox.Type.Optional(
|
|
337
|
+
typebox.Type.String({
|
|
338
|
+
description: "Handlebars template rendered as the button tooltip. Written for whoever uses the listing, unlike `name`, which labels the trigger where it is administered"
|
|
339
|
+
})
|
|
340
|
+
),
|
|
316
341
|
textColor: typebox.Type.Optional(typebox.Type.String({ description: "Label colour" })),
|
|
317
342
|
bgColor: typebox.Type.Optional(typebox.Type.String({ description: "Background colour" })),
|
|
318
343
|
icon: typebox.Type.Optional(typebox.Type.String({ description: "Icon name, resolved by the consumer" })),
|
|
@@ -352,7 +377,8 @@ const manualTriggerSchema = typebox.Type.Object(
|
|
|
352
377
|
description: "Project this trigger belongs to. Null when it is ecosystem-wide"
|
|
353
378
|
})
|
|
354
379
|
),
|
|
355
|
-
name:
|
|
380
|
+
name: triggerNameSchema,
|
|
381
|
+
description: triggerDescriptionSchema,
|
|
356
382
|
source: triggerSourceSchema,
|
|
357
383
|
target: typebox.Type.String({
|
|
358
384
|
maxLength: 255,
|
|
@@ -371,7 +397,7 @@ const manualTriggerSchema = typebox.Type.Object(
|
|
|
371
397
|
enabled: typebox.Type.Optional(typebox.Type.Boolean({ description: "Whether the trigger is active" })),
|
|
372
398
|
retention_days: typebox.Type.Optional(
|
|
373
399
|
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
374
|
-
description: "Retention in days for the process_log entries of this trigger
|
|
400
|
+
description: "Retention in days for the process_log entries of this trigger. Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write)."
|
|
375
401
|
})
|
|
376
402
|
),
|
|
377
403
|
config: typebox.Type.Optional(
|
|
@@ -384,7 +410,8 @@ const manualTriggerSchema = typebox.Type.Object(
|
|
|
384
410
|
);
|
|
385
411
|
const createManualTriggerSchema = typebox.Type.Object(
|
|
386
412
|
{
|
|
387
|
-
name:
|
|
413
|
+
name: triggerNameSchema,
|
|
414
|
+
description: triggerDescriptionSchema,
|
|
388
415
|
source: triggerSourceSchema,
|
|
389
416
|
target: typebox.Type.String({
|
|
390
417
|
maxLength: 255,
|
|
@@ -403,7 +430,7 @@ const createManualTriggerSchema = typebox.Type.Object(
|
|
|
403
430
|
enabled: typebox.Type.Optional(typebox.Type.Boolean({ description: "Whether the trigger is active" })),
|
|
404
431
|
retention_days: typebox.Type.Optional(
|
|
405
432
|
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
406
|
-
description: "Retention in days for the process_log entries of this trigger
|
|
433
|
+
description: "Retention in days for the process_log entries of this trigger. Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write)."
|
|
407
434
|
})
|
|
408
435
|
),
|
|
409
436
|
config: typebox.Type.Optional(
|
|
@@ -427,7 +454,7 @@ const updateManualTriggerSchema = typebox.Type.Partial(createManualTriggerSchema
|
|
|
427
454
|
const manualTriggerAvailabilitySchema = typebox.Type.Object(
|
|
428
455
|
{
|
|
429
456
|
id: typebox.Type.Number({ description: "Identifier of the manual trigger" }),
|
|
430
|
-
name:
|
|
457
|
+
name: triggerNameSchema,
|
|
431
458
|
matched: typebox.Type.Boolean({
|
|
432
459
|
description: "Whether the trigger conditions hold for this entity right now. A trigger with no conditions always matches. False means the button is shown disabled: triggers configured to hide when unmatched are not listed"
|
|
433
460
|
}),
|
|
@@ -478,14 +505,6 @@ const automaticTriggerActionSchema = typebox.Type.Object(
|
|
|
478
505
|
},
|
|
479
506
|
{ title: "AutomaticTriggerAction", description: "Ordered link between an automatic trigger and an action" }
|
|
480
507
|
);
|
|
481
|
-
const createAutomaticTriggerActionSchema = typebox.Type.Omit(automaticTriggerActionSchema, ["id"], {
|
|
482
|
-
title: "CreateAutomaticTriggerAction",
|
|
483
|
-
description: "Row shape of an automatic trigger-action link"
|
|
484
|
-
});
|
|
485
|
-
const updateAutomaticTriggerActionSchema = typebox.Type.Partial(createAutomaticTriggerActionSchema, {
|
|
486
|
-
title: "UpdateAutomaticTriggerAction",
|
|
487
|
-
description: "Partial row shape of an automatic trigger-action link"
|
|
488
|
-
});
|
|
489
508
|
const manualTriggerActionSchema = typebox.Type.Object(
|
|
490
509
|
{
|
|
491
510
|
id: typebox.Type.Number({ description: "Unique identifier of the trigger-action link" }),
|
|
@@ -497,14 +516,6 @@ const manualTriggerActionSchema = typebox.Type.Object(
|
|
|
497
516
|
},
|
|
498
517
|
{ title: "ManualTriggerAction", description: "Ordered link between a manual trigger and an action" }
|
|
499
518
|
);
|
|
500
|
-
const createManualTriggerActionSchema = typebox.Type.Omit(manualTriggerActionSchema, ["id"], {
|
|
501
|
-
title: "CreateManualTriggerAction",
|
|
502
|
-
description: "Row shape of a manual trigger-action link"
|
|
503
|
-
});
|
|
504
|
-
const updateManualTriggerActionSchema = typebox.Type.Partial(createManualTriggerActionSchema, {
|
|
505
|
-
title: "UpdateManualTriggerAction",
|
|
506
|
-
description: "Partial row shape of a manual trigger-action link"
|
|
507
|
-
});
|
|
508
519
|
const withResolvedActions = typebox.Type.Object({
|
|
509
520
|
actions: typebox.Type.Optional(typebox.Type.Array(actionSchema, { description: "Actions the trigger runs, in execution order" }))
|
|
510
521
|
});
|
|
@@ -520,8 +531,11 @@ const triggerExecutionResultSchema = typebox.Type.Object(
|
|
|
520
531
|
{
|
|
521
532
|
triggerId: typebox.Type.Number({ description: "Identifier of the evaluated trigger" }),
|
|
522
533
|
matched: typebox.Type.Boolean({ description: "Whether the conditions held, so the actions were run" }),
|
|
523
|
-
actionsRun: typebox.Type.Number({ description: "Number of actions that were executed" }),
|
|
524
|
-
actionsAborted: typebox.Type.Number({ description: "Number of actions aborted by context validation" })
|
|
534
|
+
actionsRun: typebox.Type.Number({ description: "Number of actions that were executed, whether they succeeded or not" }),
|
|
535
|
+
actionsAborted: typebox.Type.Number({ description: "Number of actions aborted by context validation" }),
|
|
536
|
+
actionsFailed: typebox.Type.Number({
|
|
537
|
+
description: "Number of executed actions that ended in error. A subset of actionsRun"
|
|
538
|
+
})
|
|
525
539
|
},
|
|
526
540
|
{ title: "TriggerExecutionResult", description: "Outcome of evaluating and running one trigger" }
|
|
527
541
|
);
|
|
@@ -553,9 +567,7 @@ exports.automaticTriggerSchema = automaticTriggerSchema;
|
|
|
553
567
|
exports.automaticTriggerWithActionsSchema = automaticTriggerWithActionsSchema;
|
|
554
568
|
exports.conditionsFormatSchema = conditionsFormatSchema;
|
|
555
569
|
exports.createActionSchema = createActionSchema;
|
|
556
|
-
exports.createAutomaticTriggerActionSchema = createAutomaticTriggerActionSchema;
|
|
557
570
|
exports.createAutomaticTriggerSchema = createAutomaticTriggerSchema;
|
|
558
|
-
exports.createManualTriggerActionSchema = createManualTriggerActionSchema;
|
|
559
571
|
exports.createManualTriggerSchema = createManualTriggerSchema;
|
|
560
572
|
exports.iconPositionSchema = iconPositionSchema;
|
|
561
573
|
exports.includeActionsQuerySchema = includeActionsQuerySchema;
|
|
@@ -578,9 +590,7 @@ exports.triggerRelationsSchema = triggerRelationsSchema;
|
|
|
578
590
|
exports.triggerSourceSchema = triggerSourceSchema;
|
|
579
591
|
exports.unmatchedBehaviorSchema = unmatchedBehaviorSchema;
|
|
580
592
|
exports.updateActionSchema = updateActionSchema;
|
|
581
|
-
exports.updateAutomaticTriggerActionSchema = updateAutomaticTriggerActionSchema;
|
|
582
593
|
exports.updateAutomaticTriggerSchema = updateAutomaticTriggerSchema;
|
|
583
|
-
exports.updateManualTriggerActionSchema = updateManualTriggerActionSchema;
|
|
584
594
|
exports.updateManualTriggerSchema = updateManualTriggerSchema;
|
|
585
595
|
exports.withIdParamsSchema = withIdParamsSchema;
|
|
586
596
|
//# sourceMappingURL=ecosystem-action-system.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecosystem-action-system.cjs","sources":["../../src/v2/routes/v2/ecosystem/_ecosystemName/param.schema.ts","../../src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/params.schema.ts","../../src/v2/modules/ecosystem/action-system/action-system.schema.ts"],"sourcesContent":["import { Type } from 'typebox'\n\nexport const ecosystemParamsSchema = Type.Object(\n {\n ecosystemName: Type.String({ maxLength: 255, description: 'Ecosystem name code' }),\n },\n { title: 'EcosystemParams', description: 'Params with ecosystem name' },\n)\n","import { Type } from 'typebox'\nimport { ecosystemParamsSchema } from '@/routes/v2/ecosystem/_ecosystemName/param.schema'\n\nexport const ecosystemProjectParamsSchema = Type.Intersect(\n [\n ecosystemParamsSchema,\n Type.Object({\n projectName: Type.String({ maxLength: 255, description: 'Project name code' }),\n }),\n ],\n { title: 'EcosystemProjectParams', description: 'Params with ecosystem name and project name' },\n)\n","import { Type, Static, type TSchema } from 'typebox'\nimport { ecosystemProjectParamsSchema } from '@/routes/v2/ecosystem/_ecosystemName/project/_projectName/params.schema'\n\n// ── Enums / literal unions ────────────────────────────────────────────\n// Each enum is a const object (source of truth, ergonomic dot access like\n// `TriggerSource.MODEL`) from which the runtime schema is derived with\n// `Type.Enum(Object.values(...))` and the type with `Static`.\n\nexport const ConditionsFormat = {\n JSON_LOGIC: 'jsonLogic',\n CUSTOM: 'custom',\n} as const\nexport const conditionsFormatSchema = Type.Enum(Object.values(ConditionsFormat), {\n title: 'ConditionsFormat',\n description: 'Format of the conditions evaluated by the conditions matcher',\n})\nexport type ConditionsFormat = Static<typeof conditionsFormatSchema>\n\nexport const TriggerSource = {\n MODEL: 'model',\n DESIGNER: 'designer',\n DISPLAYER: 'displayer',\n} as const\nexport const triggerSourceSchema = Type.Enum(Object.values(TriggerSource), {\n title: 'TriggerSource',\n description: 'Source of the event that fires a trigger',\n})\nexport type TriggerSource = Static<typeof triggerSourceSchema>\n\nexport const TriggerOperation = {\n CREATE: 'create',\n UPDATE: 'update',\n DELETE: 'delete',\n} as const\nexport const triggerOperationSchema = Type.Enum(Object.values(TriggerOperation), {\n title: 'TriggerOperation',\n description: 'Operation on the target that fires the trigger',\n})\nexport type TriggerOperation = Static<typeof triggerOperationSchema>\n\n// Executable mechanism of an action. `ApiAction` now; extensible to\n// `ExternalApiCall`, `Webhook`, … in the future (each adds a member here plus a\n// config schema below).\nexport const ActionType = {\n API_ACTION: 'ApiAction',\n} as const\nexport const actionTypeSchema = Type.Enum(Object.values(ActionType), {\n title: 'ActionType',\n description: 'Executable mechanism of an action',\n})\nexport type ActionType = Static<typeof actionTypeSchema>\n\n// ── Action config (discriminated union by `actions.type`) ─────────────\n// Forward-compatible contract shared with front/app via @persei/perseed-api.\n// Principles that the structure keeps prepared (not implemented here):\n// - `id` + fixed per-type fields: every type extends `ActionConfigBase`, so its\n// structure is known from `actions.type`.\n// - Objects always under a key (`payload`, …), never loose object fields, so new\n// fields can be added later without breaking compatibility.\n// - default + override: a type may carry a default config plus a `payload` that\n// overrides parts of it, both with the same typing (effective config = merge).\n//\n// `overridable`/`default`/`location` are generic base support for future\n// override-types (e.g. `ExternalApiCall`, #175): an override-type MUST declare\n// `overridable` (the allow-list of keys its payload may override on top of\n// `default`); `location` is a generic string here, refined per type when a\n// concrete type needs it. `ApiAction` is NOT an override-type — its `payload`\n// is the Handlebars data mapping, not an override of a default config — so it\n// gains these fields optionally but never sets `overridable`/`default`.\n\nexport const actionConfigBaseSchema = Type.Object(\n {\n id: Type.String({\n description:\n 'Identifier of the concrete action within its type (e.g. the ApiAction value for type \"ApiAction\"). Any identifier for future types.',\n }),\n location: Type.Optional(\n Type.String({\n description:\n 'Where the effective config is resolved from. Generic string in the base; refined per type in the future (e.g. \"inline\" | \"file\").',\n }),\n ),\n overridable: Type.Optional(\n Type.Array(Type.String(), {\n description:\n 'Allow-list of config keys a payload may override on top of `default`. Mandatory for override-types; absent for non-override types such as ApiAction.',\n }),\n ),\n default: Type.Optional(\n Type.Record(Type.String(), Type.Unknown(), {\n description: 'Base config an override-type merges its `payload` over (only overridable keys are applied).',\n }),\n ),\n },\n { title: 'ActionConfigBase', description: 'Base fields shared by every action config' },\n)\nexport type ActionConfigBaseData = Static<typeof actionConfigBaseSchema>\n\n// type = 'ApiAction' (current). `payload` is the data mapping needed to run the\n// ApiAction; it is always an object under a key for forward compatibility.\nexport const apiActionConfigSchema = Type.Intersect(\n [\n actionConfigBaseSchema,\n Type.Object({\n payload: Type.Record(Type.String(), Type.Unknown(), {\n description: 'Data mapping needed to run the ApiAction',\n }),\n }),\n ],\n { title: 'ApiActionConfig', description: 'Config for actions of type \"ApiAction\"' },\n)\nexport type ApiActionConfig = Static<typeof apiActionConfigSchema>\n\n// Discriminated (by `actions.type`) union of every action config. Extensible:\n// new types add a member that inherits from `ActionConfigBase`.\nexport const actionConfigSchema = Type.Union([apiActionConfigSchema], {\n title: 'ActionConfig',\n description: 'Union of action configs, selected by actions.type',\n})\nexport type ActionConfig = Static<typeof actionConfigSchema>\n\n// Registry mapping each action type to its config schema. Single seam to extend\n// when a new type is added, and the source used to validate a config by type.\nexport const ACTION_CONFIG_SCHEMAS: Record<ActionType, TSchema> = {\n [ActionType.API_ACTION]: apiActionConfigSchema,\n}\n\n// ── Action context (assembled data each action type evaluates against) ─\n// Mirrors the config-schema pattern above but for the *runtime* context\n// (jsonLogic conditions + handlebars payload refs are resolved against it),\n// not the static config. `additionalProperties: true` because the context is\n// enriched dynamically by the engine/ApiActionController (e.g. `ctx`).\n\nexport const actionContextBaseSchema = Type.Object(\n {\n current: Type.Record(Type.String(), Type.Unknown(), {\n description: 'Current state of the entity that fired the event',\n }),\n old: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Previous state of the entity, when applicable (e.g. update/delete). Null otherwise',\n }),\n ),\n requestContextData: Type.Optional(\n Type.Unknown({ description: 'Snapshot of the request context (user, ecosystem, project…) when available' }),\n ),\n // Declared even though `additionalProperties: true` would already let it through: what a\n // condition may be written against is part of the contract, and a field only the engine knows\n // about is one no admin can discover.\n requester: Type.Optional(\n Type.Unknown({\n description:\n 'Who is making the request — role, administrator flags, privileges and clinics of their profiling in the project. Absent when the request carries no user (an internal call, a job)',\n }),\n ),\n projectId: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'Project the event belongs to. Null for ecosystem-wide events',\n }),\n ),\n },\n {\n title: 'ActionContextBase',\n description: 'Base fields of the context assembled for every action execution',\n additionalProperties: true,\n },\n)\nexport type ActionContextBaseData = Static<typeof actionContextBaseSchema>\n\n// type = 'ApiAction' (current). No extra required keys beyond the base context\n// yet; kept as a distinct schema so future types can refine it independently.\nexport const apiActionContextSchema = actionContextBaseSchema\n\n// Registry mapping each action type to its context schema. Mirrors\n// `ACTION_CONFIG_SCHEMAS` — single seam to extend when a new type is added.\nexport const ACTION_CONTEXT_SCHEMAS: Record<ActionType, TSchema> = {\n [ActionType.API_ACTION]: apiActionContextSchema,\n}\n\n// Related models to load into the context before a trigger is evaluated — the\n// \"Load relations\" selector of the admin UI. Declared explicitly instead of being\n// derived from the paths a trigger uses: an action templating the whole context\n// (`{{json current}}`) references `current`, never `current.patient`, so deriving\n// would tie the loaded data to how a template is written rather than to what the\n// action needs. An object (not a bare list) because assembling the context has\n// historically taken more than one knob, leaving room to grow.\n//\n// Closed to unknown keys on purpose. The legacy trigger system had a second knob,\n// `load_patient` (`{where, join}`), with semantics this engine does not implement:\n// accepting it would persist a configuration that is then silently ignored, so a\n// trigger would look configured while its conditions never see the related data.\n// Rejecting it at the edge surfaces the mismatch as a 400 instead. Adding a knob\n// here is a deliberate act: declare the field AND read it in `loadRelations`.\nexport const triggerRelationsSchema = Type.Object(\n {\n join: Type.Optional(\n Type.Array(\n // A relation name, not free text: it is interpolated into the eager-loading graph\n // expression. Objection resolves it against the relations declared on the model (never\n // SQL), so an unknown name throws rather than leaking data — but validating the shape\n // here turns that runtime failure into a 400 at the edge, which is cheaper to diagnose.\n Type.String({ pattern: '^[A-Za-z_][A-Za-z0-9_]*$' }),\n { description: 'Relation names to eager-load onto `current` (e.g. [\"patient\"])' },\n ),\n ),\n },\n { title: 'TriggerRelations', additionalProperties: false },\n)\nexport type TriggerRelations = Static<typeof triggerRelationsSchema>\n\n// ── actions (independent reusable catalog) ────────────────────────────\n// Declared before the triggers because a trigger payload can carry actions\n// inline (see `triggerActionsInputSchema` below).\n\nexport const actionSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the action' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'Project this action belongs to. Null when it is ecosystem-wide',\n }),\n ),\n name: Type.String({ maxLength: 255, description: 'Human-readable identifier of the action' }),\n type: actionTypeSchema,\n config: actionConfigSchema,\n retention_days: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Retention in days for the process_log entries of this action (issue #175). Null = inherit (use the firing trigger retention; never if the trigger is null/0); 0 = disabled (never expires, regardless of the trigger); N (>0) = enabled (expires N days after write).',\n }),\n ),\n // Mirrors `dashboard_widget.library`. False by default, so an action created\n // inline from a trigger screen is single-use unless it is said otherwise.\n library: Type.Optional(\n Type.Boolean({\n description:\n 'Whether the action belongs to the reusable catalog. False (the default) marks it single-use: it is deleted once no trigger links it any more, including before it is ever linked — a standalone action created through POST /action and left unlinked is swept as soon as any trigger of the project writes its links. Set it to true to create one that survives on its own',\n }),\n ),\n },\n { title: 'Action', description: 'Reusable executable action (ecosystem level)' },\n)\nexport type ActionData = Static<typeof actionSchema>\n\n// `Type.Omit` keeps this a plain object — unlike `Type.Intersect` — so closing it here works: an\n// undeclared key is rejected with its name instead of being dropped on the way in. `id` and\n// `project_id` are omitted because the server sets them.\nexport const createActionSchema = Type.Omit(actionSchema, ['id', 'project_id'], {\n title: 'CreateAction',\n description: 'Payload used to create an action',\n additionalProperties: false,\n})\nexport type CreateActionData = Static<typeof createActionSchema>\n\n// Restated: `Type.Partial` rebuilds the object and does not carry over the options it derives from.\nexport const updateActionSchema = Type.Partial(createActionSchema, {\n title: 'UpdateAction',\n description: 'Payload used to update an action',\n additionalProperties: false,\n})\nexport type UpdateActionData = Static<typeof updateActionSchema>\n\n// ── Actions carried by a trigger payload ──────────────────────────────\n// One array, not two fields (`action_ids` + `new_actions`): the position IS the\n// `execution_order`, so splitting the list would make an order that interleaves\n// new and existing actions inexpressible. Each item takes one of three forms,\n// which `number` vs object and object with/without `id` disambiguate on their\n// own — no marker field needed:\n//\n// number link an existing catalog action, untouched\n// object without `id` create the action and link it\n// object with `id` update that catalog action and link it\n//\n// An object carrying only `id` is equivalent to passing the bare number.\n//\n// A malformed id is rejected rather than reinterpreted: `{ id: \"55\", name, type, config }` matches\n// no branch — the update one needs a numeric `id`, and the create one is closed against the key —\n// so it answers 400 instead of quietly landing on \"create a new action\".\nexport const triggerActionInputSchema = Type.Union(\n [\n Type.Number({ description: 'Identifier of an existing action to link, left untouched' }),\n Type.Object(\n { ...createActionSchema.properties },\n {\n title: 'TriggerActionCreate',\n description: 'Action created and linked in the same request',\n additionalProperties: false,\n },\n ),\n Type.Object(\n { id: Type.Number(), ...updateActionSchema.properties },\n {\n title: 'TriggerActionUpdate',\n description: 'Existing action updated and linked in the same request',\n additionalProperties: false,\n },\n ),\n ],\n { title: 'TriggerActionInput', description: 'An action a trigger runs: linked, created, or updated in place' },\n)\nexport type TriggerActionInput = Static<typeof triggerActionInputSchema>\n\nexport const triggerActionsInputSchema = Type.Array(triggerActionInputSchema, {\n description:\n 'Full ordered set of actions the trigger runs; the array position is the execution order. An empty array leaves the trigger with none',\n})\n\n// ── automatic_trigger ─────────────────────────────────────────────────\n\nexport const automaticTriggerSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the automatic trigger' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'Project this trigger belongs to. Null when it is ecosystem-wide',\n }),\n ),\n source: triggerSourceSchema,\n target: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Concrete model/designer/field the event refers to. Null for sourceless events',\n }),\n ),\n operation: Type.Optional(\n Type.Union([triggerOperationSchema, Type.Null()], {\n description: 'Operation on the target that fires the trigger. Null when not applicable',\n }),\n ),\n conditions: Type.Optional(\n Type.Union([Type.Object({}, { additionalProperties: true }), Type.Null()], {\n description: 'jsonLogic conditions (root object) evaluated to decide whether the trigger runs',\n }),\n ),\n relations: Type.Optional(\n Type.Union([triggerRelationsSchema, Type.Null()], {\n description:\n 'Related models loaded into the context before evaluating the conditions and running the actions. Null means none.',\n }),\n ),\n enabled: Type.Optional(Type.Boolean({ description: 'Whether the trigger is active' })),\n retention_days: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Retention in days for the process_log entries of this trigger (issue #175). Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write).',\n }),\n ),\n },\n { title: 'AutomaticTrigger', description: 'Automatic trigger definition (ecosystem level)' },\n)\nexport type AutomaticTriggerData = Static<typeof automaticTriggerSchema>\n\n// `includeActions` arrives from the query string, where everything is a string: Fastify coerces\n// `?includeActions=true` to a boolean against this schema, so the handler reads a real boolean.\n//\n// Opt-in rather than always-on: the join costs a query per trigger and most reads do not need it.\n// The read reuses the `*WithActions` schema of each kind (declared with the write responses below):\n// `actions` is optional there, so with the flag off the key is simply absent — the same way a\n// write that did not touch the field says nothing about it instead of reporting an empty set.\n//\n// Shared by both trigger kinds: the flag means the same thing on each, and the query schema carries\n// no kind-specific field.\nexport const includeActionsQuerySchema = Type.Object(\n {\n includeActions: Type.Optional(\n Type.Boolean({\n default: false,\n description: 'Return each trigger with its ordered `actions` resolved, in a single request',\n }),\n ),\n },\n { title: 'IncludeActionsQuery', description: 'Opt-in flag to embed the actions of a trigger' },\n)\n\n// Written out rather than derived from `automaticTriggerSchema`: a request schema and an entity\n// schema answer different questions — what a client may send vs what a row holds — and only the\n// first can close itself. `additionalProperties: false` does not survive `Type.Intersect`, so a\n// derived payload had to be cleaned before validating, which dropped unknown keys silently. Spelled\n// out, an undeclared key is a 400 that names it, and `id`/`project_id` are absent because the server\n// owns them, not because an `Omit` removed them.\nexport const createAutomaticTriggerSchema = Type.Object(\n {\n source: triggerSourceSchema,\n target: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Concrete model/designer/field the event refers to. Null for sourceless events',\n }),\n ),\n operation: Type.Optional(\n Type.Union([triggerOperationSchema, Type.Null()], {\n description: 'Operation on the target that fires the trigger. Null when not applicable',\n }),\n ),\n conditions: Type.Optional(\n Type.Union([Type.Object({}, { additionalProperties: true }), Type.Null()], {\n description: 'jsonLogic conditions (root object) evaluated to decide whether the trigger runs',\n }),\n ),\n relations: Type.Optional(\n Type.Union([triggerRelationsSchema, Type.Null()], {\n description:\n 'Related models loaded into the context before evaluating the conditions and running the actions. Null means none.',\n }),\n ),\n enabled: Type.Optional(Type.Boolean({ description: 'Whether the trigger is active' })),\n retention_days: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Retention in days for the process_log entries of this trigger (issue #175). Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write).',\n }),\n ),\n actions: Type.Optional(triggerActionsInputSchema),\n },\n {\n title: 'CreateAutomaticTrigger',\n description: 'Payload used to create an automatic trigger, optionally with the actions it runs',\n additionalProperties: false,\n },\n)\nexport type CreateAutomaticTriggerData = Static<typeof createAutomaticTriggerSchema>\n\n// `actions` is inherited from the create schema and stays optional here, which is\n// what the update contract wants: absent leaves the links untouched, present\n// replaces the whole ordered set (never merges), `[]` leaves the trigger with none.\n// `additionalProperties: false` is restated: `Type.Partial` rebuilds the object and drops the\n// options of the schema it derives from, so inheriting it would leave this payload open.\nexport const updateAutomaticTriggerSchema = Type.Partial(createAutomaticTriggerSchema, {\n title: 'UpdateAutomaticTrigger',\n description: 'Payload used to update an automatic trigger, optionally replacing the actions it runs',\n additionalProperties: false,\n})\nexport type UpdateAutomaticTriggerData = Static<typeof updateAutomaticTriggerSchema>\n\n// ── manual_trigger ────────────────────────────────────────────────────\n\n// What the consumer does with the button when the trigger conditions do not hold. It lives at the\n// root of the config, outside `styles`, so no conditional style can reach it: whether the button is\n// active is decided by the trigger conditions alone, and the style system only dresses it.\nexport const UnmatchedBehavior = {\n HIDE: 'hide',\n DISABLE: 'disable',\n} as const\nexport const unmatchedBehaviorSchema = Type.Enum(Object.values(UnmatchedBehavior), {\n title: 'UnmatchedBehavior',\n description: 'What to do with the button when the trigger does not match: hide it or disable it',\n})\nexport type UnmatchedBehavior = Static<typeof unmatchedBehaviorSchema>\n\nexport const IconPosition = {\n LEFT: 'left',\n RIGHT: 'right',\n} as const\nexport const iconPositionSchema = Type.Enum(Object.values(IconPosition), {\n title: 'IconPosition',\n description: 'Side of the label the icon sits on',\n})\nexport type IconPosition = Static<typeof iconPositionSchema>\n\nexport const manualTriggerButtonStyleSchema = Type.Object(\n {\n text: Type.Optional(Type.String({ description: 'Handlebars template rendered as the button label' })),\n textColor: Type.Optional(Type.String({ description: 'Label colour' })),\n bgColor: Type.Optional(Type.String({ description: 'Background colour' })),\n icon: Type.Optional(Type.String({ description: 'Icon name, resolved by the consumer' })),\n iconPosition: Type.Optional(iconPositionSchema),\n },\n { title: 'ManualTriggerButtonStyle', description: 'Presentation of the button a manual trigger is offered on' },\n)\nexport type ManualTriggerButtonStyleData = Static<typeof manualTriggerButtonStyleSchema>\n\n// Same shape as the base style plus the conditions that select it. Every style field is optional:\n// an entry only overrides what it declares.\nexport const manualTriggerConditionalStyleSchema = Type.Intersect(\n [\n manualTriggerButtonStyleSchema,\n Type.Object({\n conditions: Type.Optional(\n Type.Union([Type.Object({}, { additionalProperties: true }), Type.Null()], {\n description: 'jsonLogic conditions selecting this style. Absent or null always applies',\n }),\n ),\n continueEvaluate: Type.Optional(\n Type.Boolean({ description: 'Keep evaluating later entries after this one matches' }),\n ),\n }),\n ],\n { title: 'ManualTriggerConditionalStyle' },\n)\nexport type ManualTriggerConditionalStyleData = Static<typeof manualTriggerConditionalStyleSchema>\n\n/**\n * Envelope for everything a manual trigger configures beyond its firing rules. Today it carries\n * whether an unmatched trigger is hidden or shown disabled, plus the button presentation;\n * `additionalProperties` stays open so a future concern can be added without another column.\n *\n * The two are deliberately separate concerns: `unmatchedBehavior` answers whether the button is\n * offered at all, which only the trigger `conditions` decide, while `styles`/`conditionalStyles`\n * only dress a button that is already going to be shown.\n */\nexport const manualTriggerConfigSchema = Type.Object(\n {\n unmatchedBehavior: Type.Optional(unmatchedBehaviorSchema),\n styles: Type.Optional(manualTriggerButtonStyleSchema),\n conditionalStyles: Type.Optional(Type.Array(manualTriggerConditionalStyleSchema)),\n },\n { title: 'ManualTriggerConfig', additionalProperties: true },\n)\nexport type ManualTriggerConfigData = Static<typeof manualTriggerConfigSchema>\n\nexport const manualTriggerSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the manual trigger' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'Project this trigger belongs to. Null when it is ecosystem-wide',\n }),\n ),\n name: Type.String({ maxLength: 255, description: 'Human-readable label of the trigger where it is offered' }),\n source: triggerSourceSchema,\n target: Type.String({\n maxLength: 255,\n description: 'Concrete model/designer/field the trigger is bound to. Always set: there is no wildcard',\n }),\n conditions: Type.Optional(\n Type.Union([Type.Object({}, { additionalProperties: true }), Type.Null()], {\n description:\n 'jsonLogic conditions (root object) evaluated to decide whether the trigger runs. Evaluated against the selected entity and the request context; `old` is always null, because the trigger is invoked explicitly and there is no previous state to compare against.',\n }),\n ),\n relations: Type.Optional(\n Type.Union([triggerRelationsSchema, Type.Null()], {\n description:\n 'Related models loaded into the context before evaluating the conditions and running the actions. Null means none.',\n }),\n ),\n enabled: Type.Optional(Type.Boolean({ description: 'Whether the trigger is active' })),\n retention_days: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Retention in days for the process_log entries of this trigger (issue #175). Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write).',\n }),\n ),\n config: Type.Optional(\n Type.Union([manualTriggerConfigSchema, Type.Null()], {\n description: 'Configuration of the trigger beyond its firing rules. Null means none',\n }),\n ),\n },\n { title: 'ManualTrigger', description: 'Manual trigger definition (ecosystem level)' },\n)\nexport type ManualTriggerData = Static<typeof manualTriggerSchema>\n\n// Written out and closed, for the same reasons as `createAutomaticTriggerSchema` above.\nexport const createManualTriggerSchema = Type.Object(\n {\n name: Type.String({ maxLength: 255, description: 'Human-readable label of the trigger where it is offered' }),\n source: triggerSourceSchema,\n target: Type.String({\n maxLength: 255,\n description: 'Concrete model/designer/field the trigger is bound to. Always set: there is no wildcard',\n }),\n conditions: Type.Optional(\n Type.Union([Type.Object({}, { additionalProperties: true }), Type.Null()], {\n description:\n 'jsonLogic conditions (root object) evaluated to decide whether the trigger runs. Evaluated against the selected entity and the request context; `old` is always null, because the trigger is invoked explicitly and there is no previous state to compare against.',\n }),\n ),\n relations: Type.Optional(\n Type.Union([triggerRelationsSchema, Type.Null()], {\n description:\n 'Related models loaded into the context before evaluating the conditions and running the actions. Null means none.',\n }),\n ),\n enabled: Type.Optional(Type.Boolean({ description: 'Whether the trigger is active' })),\n retention_days: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Retention in days for the process_log entries of this trigger (issue #175). Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write).',\n }),\n ),\n config: Type.Optional(\n Type.Union([manualTriggerConfigSchema, Type.Null()], {\n description: 'Configuration of the trigger beyond its firing rules. Null means none',\n }),\n ),\n actions: Type.Optional(triggerActionsInputSchema),\n },\n {\n title: 'CreateManualTrigger',\n description: 'Payload used to create a manual trigger, optionally with the actions it runs',\n additionalProperties: false,\n },\n)\nexport type CreateManualTriggerData = Static<typeof createManualTriggerSchema>\n\n// Same inheritance and semantics as `updateAutomaticTriggerSchema`.\nexport const updateManualTriggerSchema = Type.Partial(createManualTriggerSchema, {\n title: 'UpdateManualTrigger',\n description: 'Payload used to update a manual trigger, optionally replacing the actions it runs',\n additionalProperties: false,\n})\nexport type UpdateManualTriggerData = Static<typeof updateManualTriggerSchema>\n\n// What the listing endpoint returns per applicable manual trigger: enough to\n// render it and nothing more. Only triggers that are going to be shown are\n// listed, so `matched: false` means a button rendered disabled, never a hidden\n// one. `matched` is never an authorisation: running re-evaluates server-side.\nexport const manualTriggerAvailabilitySchema = Type.Object(\n {\n id: Type.Number({ description: 'Identifier of the manual trigger' }),\n name: Type.String({ description: 'Human-readable label of the trigger' }),\n matched: Type.Boolean({\n description:\n 'Whether the trigger conditions hold for this entity right now. A trigger with no conditions always matches. False means the button is shown disabled: triggers configured to hide when unmatched are not listed',\n }),\n actionsCount: Type.Number({ description: 'Number of actions the trigger would run' }),\n relationsSkipped: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description:\n 'Reason the declared relations could not be loaded before evaluating, when that happened. Null otherwise',\n }),\n ),\n /**\n * Resolved server-side: conditional styles already evaluated and label already compiled. Absent\n * when the trigger has no config — the consumer then paints its own default button.\n */\n style: Type.Optional(manualTriggerButtonStyleSchema),\n },\n {\n title: 'ManualTriggerAvailability',\n description: 'A manual trigger applicable to an entity, with its conditions already evaluated',\n },\n)\nexport type ManualTriggerAvailability = Static<typeof manualTriggerAvailabilitySchema>\n\nexport const manualTriggerAvailabilityListSchema = Type.Object(\n { results: Type.Array(manualTriggerAvailabilitySchema, { description: 'Applicable manual triggers' }) },\n {\n title: 'ManualTriggerAvailabilityList',\n description: 'Manual triggers applicable to an entity, with their conditions evaluated',\n },\n)\n\n// Query the listing endpoint is called with: the entity the triggers are offered\n// on. `source`/`target` are the coordinates a manual trigger is bound to, and\n// `entityId` the concrete row.\nexport const manualTriggerAvailabilityQuerySchema = Type.Object(\n {\n source: triggerSourceSchema,\n target: Type.String({ maxLength: 255, description: 'Concrete model/designer/field the triggers are bound to' }),\n entityId: Type.Number({ description: 'Identifier of the entity the triggers would run against' }),\n },\n { title: 'ManualTriggerAvailabilityQuery', description: 'Entity the applicable manual triggers are listed for' },\n)\nexport type ManualTriggerAvailabilityQuery = Static<typeof manualTriggerAvailabilityQuerySchema>\n\n// Body of the run endpoint. It carries only the entity: `source`/`target` are\n// read from the trigger row, never from the client, so a trigger cannot be\n// re-pointed at an entity it was not bound to.\nexport const runManualTriggerSchema = Type.Object(\n { entityId: Type.Number({ description: 'Identifier of the entity to run the trigger against' }) },\n { title: 'RunManualTrigger', description: 'Payload used to run a manual trigger against an entity' },\n)\nexport type RunManualTriggerData = Static<typeof runManualTriggerSchema>\n\n// ── automatic_trigger_action (intermediate N:M automatic_trigger↔actions,\n// ordered) ──────────────────────────────────────────────────────────────\n// Dedicated table per trigger kind (no ORM polymorphism): `automatic_trigger_id`\n// is a real FK. `manual_trigger_action` is a future table for manual triggers.\n\nexport const automaticTriggerActionSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the trigger-action link' }),\n automatic_trigger_id: Type.Number({\n description: 'Automatic trigger executing the action (FK to automatic_trigger)',\n }),\n action_id: Type.Number({ description: 'Action executed by the trigger (FK to actions)' }),\n execution_order: Type.Number({ description: 'Execution order of the action within the trigger' }),\n },\n { title: 'AutomaticTriggerAction', description: 'Ordered link between an automatic trigger and an action' },\n)\nexport type AutomaticTriggerActionData = Static<typeof automaticTriggerActionSchema>\n\n// The `create*`/`update*` pair below is not an endpoint contract: the links are\n// written through the `actions` field of the trigger create/update payloads.\n// They remain because `action-system.model.ts` builds the Objection\n// `jsonSchema` of the link models out of their union.\nexport const createAutomaticTriggerActionSchema = Type.Omit(automaticTriggerActionSchema, ['id'], {\n title: 'CreateAutomaticTriggerAction',\n description: 'Row shape of an automatic trigger-action link',\n})\nexport type CreateAutomaticTriggerActionData = Static<typeof createAutomaticTriggerActionSchema>\n\nexport const updateAutomaticTriggerActionSchema = Type.Partial(createAutomaticTriggerActionSchema, {\n title: 'UpdateAutomaticTriggerAction',\n description: 'Partial row shape of an automatic trigger-action link',\n})\nexport type UpdateAutomaticTriggerActionData = Static<typeof updateAutomaticTriggerActionSchema>\n\n// ── manual_trigger_action (intermediate N:M manual_trigger↔actions,\n// ordered) ──────────────────────────────────────────────────────────────\n// Same dedicated-table-per-trigger-kind rule as `automatic_trigger_action`:\n// `manual_trigger_id` is a real FK, and the `actions` catalog is shared\n// between kinds — only the link table differs.\n\nexport const manualTriggerActionSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the trigger-action link' }),\n manual_trigger_id: Type.Number({\n description: 'Manual trigger executing the action (FK to manual_trigger)',\n }),\n action_id: Type.Number({ description: 'Action executed by the trigger (FK to actions)' }),\n execution_order: Type.Number({ description: 'Execution order of the action within the trigger' }),\n },\n { title: 'ManualTriggerAction', description: 'Ordered link between a manual trigger and an action' },\n)\nexport type ManualTriggerActionData = Static<typeof manualTriggerActionSchema>\n\n// Same as the automatic pair above: kept for the model `jsonSchema`, not as an\n// endpoint contract.\nexport const createManualTriggerActionSchema = Type.Omit(manualTriggerActionSchema, ['id'], {\n title: 'CreateManualTriggerAction',\n description: 'Row shape of a manual trigger-action link',\n})\nexport type CreateManualTriggerActionData = Static<typeof createManualTriggerActionSchema>\n\nexport const updateManualTriggerActionSchema = Type.Partial(createManualTriggerActionSchema, {\n title: 'UpdateManualTriggerAction',\n description: 'Partial row shape of a manual trigger-action link',\n})\nexport type UpdateManualTriggerActionData = Static<typeof updateManualTriggerActionSchema>\n\n// ── Declarative trigger↔actions contract ──────────────────────────────\n// The link tables are written as a whole through the `actions` field of the trigger payload,\n// never row by row. The array position IS the `execution_order`, so ordering can\n// never disagree with the list the client sent — which per-row endpoints allowed\n// (duplicate or gapped orders after a reorder). Shared by both trigger kinds:\n// only the parent FK differs, and that comes from the URL.\n//\n// The field is `actions`, not `action_ids`: items are no longer only ids (see\n// `triggerActionInputSchema`). Same body as the `actions` field of the create and\n// update trigger payloads, so the three ways of writing the set agree.\n\n// What create/update answer with. `actions` carries the resolved catalog rows —\n// not the link rows — so a client that sent actions inline learns the ids they\n// were given without chaining a second request. It is present only when the\n// request carried the field: a create/update that did not mention actions says\n// nothing about them, rather than reporting an empty set it never touched.\nconst withResolvedActions = Type.Object({\n actions: Type.Optional(Type.Array(actionSchema, { description: 'Actions the trigger runs, in execution order' })),\n})\n\nexport const automaticTriggerWithActionsSchema = Type.Intersect([automaticTriggerSchema, withResolvedActions], {\n title: 'AutomaticTriggerWithActions',\n description:\n 'An automatic trigger and, when the request wrote them or `includeActions` asked for them, the actions it runs',\n})\nexport type AutomaticTriggerWithActionsData = Static<typeof automaticTriggerWithActionsSchema>\n\nexport const manualTriggerWithActionsSchema = Type.Intersect([manualTriggerSchema, withResolvedActions], {\n title: 'ManualTriggerWithActions',\n description:\n 'A manual trigger and, when the request wrote them or `includeActions` asked for them, the actions it runs',\n})\nexport type ManualTriggerWithActionsData = Static<typeof manualTriggerWithActionsSchema>\n\n// ── Execution engine (pure, model-independent contract types) ──────────\n// Exported types the engine (service/helper) works with. Kept here (rather\n// than in service/helper) so they can be imported without pulling in\n// service/helper code. None of them references a model: the engine types\n// itself structurally (see the `*Like` shapes below).\n\nexport interface ActionEvent {\n source: TriggerSource\n target?: string | null\n operation?: TriggerOperation | null\n current: Record<string, unknown>\n old?: Record<string, unknown> | null\n}\n\n// Outcome of evaluating (and, when matched, running) a single trigger. Declared\n// as a TypeBox schema — not just an interface — because the manual-trigger run\n// endpoint returns it verbatim; `TriggerExecutionResult` is its static type, so\n// engine and endpoint cannot drift apart.\nexport const triggerExecutionResultSchema = Type.Object(\n {\n triggerId: Type.Number({ description: 'Identifier of the evaluated trigger' }),\n matched: Type.Boolean({ description: 'Whether the conditions held, so the actions were run' }),\n actionsRun: Type.Number({ description: 'Number of actions that were executed' }),\n actionsAborted: Type.Number({ description: 'Number of actions aborted by context validation' }),\n },\n { title: 'TriggerExecutionResult', description: 'Outcome of evaluating and running one trigger' },\n)\nexport type TriggerExecutionResult = Static<typeof triggerExecutionResultSchema>\n\n// ── Trigger-kind-agnostic engine contract ─────────────────────────────\n// The execution engine is shared by every kind of trigger: it consumes the\n// minimal structural shapes below rather than a concrete model, so a new kind\n// only has to resolve its own candidates and hand them over. The `*Like` types\n// are deliberately structural (not the Objection classes) so the engine never\n// imports a model to type itself — `AutomaticTrigger` / `AutomaticTriggerAction`\n// / `Action` satisfy them as they are, without a cast.\n\n/**\n * Structural shape the engine needs from an action it is about to run: the\n * identity it logs, the `type` that selects the validation/dispatch branch, the\n * config it executes with, and the retention it resolves `expires_at` from.\n * Deliberately loose (`type: string`, not `ActionType`) so an unknown type still\n * reaches the always-blocking context validation instead of failing to typecheck.\n */\nexport interface ActionLike {\n id: number\n type: string\n config: ActionConfig\n retention_days?: number | null\n}\n\n/** Ordered trigger↔action link in the minimal shape the engine consumes. */\nexport interface TriggerActionLike {\n action_id: number\n execution_order: number\n action?: ActionLike\n}\n\n/** Minimal shape of a trigger for the engine, whatever its kind. */\nexport interface EvaluableTrigger {\n id: number\n conditions?: object | null\n relations?: TriggerRelations | null\n retention_days?: number | null\n trigger_actions?: TriggerActionLike[]\n}\n\n/**\n * A batch of already-resolved candidates a trigger kind hands to the engine,\n * together with the event data they were resolved for. `relatedModel` is what\n * the evaluation `process_log` row is related to (the trigger table of that\n * kind), which is how trigger evaluations stay independently queryable per kind.\n */\nexport interface TriggerBatch<T extends EvaluableTrigger = EvaluableTrigger> {\n triggers: T[]\n relatedModel: string\n source: TriggerSource\n target?: string | null\n operation?: TriggerOperation | null\n current: Record<string, unknown>\n old?: Record<string, unknown> | null\n}\n\n// ── Context validation (pure data types) ────────────────────────────────\n\nexport interface ContextValidationResult {\n ok: boolean\n type: string\n baseErrors: { path: string; message: string }[]\n missingRefs: string[]\n referencedRefs: string[]\n overridableErrors: string[]\n}\n\n// Structural shape `buildEffectiveConfig`/`validateActionContext` need from an\n// action config — deliberately loose (not `ActionConfig`) so it works for any\n// current or future type without a cast at every call site.\nexport interface ActionConfigLike {\n payload?: Record<string, unknown>\n overridable?: string[]\n default?: Record<string, unknown>\n}\n\nexport interface EffectiveConfigResult {\n effective: Record<string, unknown>\n overridableErrors: string[]\n}\n\n// ── Route-level schemas ───────────────────────────────────────────────\n// Shared by every router of the module.\n\nexport const successResponseSchema = Type.Object(\n { success: Type.Boolean({ description: 'If the request success or not' }) },\n { title: 'ActionSystemSuccessResponse', description: 'Response when the request is successful' },\n)\n\nexport const withIdParamsSchema = Type.Intersect(\n [ecosystemProjectParamsSchema, Type.Object({ id: Type.Number({ description: 'Entity ID' }) })],\n { title: 'EcosystemProjectWithActionSystemIdParams', description: 'Params with ecosystem, project and entity ID' },\n)\n"],"names":["Type"],"mappings":";;;AAEO,MAAM,wBAAwBA,QAAAA,KAAK;AAAA,EACxC;AAAA,IACE,eAAeA,QAAAA,KAAK,OAAO,EAAE,WAAW,KAAK,aAAa,uBAAuB;AAAA,EAAA;AAAA,EAEnF,EA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AAA,IAC/E,gBAAgBA,QAAAA,KAAK,OAAO,EAAE,aAAa,mDAAmD;AAAA,EAAA;AAAA,EAEhG,EAAE,OAAO,0BAA0B,aAAa,gDAAA;AAClD;AAqFO,MAAM,wBAAwBA,QAAAA,KAAK;AAAA,EACxC,EAAE,SAASA,QAAAA,KAAK,QAAQ,EAAE,aAAa,gCAAA,CAAiC,EAAA;AAAA,EACxE,EAAE,OAAO,+BAA+B,aAAa,0CAAA;AACvD;AAEO,MAAM,qBAAqBA,QAAAA,KAAK;AAAA,EACrC,CAAC,8BAA8BA,QAAAA,KAAK,OAAO,EAAE,IAAIA,QAAAA,KAAK,OAAO,EAAE,aAAa,YAAA,CAAa,EAAA,CAAG,CAAC;AAAA,EAC7F,EAAE,OAAO,4CAA4C,aAAa,+CAAA;AACpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ecosystem-action-system.cjs","sources":["../../src/v2/routes/v2/ecosystem/_ecosystemName/param.schema.ts","../../src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/params.schema.ts","../../src/v2/modules/ecosystem/action-system/action-system.schema.ts"],"sourcesContent":["import { Type } from 'typebox'\n\nexport const ecosystemParamsSchema = Type.Object(\n {\n ecosystemName: Type.String({ maxLength: 255, description: 'Ecosystem name code' }),\n },\n { title: 'EcosystemParams', description: 'Params with ecosystem name' },\n)\n","import { Type } from 'typebox'\nimport { ecosystemParamsSchema } from '@/routes/v2/ecosystem/_ecosystemName/param.schema'\n\nexport const ecosystemProjectParamsSchema = Type.Intersect(\n [\n ecosystemParamsSchema,\n Type.Object({\n projectName: Type.String({ maxLength: 255, description: 'Project name code' }),\n }),\n ],\n { title: 'EcosystemProjectParams', description: 'Params with ecosystem name and project name' },\n)\n","import { Type, Static, type TSchema } from 'typebox'\nimport { ecosystemProjectParamsSchema } from '@/routes/v2/ecosystem/_ecosystemName/project/_projectName/params.schema'\n\n// ── Enums / literal unions ────────────────────────────────────────────\n// Each enum is a const object (source of truth, ergonomic dot access like\n// `TriggerSource.MODEL`) from which the runtime schema is derived with\n// `Type.Enum(Object.values(...))` and the type with `Static`.\n\nexport const ConditionsFormat = {\n JSON_LOGIC: 'jsonLogic',\n CUSTOM: 'custom',\n} as const\nexport const conditionsFormatSchema = Type.Enum(Object.values(ConditionsFormat), {\n title: 'ConditionsFormat',\n description: 'Format of the conditions evaluated by the conditions matcher',\n})\nexport type ConditionsFormat = Static<typeof conditionsFormatSchema>\n\n/**\n * What a trigger binds to: a row of a model, or the data of a form.\n *\n * These are the two the platform emits — `emitModelAfterSave` for one, the form save for the\n * other — and the two `resolveTargetQuery` can load an entity from. A third, `designer` (the form\n * definition), was declared and never emitted: an automatic trigger bound to it could not fire,\n * and a manual one answered 404 both when listing its availability and when running it, because\n * the name of a form does not resolve through the relation-loadable models it fell back to.\n */\nexport const TriggerSource = {\n MODEL: 'model',\n DISPLAYER: 'displayer',\n} as const\nexport const triggerSourceSchema = Type.Enum(Object.values(TriggerSource), {\n title: 'TriggerSource',\n description: 'Source of the event that fires a trigger',\n})\nexport type TriggerSource = Static<typeof triggerSourceSchema>\n\nexport const TriggerOperation = {\n CREATE: 'create',\n UPDATE: 'update',\n DELETE: 'delete',\n} as const\nexport const triggerOperationSchema = Type.Enum(Object.values(TriggerOperation), {\n title: 'TriggerOperation',\n description: 'Operation on the target that fires the trigger',\n})\nexport type TriggerOperation = Static<typeof triggerOperationSchema>\n\n// Executable mechanism of an action. `ApiAction` now; extensible to\n// `ExternalApiCall`, `Webhook`, … in the future (each adds a member here plus a\n// config schema below).\nexport const ActionType = {\n API_ACTION: 'ApiAction',\n} as const\nexport const actionTypeSchema = Type.Enum(Object.values(ActionType), {\n title: 'ActionType',\n description: 'Executable mechanism of an action',\n})\nexport type ActionType = Static<typeof actionTypeSchema>\n\n// ── Action config (discriminated union by `actions.type`) ─────────────\n// Forward-compatible contract shared with front/app via @persei/perseed-api.\n// Principles that the structure keeps prepared (not implemented here):\n// - `id` + fixed per-type fields: every type extends `ActionConfigBase`, so its\n// structure is known from `actions.type`.\n// - Objects always under a key (`payload`, …), never loose object fields, so new\n// fields can be added later without breaking compatibility.\n// - default + override: a type may carry a default config plus a `payload` that\n// overrides parts of it, both with the same typing (effective config = merge).\n//\n// `overridable`/`default`/`location` are generic base support for future\n// override-types (e.g. `ExternalApiCall`): an override-type MUST declare\n// `overridable` (the allow-list of keys its payload may override on top of\n// `default`); `location` is a generic string here, refined per type when a\n// concrete type needs it. `ApiAction` is NOT an override-type — its `payload`\n// is the Handlebars data mapping, not an override of a default config — so it\n// gains these fields optionally but never sets `overridable`/`default`.\n\nexport const actionConfigBaseSchema = Type.Object(\n {\n id: Type.String({\n description:\n 'Identifier of the concrete action within its type (e.g. the ApiAction value for type \"ApiAction\"). Any identifier for future types.',\n }),\n location: Type.Optional(\n Type.String({\n description:\n 'Where the effective config is resolved from. Generic string in the base; refined per type in the future (e.g. \"inline\" | \"file\").',\n }),\n ),\n overridable: Type.Optional(\n Type.Array(Type.String(), {\n description:\n 'Allow-list of config keys a payload may override on top of `default`. Mandatory for override-types; absent for non-override types such as ApiAction.',\n }),\n ),\n default: Type.Optional(\n Type.Record(Type.String(), Type.Unknown(), {\n description: 'Base config an override-type merges its `payload` over (only overridable keys are applied).',\n }),\n ),\n },\n { title: 'ActionConfigBase', description: 'Base fields shared by every action config' },\n)\nexport type ActionConfigBaseData = Static<typeof actionConfigBaseSchema>\n\n// type = 'ApiAction' (current). `payload` is the data mapping needed to run the\n// ApiAction; it is always an object under a key for forward compatibility.\nexport const apiActionConfigSchema = Type.Intersect(\n [\n actionConfigBaseSchema,\n Type.Object({\n payload: Type.Record(Type.String(), Type.Unknown(), {\n description: 'Data mapping needed to run the ApiAction',\n }),\n }),\n ],\n { title: 'ApiActionConfig', description: 'Config for actions of type \"ApiAction\"' },\n)\nexport type ApiActionConfig = Static<typeof apiActionConfigSchema>\n\n// Discriminated (by `actions.type`) union of every action config. Extensible:\n// new types add a member that inherits from `ActionConfigBase`.\nexport const actionConfigSchema = Type.Union([apiActionConfigSchema], {\n title: 'ActionConfig',\n description: 'Union of action configs, selected by actions.type',\n})\nexport type ActionConfig = Static<typeof actionConfigSchema>\n\n// Registry mapping each action type to its config schema. Single seam to extend\n// when a new type is added, and the source used to validate a config by type.\nexport const ACTION_CONFIG_SCHEMAS: Record<ActionType, TSchema> = {\n [ActionType.API_ACTION]: apiActionConfigSchema,\n}\n\n// ── Action context (assembled data each action type evaluates against) ─\n// Mirrors the config-schema pattern above but for the *runtime* context\n// (jsonLogic conditions + handlebars payload refs are resolved against it),\n// not the static config. `additionalProperties: true` because the context is\n// enriched dynamically by the engine/ApiActionController (e.g. `ctx`).\n\nexport const actionContextBaseSchema = Type.Object(\n {\n current: Type.Record(Type.String(), Type.Unknown(), {\n description: 'Current state of the entity that fired the event',\n }),\n old: Type.Optional(\n Type.Union([Type.Record(Type.String(), Type.Unknown()), Type.Null()], {\n description: 'Previous state of the entity, when applicable (e.g. update/delete). Null otherwise',\n }),\n ),\n requestContextData: Type.Optional(\n Type.Unknown({ description: 'Snapshot of the request context (user, ecosystem, project…) when available' }),\n ),\n // Declared even though `additionalProperties: true` would already let it through: what a\n // condition may be written against is part of the contract, and a field only the engine knows\n // about is one no admin can discover.\n requester: Type.Optional(\n Type.Unknown({\n description:\n 'Who is making the request — role, administrator flags, privileges and clinics of their profiling in the project. Absent when the request carries no user (an internal call, a job)',\n }),\n ),\n projectId: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'Project the event belongs to. Null for ecosystem-wide events',\n }),\n ),\n },\n {\n title: 'ActionContextBase',\n description: 'Base fields of the context assembled for every action execution',\n additionalProperties: true,\n },\n)\nexport type ActionContextBaseData = Static<typeof actionContextBaseSchema>\n\n// type = 'ApiAction' (current). No extra required keys beyond the base context\n// yet; kept as a distinct schema so future types can refine it independently.\nexport const apiActionContextSchema = actionContextBaseSchema\n\n// Registry mapping each action type to its context schema. Mirrors\n// `ACTION_CONFIG_SCHEMAS` — single seam to extend when a new type is added.\nexport const ACTION_CONTEXT_SCHEMAS: Record<ActionType, TSchema> = {\n [ActionType.API_ACTION]: apiActionContextSchema,\n}\n\n// Related models to load into the context before a trigger is evaluated — the\n// \"Load relations\" selector of the admin UI. Declared explicitly instead of being\n// derived from the paths a trigger uses: an action templating the whole context\n// (`{{json current}}`) references `current`, never `current.patient`, so deriving\n// would tie the loaded data to how a template is written rather than to what the\n// action needs. An object (not a bare list) because assembling the context has\n// historically taken more than one knob, leaving room to grow.\n//\n// Closed to unknown keys on purpose. The legacy trigger system had a second knob,\n// `load_patient` (`{where, join}`), with semantics this engine does not implement:\n// accepting it would persist a configuration that is then silently ignored, so a\n// trigger would look configured while its conditions never see the related data.\n// Rejecting it at the edge surfaces the mismatch as a 400 instead. Adding a knob\n// here is a deliberate act: declare the field AND read it in `loadRelations`.\nexport const triggerRelationsSchema = Type.Object(\n {\n join: Type.Optional(\n Type.Array(\n // A relation name, not free text: it is interpolated into the eager-loading graph\n // expression. Objection resolves it against the relations declared on the model (never\n // SQL), so an unknown name throws rather than leaking data — but validating the shape\n // here turns that runtime failure into a 400 at the edge, which is cheaper to diagnose.\n Type.String({ pattern: '^[A-Za-z_][A-Za-z0-9_]*$' }),\n { description: 'Relation names to eager-load onto `current` (e.g. [\"patient\"])' },\n ),\n ),\n },\n { title: 'TriggerRelations', additionalProperties: false },\n)\nexport type TriggerRelations = Static<typeof triggerRelationsSchema>\n\n// ── actions (independent reusable catalog) ────────────────────────────\n// Declared before the triggers because a trigger payload can carry actions\n// inline (see `triggerActionsInputSchema` below).\n\nexport const actionSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the action' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'Project this action belongs to. Null when it is ecosystem-wide',\n }),\n ),\n // Optional for the same reason as the trigger's: it labels the action where it is\n // administered, and nothing renders it to whoever fires the trigger, so requiring it only\n // forced a placeholder. Null when it has none.\n name: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Human-readable label of the action. Null when it has none',\n }),\n ),\n type: actionTypeSchema,\n config: actionConfigSchema,\n retention_days: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Retention in days for the process_log entries of this action. Null = inherit (use the firing trigger retention; never if the trigger is null/0); 0 = disabled (never expires, regardless of the trigger); N (>0) = enabled (expires N days after write).',\n }),\n ),\n // Mirrors `dashboard_widget.library`. False by default, so an action created\n // inline from a trigger screen is single-use unless it is said otherwise.\n library: Type.Optional(\n Type.Boolean({\n description:\n 'Whether the action belongs to the reusable catalog. False (the default) marks it single-use: it is deleted once no trigger links it any more, including before it is ever linked — a standalone action created through POST /action and left unlinked is swept as soon as any trigger of the project writes its links. Set it to true to create one that survives on its own',\n }),\n ),\n },\n { title: 'Action', description: 'Reusable executable action (ecosystem level)' },\n)\nexport type ActionData = Static<typeof actionSchema>\n\n// `Type.Omit` keeps this a plain object — unlike `Type.Intersect` — so closing it here works: an\n// undeclared key is rejected with its name instead of being dropped on the way in. `id` and\n// `project_id` are omitted because the server sets them.\nexport const createActionSchema = Type.Omit(actionSchema, ['id', 'project_id'], {\n title: 'CreateAction',\n description: 'Payload used to create an action',\n additionalProperties: false,\n})\nexport type CreateActionData = Static<typeof createActionSchema>\n\n// Restated: `Type.Partial` rebuilds the object and does not carry over the options it derives from.\nexport const updateActionSchema = Type.Partial(createActionSchema, {\n title: 'UpdateAction',\n description: 'Payload used to update an action',\n additionalProperties: false,\n})\nexport type UpdateActionData = Static<typeof updateActionSchema>\n\n// ── Actions carried by a trigger payload ──────────────────────────────\n// One array, not two fields (`action_ids` + `new_actions`): the position IS the\n// `execution_order`, so splitting the list would make an order that interleaves\n// new and existing actions inexpressible. Each item takes one of three forms,\n// which `number` vs object and object with/without `id` disambiguate on their\n// own — no marker field needed:\n//\n// number link an existing catalog action, untouched\n// object without `id` create the action and link it\n// object with `id` update that catalog action and link it\n//\n// An object carrying only `id` is equivalent to passing the bare number.\n//\n// A malformed id is rejected rather than reinterpreted: `{ id: \"55\", name, type, config }` matches\n// no branch — the update one needs a numeric `id`, and the create one is closed against the key —\n// so it answers 400 instead of quietly landing on \"create a new action\".\nexport const triggerActionInputSchema = Type.Union(\n [\n Type.Number({ description: 'Identifier of an existing action to link, left untouched' }),\n Type.Object(\n { ...createActionSchema.properties },\n {\n title: 'TriggerActionCreate',\n description: 'Action created and linked in the same request',\n additionalProperties: false,\n },\n ),\n Type.Object(\n { id: Type.Number(), ...updateActionSchema.properties },\n {\n title: 'TriggerActionUpdate',\n description: 'Existing action updated and linked in the same request',\n additionalProperties: false,\n },\n ),\n ],\n { title: 'TriggerActionInput', description: 'An action a trigger runs: linked, created, or updated in place' },\n)\nexport type TriggerActionInput = Static<typeof triggerActionInputSchema>\n\nexport const triggerActionsInputSchema = Type.Array(triggerActionInputSchema, {\n description:\n 'Full ordered set of actions the trigger runs; the array position is the execution order. An empty array leaves the trigger with none',\n})\n\n// ── automatic_trigger ─────────────────────────────────────────────────\n\n/** Optional label a trigger is known by wherever it is administered. Not shown to end users. */\nconst triggerNameSchema = Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Human-readable label of the trigger. Null when it has none',\n }),\n)\n\n/** Free text for whoever maintains the trigger; never rendered where the trigger is offered. */\nconst triggerDescriptionSchema = Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description: 'What the trigger is for, for whoever administers it. Null when it has none',\n }),\n)\n\nexport const automaticTriggerSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the automatic trigger' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'Project this trigger belongs to. Null when it is ecosystem-wide',\n }),\n ),\n name: triggerNameSchema,\n description: triggerDescriptionSchema,\n source: triggerSourceSchema,\n target: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Concrete model/designer/field the event refers to. Null for sourceless events',\n }),\n ),\n operation: Type.Optional(\n Type.Union([triggerOperationSchema, Type.Null()], {\n description: 'Operation on the target that fires the trigger. Null when not applicable',\n }),\n ),\n conditions: Type.Optional(\n Type.Union([Type.Object({}, { additionalProperties: true }), Type.Null()], {\n description: 'jsonLogic conditions (root object) evaluated to decide whether the trigger runs',\n }),\n ),\n relations: Type.Optional(\n Type.Union([triggerRelationsSchema, Type.Null()], {\n description:\n 'Related models loaded into the context before evaluating the conditions and running the actions. Null means none.',\n }),\n ),\n enabled: Type.Optional(Type.Boolean({ description: 'Whether the trigger is active' })),\n retention_days: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Retention in days for the process_log entries of this trigger. Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write).',\n }),\n ),\n },\n { title: 'AutomaticTrigger', description: 'Automatic trigger definition (ecosystem level)' },\n)\nexport type AutomaticTriggerData = Static<typeof automaticTriggerSchema>\n\n// `includeActions` arrives from the query string, where everything is a string: Fastify coerces\n// `?includeActions=true` to a boolean against this schema, so the handler reads a real boolean.\n//\n// Opt-in rather than always-on: the join costs a query per trigger and most reads do not need it.\n// The read reuses the `*WithActions` schema of each kind (declared with the write responses below):\n// `actions` is optional there, so with the flag off the key is simply absent — the same way a\n// write that did not touch the field says nothing about it instead of reporting an empty set.\n//\n// Shared by both trigger kinds: the flag means the same thing on each, and the query schema carries\n// no kind-specific field.\nexport const includeActionsQuerySchema = Type.Object(\n {\n includeActions: Type.Optional(\n Type.Boolean({\n default: false,\n description: 'Return each trigger with its ordered `actions` resolved, in a single request',\n }),\n ),\n },\n { title: 'IncludeActionsQuery', description: 'Opt-in flag to embed the actions of a trigger' },\n)\n\n// Written out rather than derived from `automaticTriggerSchema`: a request schema and an entity\n// schema answer different questions — what a client may send vs what a row holds — and only the\n// first can close itself. `additionalProperties: false` does not survive `Type.Intersect`, so a\n// derived payload had to be cleaned before validating, which dropped unknown keys silently. Spelled\n// out, an undeclared key is a 400 that names it, and `id`/`project_id` are absent because the server\n// owns them, not because an `Omit` removed them.\nexport const createAutomaticTriggerSchema = Type.Object(\n {\n name: triggerNameSchema,\n description: triggerDescriptionSchema,\n source: triggerSourceSchema,\n target: Type.Optional(\n Type.Union([Type.String({ maxLength: 255 }), Type.Null()], {\n description: 'Concrete model/designer/field the event refers to. Null for sourceless events',\n }),\n ),\n operation: Type.Optional(\n Type.Union([triggerOperationSchema, Type.Null()], {\n description: 'Operation on the target that fires the trigger. Null when not applicable',\n }),\n ),\n conditions: Type.Optional(\n Type.Union([Type.Object({}, { additionalProperties: true }), Type.Null()], {\n description: 'jsonLogic conditions (root object) evaluated to decide whether the trigger runs',\n }),\n ),\n relations: Type.Optional(\n Type.Union([triggerRelationsSchema, Type.Null()], {\n description:\n 'Related models loaded into the context before evaluating the conditions and running the actions. Null means none.',\n }),\n ),\n enabled: Type.Optional(Type.Boolean({ description: 'Whether the trigger is active' })),\n retention_days: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Retention in days for the process_log entries of this trigger. Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write).',\n }),\n ),\n actions: Type.Optional(triggerActionsInputSchema),\n },\n {\n title: 'CreateAutomaticTrigger',\n description: 'Payload used to create an automatic trigger, optionally with the actions it runs',\n additionalProperties: false,\n },\n)\nexport type CreateAutomaticTriggerData = Static<typeof createAutomaticTriggerSchema>\n\n// `actions` is inherited from the create schema and stays optional here, which is\n// what the update contract wants: absent leaves the links untouched, present\n// replaces the whole ordered set (never merges), `[]` leaves the trigger with none.\n// `additionalProperties: false` is restated: `Type.Partial` rebuilds the object and drops the\n// options of the schema it derives from, so inheriting it would leave this payload open.\nexport const updateAutomaticTriggerSchema = Type.Partial(createAutomaticTriggerSchema, {\n title: 'UpdateAutomaticTrigger',\n description: 'Payload used to update an automatic trigger, optionally replacing the actions it runs',\n additionalProperties: false,\n})\nexport type UpdateAutomaticTriggerData = Static<typeof updateAutomaticTriggerSchema>\n\n// ── manual_trigger ────────────────────────────────────────────────────\n\n// What the consumer does with the button when the trigger conditions do not hold. It lives at the\n// root of the config, outside `styles`, so no conditional style can reach it: whether the button is\n// active is decided by the trigger conditions alone, and the style system only dresses it.\nexport const UnmatchedBehavior = {\n HIDE: 'hide',\n DISABLE: 'disable',\n} as const\nexport const unmatchedBehaviorSchema = Type.Enum(Object.values(UnmatchedBehavior), {\n title: 'UnmatchedBehavior',\n description: 'What to do with the button when the trigger does not match: hide it or disable it',\n})\nexport type UnmatchedBehavior = Static<typeof unmatchedBehaviorSchema>\n\nexport const IconPosition = {\n LEFT: 'left',\n RIGHT: 'right',\n} as const\nexport const iconPositionSchema = Type.Enum(Object.values(IconPosition), {\n title: 'IconPosition',\n description: 'Side of the label the icon sits on',\n})\nexport type IconPosition = Static<typeof iconPositionSchema>\n\nexport const manualTriggerButtonStyleSchema = Type.Object(\n {\n text: Type.Optional(Type.String({ description: 'Handlebars template rendered as the button label' })),\n tooltip: Type.Optional(\n Type.String({\n description:\n 'Handlebars template rendered as the button tooltip. Written for whoever uses the listing, unlike `name`, which labels the trigger where it is administered',\n }),\n ),\n textColor: Type.Optional(Type.String({ description: 'Label colour' })),\n bgColor: Type.Optional(Type.String({ description: 'Background colour' })),\n icon: Type.Optional(Type.String({ description: 'Icon name, resolved by the consumer' })),\n iconPosition: Type.Optional(iconPositionSchema),\n },\n { title: 'ManualTriggerButtonStyle', description: 'Presentation of the button a manual trigger is offered on' },\n)\nexport type ManualTriggerButtonStyleData = Static<typeof manualTriggerButtonStyleSchema>\n\n// Same shape as the base style plus the conditions that select it. Every style field is optional:\n// an entry only overrides what it declares.\nexport const manualTriggerConditionalStyleSchema = Type.Intersect(\n [\n manualTriggerButtonStyleSchema,\n Type.Object({\n conditions: Type.Optional(\n Type.Union([Type.Object({}, { additionalProperties: true }), Type.Null()], {\n description: 'jsonLogic conditions selecting this style. Absent or null always applies',\n }),\n ),\n continueEvaluate: Type.Optional(\n Type.Boolean({ description: 'Keep evaluating later entries after this one matches' }),\n ),\n }),\n ],\n { title: 'ManualTriggerConditionalStyle' },\n)\nexport type ManualTriggerConditionalStyleData = Static<typeof manualTriggerConditionalStyleSchema>\n\n/**\n * Envelope for everything a manual trigger configures beyond its firing rules. Today it carries\n * whether an unmatched trigger is hidden or shown disabled, plus the button presentation;\n * `additionalProperties` stays open so a future concern can be added without another column.\n *\n * The two are deliberately separate concerns: `unmatchedBehavior` answers whether the button is\n * offered at all, which only the trigger `conditions` decide, while `styles`/`conditionalStyles`\n * only dress a button that is already going to be shown.\n */\nexport const manualTriggerConfigSchema = Type.Object(\n {\n unmatchedBehavior: Type.Optional(unmatchedBehaviorSchema),\n styles: Type.Optional(manualTriggerButtonStyleSchema),\n conditionalStyles: Type.Optional(Type.Array(manualTriggerConditionalStyleSchema)),\n },\n { title: 'ManualTriggerConfig', additionalProperties: true },\n)\nexport type ManualTriggerConfigData = Static<typeof manualTriggerConfigSchema>\n\nexport const manualTriggerSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the manual trigger' }),\n project_id: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description: 'Project this trigger belongs to. Null when it is ecosystem-wide',\n }),\n ),\n name: triggerNameSchema,\n description: triggerDescriptionSchema,\n source: triggerSourceSchema,\n target: Type.String({\n maxLength: 255,\n description: 'Concrete model/designer/field the trigger is bound to. Always set: there is no wildcard',\n }),\n conditions: Type.Optional(\n Type.Union([Type.Object({}, { additionalProperties: true }), Type.Null()], {\n description:\n 'jsonLogic conditions (root object) evaluated to decide whether the trigger runs. Evaluated against the selected entity and the request context; `old` is always null, because the trigger is invoked explicitly and there is no previous state to compare against.',\n }),\n ),\n relations: Type.Optional(\n Type.Union([triggerRelationsSchema, Type.Null()], {\n description:\n 'Related models loaded into the context before evaluating the conditions and running the actions. Null means none.',\n }),\n ),\n enabled: Type.Optional(Type.Boolean({ description: 'Whether the trigger is active' })),\n retention_days: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Retention in days for the process_log entries of this trigger. Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write).',\n }),\n ),\n config: Type.Optional(\n Type.Union([manualTriggerConfigSchema, Type.Null()], {\n description: 'Configuration of the trigger beyond its firing rules. Null means none',\n }),\n ),\n },\n { title: 'ManualTrigger', description: 'Manual trigger definition (ecosystem level)' },\n)\nexport type ManualTriggerData = Static<typeof manualTriggerSchema>\n\n// Written out and closed, for the same reasons as `createAutomaticTriggerSchema` above.\nexport const createManualTriggerSchema = Type.Object(\n {\n name: triggerNameSchema,\n description: triggerDescriptionSchema,\n source: triggerSourceSchema,\n target: Type.String({\n maxLength: 255,\n description: 'Concrete model/designer/field the trigger is bound to. Always set: there is no wildcard',\n }),\n conditions: Type.Optional(\n Type.Union([Type.Object({}, { additionalProperties: true }), Type.Null()], {\n description:\n 'jsonLogic conditions (root object) evaluated to decide whether the trigger runs. Evaluated against the selected entity and the request context; `old` is always null, because the trigger is invoked explicitly and there is no previous state to compare against.',\n }),\n ),\n relations: Type.Optional(\n Type.Union([triggerRelationsSchema, Type.Null()], {\n description:\n 'Related models loaded into the context before evaluating the conditions and running the actions. Null means none.',\n }),\n ),\n enabled: Type.Optional(Type.Boolean({ description: 'Whether the trigger is active' })),\n retention_days: Type.Optional(\n Type.Union([Type.Number(), Type.Null()], {\n description:\n 'Retention in days for the process_log entries of this trigger. Origin — no inheritance: null or 0 = disabled (never expires); N (>0) = enabled (expires N days after write).',\n }),\n ),\n config: Type.Optional(\n Type.Union([manualTriggerConfigSchema, Type.Null()], {\n description: 'Configuration of the trigger beyond its firing rules. Null means none',\n }),\n ),\n actions: Type.Optional(triggerActionsInputSchema),\n },\n {\n title: 'CreateManualTrigger',\n description: 'Payload used to create a manual trigger, optionally with the actions it runs',\n additionalProperties: false,\n },\n)\nexport type CreateManualTriggerData = Static<typeof createManualTriggerSchema>\n\n// Same inheritance and semantics as `updateAutomaticTriggerSchema`.\nexport const updateManualTriggerSchema = Type.Partial(createManualTriggerSchema, {\n title: 'UpdateManualTrigger',\n description: 'Payload used to update a manual trigger, optionally replacing the actions it runs',\n additionalProperties: false,\n})\nexport type UpdateManualTriggerData = Static<typeof updateManualTriggerSchema>\n\n// What the listing endpoint returns per applicable manual trigger: enough to\n// render it and nothing more. Only triggers that are going to be shown are\n// listed, so `matched: false` means a button rendered disabled, never a hidden\n// one. `matched` is never an authorisation: running re-evaluates server-side.\nexport const manualTriggerAvailabilitySchema = Type.Object(\n {\n id: Type.Number({ description: 'Identifier of the manual trigger' }),\n name: triggerNameSchema,\n matched: Type.Boolean({\n description:\n 'Whether the trigger conditions hold for this entity right now. A trigger with no conditions always matches. False means the button is shown disabled: triggers configured to hide when unmatched are not listed',\n }),\n actionsCount: Type.Number({ description: 'Number of actions the trigger would run' }),\n relationsSkipped: Type.Optional(\n Type.Union([Type.String(), Type.Null()], {\n description:\n 'Reason the declared relations could not be loaded before evaluating, when that happened. Null otherwise',\n }),\n ),\n /**\n * Resolved server-side: conditional styles already evaluated and label already compiled. Absent\n * when the trigger has no config — the consumer then paints its own default button.\n */\n style: Type.Optional(manualTriggerButtonStyleSchema),\n },\n {\n title: 'ManualTriggerAvailability',\n description: 'A manual trigger applicable to an entity, with its conditions already evaluated',\n },\n)\nexport type ManualTriggerAvailability = Static<typeof manualTriggerAvailabilitySchema>\n\nexport const manualTriggerAvailabilityListSchema = Type.Object(\n { results: Type.Array(manualTriggerAvailabilitySchema, { description: 'Applicable manual triggers' }) },\n {\n title: 'ManualTriggerAvailabilityList',\n description: 'Manual triggers applicable to an entity, with their conditions evaluated',\n },\n)\n\n// Query the listing endpoint is called with: the entity the triggers are offered\n// on. `source`/`target` are the coordinates a manual trigger is bound to, and\n// `entityId` the concrete row.\nexport const manualTriggerAvailabilityQuerySchema = Type.Object(\n {\n source: triggerSourceSchema,\n target: Type.String({ maxLength: 255, description: 'Concrete model/designer/field the triggers are bound to' }),\n entityId: Type.Number({ description: 'Identifier of the entity the triggers would run against' }),\n },\n { title: 'ManualTriggerAvailabilityQuery', description: 'Entity the applicable manual triggers are listed for' },\n)\nexport type ManualTriggerAvailabilityQuery = Static<typeof manualTriggerAvailabilityQuerySchema>\n\n// Body of the run endpoint. It carries only the entity: `source`/`target` are\n// read from the trigger row, never from the client, so a trigger cannot be\n// re-pointed at an entity it was not bound to.\nexport const runManualTriggerSchema = Type.Object(\n { entityId: Type.Number({ description: 'Identifier of the entity to run the trigger against' }) },\n { title: 'RunManualTrigger', description: 'Payload used to run a manual trigger against an entity' },\n)\nexport type RunManualTriggerData = Static<typeof runManualTriggerSchema>\n\n// ── automatic_trigger_action (intermediate N:M automatic_trigger↔actions,\n// ordered) ──────────────────────────────────────────────────────────────\n// Dedicated table per trigger kind (no ORM polymorphism): `automatic_trigger_id`\n// is a real FK. `manual_trigger_action` is a future table for manual triggers.\n\nexport const automaticTriggerActionSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the trigger-action link' }),\n automatic_trigger_id: Type.Number({\n description: 'Automatic trigger executing the action (FK to automatic_trigger)',\n }),\n action_id: Type.Number({ description: 'Action executed by the trigger (FK to actions)' }),\n execution_order: Type.Number({ description: 'Execution order of the action within the trigger' }),\n },\n { title: 'AutomaticTriggerAction', description: 'Ordered link between an automatic trigger and an action' },\n)\nexport type AutomaticTriggerActionData = Static<typeof automaticTriggerActionSchema>\n\n// ── manual_trigger_action (intermediate N:M manual_trigger↔actions,\n// ordered) ──────────────────────────────────────────────────────────────\n// Same dedicated-table-per-trigger-kind rule as `automatic_trigger_action`:\n// `manual_trigger_id` is a real FK, and the `actions` catalog is shared\n// between kinds — only the link table differs.\n\nexport const manualTriggerActionSchema = Type.Object(\n {\n id: Type.Number({ description: 'Unique identifier of the trigger-action link' }),\n manual_trigger_id: Type.Number({\n description: 'Manual trigger executing the action (FK to manual_trigger)',\n }),\n action_id: Type.Number({ description: 'Action executed by the trigger (FK to actions)' }),\n execution_order: Type.Number({ description: 'Execution order of the action within the trigger' }),\n },\n { title: 'ManualTriggerAction', description: 'Ordered link between a manual trigger and an action' },\n)\nexport type ManualTriggerActionData = Static<typeof manualTriggerActionSchema>\n\n// ── Declarative trigger↔actions contract ──────────────────────────────\n// The link tables are written as a whole through the `actions` field of the trigger payload,\n// never row by row. The array position IS the `execution_order`, so ordering can\n// never disagree with the list the client sent — which per-row endpoints allowed\n// (duplicate or gapped orders after a reorder). Shared by both trigger kinds:\n// only the parent FK differs, and that comes from the URL.\n//\n// The field is `actions`, not `action_ids`: items are no longer only ids (see\n// `triggerActionInputSchema`). Same body as the `actions` field of the create and\n// update trigger payloads, so the three ways of writing the set agree.\n\n// What create/update answer with. `actions` carries the resolved catalog rows —\n// not the link rows — so a client that sent actions inline learns the ids they\n// were given without chaining a second request. It is present only when the\n// request carried the field: a create/update that did not mention actions says\n// nothing about them, rather than reporting an empty set it never touched.\nconst withResolvedActions = Type.Object({\n actions: Type.Optional(Type.Array(actionSchema, { description: 'Actions the trigger runs, in execution order' })),\n})\n\nexport const automaticTriggerWithActionsSchema = Type.Intersect([automaticTriggerSchema, withResolvedActions], {\n title: 'AutomaticTriggerWithActions',\n description:\n 'An automatic trigger and, when the request wrote them or `includeActions` asked for them, the actions it runs',\n})\nexport type AutomaticTriggerWithActionsData = Static<typeof automaticTriggerWithActionsSchema>\n\nexport const manualTriggerWithActionsSchema = Type.Intersect([manualTriggerSchema, withResolvedActions], {\n title: 'ManualTriggerWithActions',\n description:\n 'A manual trigger and, when the request wrote them or `includeActions` asked for them, the actions it runs',\n})\nexport type ManualTriggerWithActionsData = Static<typeof manualTriggerWithActionsSchema>\n\n// ── Execution engine (pure, model-independent contract types) ──────────\n// Exported types the engine (service/helper) works with. Kept here (rather\n// than in service/helper) so they can be imported without pulling in\n// service/helper code. None of them references a model: the engine types\n// itself structurally (see the `*Like` shapes below).\n\nexport interface ActionEvent {\n source: TriggerSource\n target?: string | null\n operation?: TriggerOperation | null\n current: Record<string, unknown>\n old?: Record<string, unknown> | null\n}\n\n// Outcome of evaluating (and, when matched, running) a single trigger. Declared\n// as a TypeBox schema — not just an interface — because the manual-trigger run\n// endpoint returns it verbatim; `TriggerExecutionResult` is its static type, so\n// engine and endpoint cannot drift apart.\nexport const triggerExecutionResultSchema = Type.Object(\n {\n triggerId: Type.Number({ description: 'Identifier of the evaluated trigger' }),\n matched: Type.Boolean({ description: 'Whether the conditions held, so the actions were run' }),\n actionsRun: Type.Number({ description: 'Number of actions that were executed, whether they succeeded or not' }),\n actionsAborted: Type.Number({ description: 'Number of actions aborted by context validation' }),\n actionsFailed: Type.Number({\n description: 'Number of executed actions that ended in error. A subset of actionsRun',\n }),\n },\n { title: 'TriggerExecutionResult', description: 'Outcome of evaluating and running one trigger' },\n)\nexport type TriggerExecutionResult = Static<typeof triggerExecutionResultSchema>\n\n// ── Trigger-kind-agnostic engine contract ─────────────────────────────\n// The execution engine is shared by every kind of trigger: it consumes the\n// minimal structural shapes below rather than a concrete model, so a new kind\n// only has to resolve its own candidates and hand them over. The `*Like` types\n// are deliberately structural (not the Objection classes) so the engine never\n// imports a model to type itself — `AutomaticTrigger` / `AutomaticTriggerAction`\n// / `Action` satisfy them as they are, without a cast.\n\n/**\n * Structural shape the engine needs from an action it is about to run: the\n * identity it logs, the `type` that selects the validation/dispatch branch, the\n * config it executes with, and the retention it resolves `expires_at` from.\n * Deliberately loose (`type: string`, not `ActionType`) so an unknown type still\n * reaches the always-blocking context validation instead of failing to typecheck.\n */\nexport interface ActionLike {\n id: number\n type: string\n config: ActionConfig\n retention_days?: number | null\n}\n\n/** Ordered trigger↔action link in the minimal shape the engine consumes. */\nexport interface TriggerActionLike {\n action_id: number\n execution_order: number\n action?: ActionLike\n}\n\n/** Minimal shape of a trigger for the engine, whatever its kind. */\nexport interface EvaluableTrigger {\n id: number\n conditions?: object | null\n relations?: TriggerRelations | null\n retention_days?: number | null\n trigger_actions?: TriggerActionLike[]\n}\n\n/**\n * A batch of already-resolved candidates a trigger kind hands to the engine,\n * together with the event data they were resolved for. `relatedModel` is what\n * the evaluation `process_log` row is related to (the trigger table of that\n * kind), which is how trigger evaluations stay independently queryable per kind.\n */\nexport interface TriggerBatch<T extends EvaluableTrigger = EvaluableTrigger> {\n triggers: T[]\n relatedModel: string\n source: TriggerSource\n target?: string | null\n operation?: TriggerOperation | null\n current: Record<string, unknown>\n old?: Record<string, unknown> | null\n}\n\n// ── Context validation (pure data types) ────────────────────────────────\n\nexport interface ContextValidationResult {\n ok: boolean\n type: string\n baseErrors: { path: string; message: string }[]\n missingRefs: string[]\n referencedRefs: string[]\n overridableErrors: string[]\n}\n\n// Structural shape `buildEffectiveConfig`/`validateActionContext` need from an\n// action config — deliberately loose (not `ActionConfig`) so it works for any\n// current or future type without a cast at every call site.\nexport interface ActionConfigLike {\n payload?: Record<string, unknown>\n overridable?: string[]\n default?: Record<string, unknown>\n}\n\nexport interface EffectiveConfigResult {\n effective: Record<string, unknown>\n overridableErrors: string[]\n}\n\n// ── Route-level schemas ───────────────────────────────────────────────\n// Shared by every router of the module.\n\nexport const successResponseSchema = Type.Object(\n { success: Type.Boolean({ description: 'If the request success or not' }) },\n { title: 'ActionSystemSuccessResponse', description: 'Response when the request is successful' },\n)\n\nexport const withIdParamsSchema = Type.Intersect(\n [ecosystemProjectParamsSchema, Type.Object({ id: Type.Number({ description: 'Entity ID' }) })],\n { title: 'EcosystemProjectWithActionSystemIdParams', description: 'Params with ecosystem, project and entity ID' },\n)\n"],"names":["Type"],"mappings":";;;AAEO,MAAM,wBAAwBA,QAAAA,KAAK;AAAA,EACxC;AAAA,IACE,eAAeA,QAAAA,KAAK,OAAO,EAAE,WAAW,KAAK,aAAa,uBAAuB;AAAA,EAAA;AAAA,EAEnF,EAAE,OAAO,mBAAmB,aAAa,6BAAA;AAC3C;ACJO,MAAM,+BAA+BA,QAAAA,KAAK;AAAA,EAC/C;AAAA,IACE;AAAA,IACAA,QAAAA,KAAK,OAAO;AAAA,MACV,aAAaA,QAAAA,KAAK,OAAO,EAAE,WAAW,KAAK,aAAa,qBAAqB;AAAA,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