@persei/perseed-api 5.0.19 → 5.0.21
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 +875 -71
- package/dist/client.cjs.map +1 -1
- package/dist/client.mjs +876 -72
- package/dist/client.mjs.map +1 -1
- package/dist/ecosystem-action-system.cjs +586 -0
- package/dist/ecosystem-action-system.cjs.map +1 -0
- package/dist/ecosystem-action-system.d.ts +1 -0
- package/dist/ecosystem-action-system.mjs +586 -0
- package/dist/ecosystem-action-system.mjs.map +1 -0
- package/dist/lib/src/client/customFetch.d.ts +51 -0
- package/dist/lib/src/client/customFetch.d.ts.map +1 -0
- package/dist/lib/src/client/customFetch.test.d.ts +2 -0
- package/dist/lib/src/client/customFetch.test.d.ts.map +1 -0
- package/dist/lib/src/client/index.d.ts +1 -0
- package/dist/lib/src/client/index.d.ts.map +1 -1
- package/dist/lib/src/generated/client.d.ts +5251 -670
- package/dist/lib/src/generated/client.d.ts.map +1 -1
- package/dist/src/Services/AuthenticationSecurityService.d.ts +1 -1
- package/dist/src/Services/MobileService.d.ts +26 -1
- package/dist/src/Services/MobileService.d.ts.map +1 -1
- package/dist/src/Services/ProcessLogService.d.ts +1 -1
- package/dist/src/Services/ProcessLogService.d.ts.map +1 -1
- package/dist/src/Services/ProjectService.d.ts.map +1 -1
- package/dist/src/Services/QueryService.d.ts +24 -1
- package/dist/src/Services/QueryService.d.ts.map +1 -1
- package/dist/src/Services/RedisQueueService.d.ts +16 -0
- package/dist/src/Services/RedisQueueService.d.ts.map +1 -1
- package/dist/src/Services/TriggerProcessLogService.d.ts +90 -0
- package/dist/src/Services/TriggerProcessLogService.d.ts.map +1 -0
- package/dist/src/Services/TriggerService.d.ts +16 -11
- package/dist/src/Services/TriggerService.d.ts.map +1 -1
- package/dist/src/Services/trigger-process-log-service.test.d.ts +2 -0
- package/dist/src/Services/trigger-process-log-service.test.d.ts.map +1 -0
- package/dist/src/controllers/AuthController.d.ts.map +1 -1
- package/dist/src/controllers/FormController.d.ts.map +1 -1
- package/dist/src/helpers/error.d.ts +12 -0
- package/dist/src/helpers/error.d.ts.map +1 -1
- package/dist/src/lib.d.ts +1 -0
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/models/ecosystem/NotificationConfiguration.d.ts +1 -1
- package/dist/src/models/ecosystem/NotificationConfiguration.d.ts.map +1 -1
- package/dist/src/models/ecosystem/User.d.ts +17 -0
- package/dist/src/models/ecosystem/User.d.ts.map +1 -1
- package/dist/src/models/ecosystem/User.getProjectUser.test.d.ts +2 -0
- package/dist/src/models/ecosystem/User.getProjectUser.test.d.ts.map +1 -0
- package/dist/src/models/perseed/PerseedEcosystem.d.ts +2 -0
- package/dist/src/models/perseed/PerseedEcosystem.d.ts.map +1 -1
- package/dist/src/models/project/DesignerCrf.d.ts +3 -2
- package/dist/src/models/project/DesignerCrf.d.ts.map +1 -1
- package/dist/src/models/project/designer-crf-after-save.test.d.ts +2 -0
- package/dist/src/models/project/designer-crf-after-save.test.d.ts.map +1 -0
- package/dist/src/module.d.ts +5 -0
- package/dist/src/schemas/api_action/ApiActionTypes.d.ts +11 -0
- package/dist/src/schemas/api_action/ApiActionTypes.d.ts.map +1 -1
- package/dist/src/schemas/index.d.ts +1 -0
- package/dist/src/schemas/index.d.ts.map +1 -1
- package/dist/src/schemas/notification_configuration/types.d.ts +19 -8
- package/dist/src/schemas/notification_configuration/types.d.ts.map +1 -1
- package/dist/src/schemas/process_log/create_process_log_payload.schema.json +4 -0
- package/dist/src/schemas/process_log/types.d.ts +3 -0
- package/dist/src/schemas/process_log/types.d.ts.map +1 -1
- package/dist/src/schemas/project_user/index.d.ts +2 -0
- package/dist/src/schemas/project_user/index.d.ts.map +1 -0
- package/dist/src/schemas/project_user/types.d.ts +44 -0
- package/dist/src/schemas/project_user/types.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action-system.controller.e2e.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action-system.controller.e2e.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action-system.controller.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action-system.controller.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action.controller.d.ts +3 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action.controller.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/automatic-trigger.controller.d.ts +3 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/automatic-trigger.controller.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/index.d.ts +6 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/index.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/manual-trigger.controller.d.ts +3 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/manual-trigger.controller.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts +149 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/conditions-matcher.helper.d.ts +5 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/conditions-matcher.helper.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/conditions-matcher.helper.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/conditions-matcher.helper.test.d.ts.map +1 -0
- package/dist/src/{Services/ConditionsMatcher/CustomConditionsFormat.d.ts → v2/modules/ecosystem/action-system/action-system.helper/custom-conditions-format.helper.d.ts} +2 -2
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/custom-conditions-format.helper.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/custom-conditions-format.helper.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/custom-conditions-format.helper.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/index.d.ts +5 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/index.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/manual-trigger.helper.d.ts +13 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/manual-trigger.helper.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/manual-trigger.helper.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/manual-trigger.helper.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.model.d.ts +122 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.model.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.schema.d.ts +744 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.schema.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.d.ts +37 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.e2e.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.e2e.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action.service.d.ts +18 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action.service.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action.service.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action.service.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.d.ts +137 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/index.d.ts +8 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/index.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.d.ts +34 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.d.ts +179 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-actions.service.d.ts +31 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-actions.service.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-actions.service.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-actions.service.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts +57 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/index.d.ts +6 -0
- package/dist/src/v2/modules/ecosystem/action-system/index.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/action-system/lib.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/action-system/lib.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/process-log/index.d.ts +3 -0
- package/dist/src/v2/modules/ecosystem/process-log/index.d.ts.map +1 -0
- package/dist/src/{models/ecosystem/ProcessLog.d.ts → v2/modules/ecosystem/process-log/process-log.model.d.ts} +16 -5
- package/dist/src/v2/modules/ecosystem/process-log/process-log.model.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/process-log/process-log.model.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/process-log/process-log.model.test.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/process-log/process-log.service.d.ts +20 -0
- package/dist/src/v2/modules/ecosystem/process-log/process-log.service.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/process-log/process-log.service.e2e.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/process-log/process-log.service.e2e.d.ts.map +1 -0
- package/dist/src/v2/modules/ecosystem/process-log/process-log.service.test.d.ts +2 -0
- package/dist/src/v2/modules/ecosystem/process-log/process-log.service.test.d.ts.map +1 -0
- package/dist/src/v2/modules/global/api-error/api-error.schema.d.ts +9 -0
- package/dist/src/v2/modules/global/api-error/api-error.schema.d.ts.map +1 -1
- package/dist/src/v2/modules/global/e2e-operation/e2e-operation.controller.d.ts.map +1 -1
- package/dist/src/v2/modules/global/e2e-operation/e2e-operation.service.d.ts.map +1 -1
- package/dist/src/v2/modules/global/request-log/request-log.middleware.d.ts.map +1 -1
- package/dist/src/v2/modules/project/document/document.controller.d.ts.map +1 -1
- package/dist/src/v2/modules/project/thryve/thryve.controller.d.ts.map +1 -1
- package/dist/src/v2/modules/project/thryve/thryve.service.d.ts +16 -4
- package/dist/src/v2/modules/project/thryve/thryve.service.d.ts.map +1 -1
- package/dist/src/v2/routes/v2/e2e/index.d.ts.map +1 -1
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/action/index.d.ts +3 -0
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/action/index.d.ts.map +1 -0
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/automatic-trigger/index.d.ts +3 -0
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/automatic-trigger/index.d.ts.map +1 -0
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/manual-trigger/index.d.ts +3 -0
- package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/manual-trigger/index.d.ts.map +1 -0
- package/dist/v1/perseed-api.cjs +8 -11
- package/dist/v1/perseed-api.cjs.map +1 -1
- package/dist/v1/perseed-api.mjs +7 -10
- package/dist/v1/perseed-api.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/src/Services/ConditionsMatcher/CustomConditionsFormat.d.ts.map +0 -1
- package/dist/src/Services/ConditionsMatcher/index.d.ts +0 -4
- package/dist/src/Services/ConditionsMatcher/index.d.ts.map +0 -1
- package/dist/src/Services/conditions-matcher.test.d.ts +0 -2
- package/dist/src/Services/conditions-matcher.test.d.ts.map +0 -1
- package/dist/src/Services/custom-conditions-format.test.d.ts +0 -2
- package/dist/src/Services/custom-conditions-format.test.d.ts.map +0 -1
- package/dist/src/models/ecosystem/ProcessLog.d.ts.map +0 -1
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const typebox = require("typebox");
|
|
4
|
+
const ecosystemParamsSchema = typebox.Type.Object(
|
|
5
|
+
{
|
|
6
|
+
ecosystemName: typebox.Type.String({ maxLength: 255, description: "Ecosystem name code" })
|
|
7
|
+
},
|
|
8
|
+
{ title: "EcosystemParams", description: "Params with ecosystem name" }
|
|
9
|
+
);
|
|
10
|
+
const ecosystemProjectParamsSchema = typebox.Type.Intersect(
|
|
11
|
+
[
|
|
12
|
+
ecosystemParamsSchema,
|
|
13
|
+
typebox.Type.Object({
|
|
14
|
+
projectName: typebox.Type.String({ maxLength: 255, description: "Project name code" })
|
|
15
|
+
})
|
|
16
|
+
],
|
|
17
|
+
{ title: "EcosystemProjectParams", description: "Params with ecosystem name and project name" }
|
|
18
|
+
);
|
|
19
|
+
const ConditionsFormat = {
|
|
20
|
+
JSON_LOGIC: "jsonLogic",
|
|
21
|
+
CUSTOM: "custom"
|
|
22
|
+
};
|
|
23
|
+
const conditionsFormatSchema = typebox.Type.Enum(Object.values(ConditionsFormat), {
|
|
24
|
+
title: "ConditionsFormat",
|
|
25
|
+
description: "Format of the conditions evaluated by the conditions matcher"
|
|
26
|
+
});
|
|
27
|
+
const TriggerSource = {
|
|
28
|
+
MODEL: "model",
|
|
29
|
+
DESIGNER: "designer",
|
|
30
|
+
DISPLAYER: "displayer"
|
|
31
|
+
};
|
|
32
|
+
const triggerSourceSchema = typebox.Type.Enum(Object.values(TriggerSource), {
|
|
33
|
+
title: "TriggerSource",
|
|
34
|
+
description: "Source of the event that fires a trigger"
|
|
35
|
+
});
|
|
36
|
+
const TriggerOperation = {
|
|
37
|
+
CREATE: "create",
|
|
38
|
+
UPDATE: "update",
|
|
39
|
+
DELETE: "delete"
|
|
40
|
+
};
|
|
41
|
+
const triggerOperationSchema = typebox.Type.Enum(Object.values(TriggerOperation), {
|
|
42
|
+
title: "TriggerOperation",
|
|
43
|
+
description: "Operation on the target that fires the trigger"
|
|
44
|
+
});
|
|
45
|
+
const ActionType = {
|
|
46
|
+
API_ACTION: "ApiAction"
|
|
47
|
+
};
|
|
48
|
+
const actionTypeSchema = typebox.Type.Enum(Object.values(ActionType), {
|
|
49
|
+
title: "ActionType",
|
|
50
|
+
description: "Executable mechanism of an action"
|
|
51
|
+
});
|
|
52
|
+
const actionConfigBaseSchema = typebox.Type.Object(
|
|
53
|
+
{
|
|
54
|
+
id: typebox.Type.String({
|
|
55
|
+
description: 'Identifier of the concrete action within its type (e.g. the ApiAction value for type "ApiAction"). Any identifier for future types.'
|
|
56
|
+
}),
|
|
57
|
+
location: typebox.Type.Optional(
|
|
58
|
+
typebox.Type.String({
|
|
59
|
+
description: 'Where the effective config is resolved from. Generic string in the base; refined per type in the future (e.g. "inline" | "file").'
|
|
60
|
+
})
|
|
61
|
+
),
|
|
62
|
+
overridable: typebox.Type.Optional(
|
|
63
|
+
typebox.Type.Array(typebox.Type.String(), {
|
|
64
|
+
description: "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."
|
|
65
|
+
})
|
|
66
|
+
),
|
|
67
|
+
default: typebox.Type.Optional(
|
|
68
|
+
typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown(), {
|
|
69
|
+
description: "Base config an override-type merges its `payload` over (only overridable keys are applied)."
|
|
70
|
+
})
|
|
71
|
+
)
|
|
72
|
+
},
|
|
73
|
+
{ title: "ActionConfigBase", description: "Base fields shared by every action config" }
|
|
74
|
+
);
|
|
75
|
+
const apiActionConfigSchema = typebox.Type.Intersect(
|
|
76
|
+
[
|
|
77
|
+
actionConfigBaseSchema,
|
|
78
|
+
typebox.Type.Object({
|
|
79
|
+
payload: typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown(), {
|
|
80
|
+
description: "Data mapping needed to run the ApiAction"
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
],
|
|
84
|
+
{ title: "ApiActionConfig", description: 'Config for actions of type "ApiAction"' }
|
|
85
|
+
);
|
|
86
|
+
const actionConfigSchema = typebox.Type.Union([apiActionConfigSchema], {
|
|
87
|
+
title: "ActionConfig",
|
|
88
|
+
description: "Union of action configs, selected by actions.type"
|
|
89
|
+
});
|
|
90
|
+
const ACTION_CONFIG_SCHEMAS = {
|
|
91
|
+
[ActionType.API_ACTION]: apiActionConfigSchema
|
|
92
|
+
};
|
|
93
|
+
const actionContextBaseSchema = typebox.Type.Object(
|
|
94
|
+
{
|
|
95
|
+
current: typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown(), {
|
|
96
|
+
description: "Current state of the entity that fired the event"
|
|
97
|
+
}),
|
|
98
|
+
old: typebox.Type.Optional(
|
|
99
|
+
typebox.Type.Union([typebox.Type.Record(typebox.Type.String(), typebox.Type.Unknown()), typebox.Type.Null()], {
|
|
100
|
+
description: "Previous state of the entity, when applicable (e.g. update/delete). Null otherwise"
|
|
101
|
+
})
|
|
102
|
+
),
|
|
103
|
+
requestContextData: typebox.Type.Optional(
|
|
104
|
+
typebox.Type.Unknown({ description: "Snapshot of the request context (user, ecosystem, project…) when available" })
|
|
105
|
+
),
|
|
106
|
+
// Declared even though `additionalProperties: true` would already let it through: what a
|
|
107
|
+
// condition may be written against is part of the contract, and a field only the engine knows
|
|
108
|
+
// about is one no admin can discover.
|
|
109
|
+
requester: typebox.Type.Optional(
|
|
110
|
+
typebox.Type.Unknown({
|
|
111
|
+
description: "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)"
|
|
112
|
+
})
|
|
113
|
+
),
|
|
114
|
+
projectId: typebox.Type.Optional(
|
|
115
|
+
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
116
|
+
description: "Project the event belongs to. Null for ecosystem-wide events"
|
|
117
|
+
})
|
|
118
|
+
)
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
title: "ActionContextBase",
|
|
122
|
+
description: "Base fields of the context assembled for every action execution",
|
|
123
|
+
additionalProperties: true
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
const apiActionContextSchema = actionContextBaseSchema;
|
|
127
|
+
const ACTION_CONTEXT_SCHEMAS = {
|
|
128
|
+
[ActionType.API_ACTION]: apiActionContextSchema
|
|
129
|
+
};
|
|
130
|
+
const triggerRelationsSchema = typebox.Type.Object(
|
|
131
|
+
{
|
|
132
|
+
join: typebox.Type.Optional(
|
|
133
|
+
typebox.Type.Array(
|
|
134
|
+
// A relation name, not free text: it is interpolated into the eager-loading graph
|
|
135
|
+
// expression. Objection resolves it against the relations declared on the model (never
|
|
136
|
+
// SQL), so an unknown name throws rather than leaking data — but validating the shape
|
|
137
|
+
// here turns that runtime failure into a 400 at the edge, which is cheaper to diagnose.
|
|
138
|
+
typebox.Type.String({ pattern: "^[A-Za-z_][A-Za-z0-9_]*$" }),
|
|
139
|
+
{ description: 'Relation names to eager-load onto `current` (e.g. ["patient"])' }
|
|
140
|
+
)
|
|
141
|
+
)
|
|
142
|
+
},
|
|
143
|
+
{ title: "TriggerRelations", additionalProperties: false }
|
|
144
|
+
);
|
|
145
|
+
const actionSchema = typebox.Type.Object(
|
|
146
|
+
{
|
|
147
|
+
id: typebox.Type.Number({ description: "Unique identifier of the action" }),
|
|
148
|
+
project_id: typebox.Type.Optional(
|
|
149
|
+
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
150
|
+
description: "Project this action belongs to. Null when it is ecosystem-wide"
|
|
151
|
+
})
|
|
152
|
+
),
|
|
153
|
+
name: typebox.Type.String({ maxLength: 255, description: "Human-readable identifier of the action" }),
|
|
154
|
+
type: actionTypeSchema,
|
|
155
|
+
config: actionConfigSchema,
|
|
156
|
+
retention_days: typebox.Type.Optional(
|
|
157
|
+
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
158
|
+
description: "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)."
|
|
159
|
+
})
|
|
160
|
+
),
|
|
161
|
+
// Mirrors `dashboard_widget.library`. False by default, so an action created
|
|
162
|
+
// inline from a trigger screen is single-use unless it is said otherwise.
|
|
163
|
+
library: typebox.Type.Optional(
|
|
164
|
+
typebox.Type.Boolean({
|
|
165
|
+
description: "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"
|
|
166
|
+
})
|
|
167
|
+
)
|
|
168
|
+
},
|
|
169
|
+
{ title: "Action", description: "Reusable executable action (ecosystem level)" }
|
|
170
|
+
);
|
|
171
|
+
const createActionSchema = typebox.Type.Omit(actionSchema, ["id", "project_id"], {
|
|
172
|
+
title: "CreateAction",
|
|
173
|
+
description: "Payload used to create an action",
|
|
174
|
+
additionalProperties: false
|
|
175
|
+
});
|
|
176
|
+
const updateActionSchema = typebox.Type.Partial(createActionSchema, {
|
|
177
|
+
title: "UpdateAction",
|
|
178
|
+
description: "Payload used to update an action",
|
|
179
|
+
additionalProperties: false
|
|
180
|
+
});
|
|
181
|
+
const triggerActionInputSchema = typebox.Type.Union(
|
|
182
|
+
[
|
|
183
|
+
typebox.Type.Number({ description: "Identifier of an existing action to link, left untouched" }),
|
|
184
|
+
typebox.Type.Object(
|
|
185
|
+
{ ...createActionSchema.properties },
|
|
186
|
+
{
|
|
187
|
+
title: "TriggerActionCreate",
|
|
188
|
+
description: "Action created and linked in the same request",
|
|
189
|
+
additionalProperties: false
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
typebox.Type.Object(
|
|
193
|
+
{ id: typebox.Type.Number(), ...updateActionSchema.properties },
|
|
194
|
+
{
|
|
195
|
+
title: "TriggerActionUpdate",
|
|
196
|
+
description: "Existing action updated and linked in the same request",
|
|
197
|
+
additionalProperties: false
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
],
|
|
201
|
+
{ title: "TriggerActionInput", description: "An action a trigger runs: linked, created, or updated in place" }
|
|
202
|
+
);
|
|
203
|
+
const triggerActionsInputSchema = typebox.Type.Array(triggerActionInputSchema, {
|
|
204
|
+
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
|
+
});
|
|
206
|
+
const automaticTriggerSchema = typebox.Type.Object(
|
|
207
|
+
{
|
|
208
|
+
id: typebox.Type.Number({ description: "Unique identifier of the automatic trigger" }),
|
|
209
|
+
project_id: typebox.Type.Optional(
|
|
210
|
+
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
211
|
+
description: "Project this trigger belongs to. Null when it is ecosystem-wide"
|
|
212
|
+
})
|
|
213
|
+
),
|
|
214
|
+
source: triggerSourceSchema,
|
|
215
|
+
target: typebox.Type.Optional(
|
|
216
|
+
typebox.Type.Union([typebox.Type.String({ maxLength: 255 }), typebox.Type.Null()], {
|
|
217
|
+
description: "Concrete model/designer/field the event refers to. Null for sourceless events"
|
|
218
|
+
})
|
|
219
|
+
),
|
|
220
|
+
operation: typebox.Type.Optional(
|
|
221
|
+
typebox.Type.Union([triggerOperationSchema, typebox.Type.Null()], {
|
|
222
|
+
description: "Operation on the target that fires the trigger. Null when not applicable"
|
|
223
|
+
})
|
|
224
|
+
),
|
|
225
|
+
conditions: typebox.Type.Optional(
|
|
226
|
+
typebox.Type.Union([typebox.Type.Object({}, { additionalProperties: true }), typebox.Type.Null()], {
|
|
227
|
+
description: "jsonLogic conditions (root object) evaluated to decide whether the trigger runs"
|
|
228
|
+
})
|
|
229
|
+
),
|
|
230
|
+
relations: typebox.Type.Optional(
|
|
231
|
+
typebox.Type.Union([triggerRelationsSchema, typebox.Type.Null()], {
|
|
232
|
+
description: "Related models loaded into the context before evaluating the conditions and running the actions. Null means none."
|
|
233
|
+
})
|
|
234
|
+
),
|
|
235
|
+
enabled: typebox.Type.Optional(typebox.Type.Boolean({ description: "Whether the trigger is active" })),
|
|
236
|
+
retention_days: typebox.Type.Optional(
|
|
237
|
+
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
238
|
+
description: "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)."
|
|
239
|
+
})
|
|
240
|
+
)
|
|
241
|
+
},
|
|
242
|
+
{ title: "AutomaticTrigger", description: "Automatic trigger definition (ecosystem level)" }
|
|
243
|
+
);
|
|
244
|
+
const includeActionsQuerySchema = typebox.Type.Object(
|
|
245
|
+
{
|
|
246
|
+
includeActions: typebox.Type.Optional(
|
|
247
|
+
typebox.Type.Boolean({
|
|
248
|
+
default: false,
|
|
249
|
+
description: "Return each trigger with its ordered `actions` resolved, in a single request"
|
|
250
|
+
})
|
|
251
|
+
)
|
|
252
|
+
},
|
|
253
|
+
{ title: "IncludeActionsQuery", description: "Opt-in flag to embed the actions of a trigger" }
|
|
254
|
+
);
|
|
255
|
+
const createAutomaticTriggerSchema = typebox.Type.Object(
|
|
256
|
+
{
|
|
257
|
+
source: triggerSourceSchema,
|
|
258
|
+
target: typebox.Type.Optional(
|
|
259
|
+
typebox.Type.Union([typebox.Type.String({ maxLength: 255 }), typebox.Type.Null()], {
|
|
260
|
+
description: "Concrete model/designer/field the event refers to. Null for sourceless events"
|
|
261
|
+
})
|
|
262
|
+
),
|
|
263
|
+
operation: typebox.Type.Optional(
|
|
264
|
+
typebox.Type.Union([triggerOperationSchema, typebox.Type.Null()], {
|
|
265
|
+
description: "Operation on the target that fires the trigger. Null when not applicable"
|
|
266
|
+
})
|
|
267
|
+
),
|
|
268
|
+
conditions: typebox.Type.Optional(
|
|
269
|
+
typebox.Type.Union([typebox.Type.Object({}, { additionalProperties: true }), typebox.Type.Null()], {
|
|
270
|
+
description: "jsonLogic conditions (root object) evaluated to decide whether the trigger runs"
|
|
271
|
+
})
|
|
272
|
+
),
|
|
273
|
+
relations: typebox.Type.Optional(
|
|
274
|
+
typebox.Type.Union([triggerRelationsSchema, typebox.Type.Null()], {
|
|
275
|
+
description: "Related models loaded into the context before evaluating the conditions and running the actions. Null means none."
|
|
276
|
+
})
|
|
277
|
+
),
|
|
278
|
+
enabled: typebox.Type.Optional(typebox.Type.Boolean({ description: "Whether the trigger is active" })),
|
|
279
|
+
retention_days: typebox.Type.Optional(
|
|
280
|
+
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
281
|
+
description: "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)."
|
|
282
|
+
})
|
|
283
|
+
),
|
|
284
|
+
actions: typebox.Type.Optional(triggerActionsInputSchema)
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
title: "CreateAutomaticTrigger",
|
|
288
|
+
description: "Payload used to create an automatic trigger, optionally with the actions it runs",
|
|
289
|
+
additionalProperties: false
|
|
290
|
+
}
|
|
291
|
+
);
|
|
292
|
+
const updateAutomaticTriggerSchema = typebox.Type.Partial(createAutomaticTriggerSchema, {
|
|
293
|
+
title: "UpdateAutomaticTrigger",
|
|
294
|
+
description: "Payload used to update an automatic trigger, optionally replacing the actions it runs",
|
|
295
|
+
additionalProperties: false
|
|
296
|
+
});
|
|
297
|
+
const UnmatchedBehavior = {
|
|
298
|
+
HIDE: "hide",
|
|
299
|
+
DISABLE: "disable"
|
|
300
|
+
};
|
|
301
|
+
const unmatchedBehaviorSchema = typebox.Type.Enum(Object.values(UnmatchedBehavior), {
|
|
302
|
+
title: "UnmatchedBehavior",
|
|
303
|
+
description: "What to do with the button when the trigger does not match: hide it or disable it"
|
|
304
|
+
});
|
|
305
|
+
const IconPosition = {
|
|
306
|
+
LEFT: "left",
|
|
307
|
+
RIGHT: "right"
|
|
308
|
+
};
|
|
309
|
+
const iconPositionSchema = typebox.Type.Enum(Object.values(IconPosition), {
|
|
310
|
+
title: "IconPosition",
|
|
311
|
+
description: "Side of the label the icon sits on"
|
|
312
|
+
});
|
|
313
|
+
const manualTriggerButtonStyleSchema = typebox.Type.Object(
|
|
314
|
+
{
|
|
315
|
+
text: typebox.Type.Optional(typebox.Type.String({ description: "Handlebars template rendered as the button label" })),
|
|
316
|
+
textColor: typebox.Type.Optional(typebox.Type.String({ description: "Label colour" })),
|
|
317
|
+
bgColor: typebox.Type.Optional(typebox.Type.String({ description: "Background colour" })),
|
|
318
|
+
icon: typebox.Type.Optional(typebox.Type.String({ description: "Icon name, resolved by the consumer" })),
|
|
319
|
+
iconPosition: typebox.Type.Optional(iconPositionSchema)
|
|
320
|
+
},
|
|
321
|
+
{ title: "ManualTriggerButtonStyle", description: "Presentation of the button a manual trigger is offered on" }
|
|
322
|
+
);
|
|
323
|
+
const manualTriggerConditionalStyleSchema = typebox.Type.Intersect(
|
|
324
|
+
[
|
|
325
|
+
manualTriggerButtonStyleSchema,
|
|
326
|
+
typebox.Type.Object({
|
|
327
|
+
conditions: typebox.Type.Optional(
|
|
328
|
+
typebox.Type.Union([typebox.Type.Object({}, { additionalProperties: true }), typebox.Type.Null()], {
|
|
329
|
+
description: "jsonLogic conditions selecting this style. Absent or null always applies"
|
|
330
|
+
})
|
|
331
|
+
),
|
|
332
|
+
continueEvaluate: typebox.Type.Optional(
|
|
333
|
+
typebox.Type.Boolean({ description: "Keep evaluating later entries after this one matches" })
|
|
334
|
+
)
|
|
335
|
+
})
|
|
336
|
+
],
|
|
337
|
+
{ title: "ManualTriggerConditionalStyle" }
|
|
338
|
+
);
|
|
339
|
+
const manualTriggerConfigSchema = typebox.Type.Object(
|
|
340
|
+
{
|
|
341
|
+
unmatchedBehavior: typebox.Type.Optional(unmatchedBehaviorSchema),
|
|
342
|
+
styles: typebox.Type.Optional(manualTriggerButtonStyleSchema),
|
|
343
|
+
conditionalStyles: typebox.Type.Optional(typebox.Type.Array(manualTriggerConditionalStyleSchema))
|
|
344
|
+
},
|
|
345
|
+
{ title: "ManualTriggerConfig", additionalProperties: true }
|
|
346
|
+
);
|
|
347
|
+
const manualTriggerSchema = typebox.Type.Object(
|
|
348
|
+
{
|
|
349
|
+
id: typebox.Type.Number({ description: "Unique identifier of the manual trigger" }),
|
|
350
|
+
project_id: typebox.Type.Optional(
|
|
351
|
+
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
352
|
+
description: "Project this trigger belongs to. Null when it is ecosystem-wide"
|
|
353
|
+
})
|
|
354
|
+
),
|
|
355
|
+
name: typebox.Type.String({ maxLength: 255, description: "Human-readable label of the trigger where it is offered" }),
|
|
356
|
+
source: triggerSourceSchema,
|
|
357
|
+
target: typebox.Type.String({
|
|
358
|
+
maxLength: 255,
|
|
359
|
+
description: "Concrete model/designer/field the trigger is bound to. Always set: there is no wildcard"
|
|
360
|
+
}),
|
|
361
|
+
conditions: typebox.Type.Optional(
|
|
362
|
+
typebox.Type.Union([typebox.Type.Object({}, { additionalProperties: true }), typebox.Type.Null()], {
|
|
363
|
+
description: "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."
|
|
364
|
+
})
|
|
365
|
+
),
|
|
366
|
+
relations: typebox.Type.Optional(
|
|
367
|
+
typebox.Type.Union([triggerRelationsSchema, typebox.Type.Null()], {
|
|
368
|
+
description: "Related models loaded into the context before evaluating the conditions and running the actions. Null means none."
|
|
369
|
+
})
|
|
370
|
+
),
|
|
371
|
+
enabled: typebox.Type.Optional(typebox.Type.Boolean({ description: "Whether the trigger is active" })),
|
|
372
|
+
retention_days: typebox.Type.Optional(
|
|
373
|
+
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
374
|
+
description: "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)."
|
|
375
|
+
})
|
|
376
|
+
),
|
|
377
|
+
config: typebox.Type.Optional(
|
|
378
|
+
typebox.Type.Union([manualTriggerConfigSchema, typebox.Type.Null()], {
|
|
379
|
+
description: "Configuration of the trigger beyond its firing rules. Null means none"
|
|
380
|
+
})
|
|
381
|
+
)
|
|
382
|
+
},
|
|
383
|
+
{ title: "ManualTrigger", description: "Manual trigger definition (ecosystem level)" }
|
|
384
|
+
);
|
|
385
|
+
const createManualTriggerSchema = typebox.Type.Object(
|
|
386
|
+
{
|
|
387
|
+
name: typebox.Type.String({ maxLength: 255, description: "Human-readable label of the trigger where it is offered" }),
|
|
388
|
+
source: triggerSourceSchema,
|
|
389
|
+
target: typebox.Type.String({
|
|
390
|
+
maxLength: 255,
|
|
391
|
+
description: "Concrete model/designer/field the trigger is bound to. Always set: there is no wildcard"
|
|
392
|
+
}),
|
|
393
|
+
conditions: typebox.Type.Optional(
|
|
394
|
+
typebox.Type.Union([typebox.Type.Object({}, { additionalProperties: true }), typebox.Type.Null()], {
|
|
395
|
+
description: "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."
|
|
396
|
+
})
|
|
397
|
+
),
|
|
398
|
+
relations: typebox.Type.Optional(
|
|
399
|
+
typebox.Type.Union([triggerRelationsSchema, typebox.Type.Null()], {
|
|
400
|
+
description: "Related models loaded into the context before evaluating the conditions and running the actions. Null means none."
|
|
401
|
+
})
|
|
402
|
+
),
|
|
403
|
+
enabled: typebox.Type.Optional(typebox.Type.Boolean({ description: "Whether the trigger is active" })),
|
|
404
|
+
retention_days: typebox.Type.Optional(
|
|
405
|
+
typebox.Type.Union([typebox.Type.Number(), typebox.Type.Null()], {
|
|
406
|
+
description: "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)."
|
|
407
|
+
})
|
|
408
|
+
),
|
|
409
|
+
config: typebox.Type.Optional(
|
|
410
|
+
typebox.Type.Union([manualTriggerConfigSchema, typebox.Type.Null()], {
|
|
411
|
+
description: "Configuration of the trigger beyond its firing rules. Null means none"
|
|
412
|
+
})
|
|
413
|
+
),
|
|
414
|
+
actions: typebox.Type.Optional(triggerActionsInputSchema)
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
title: "CreateManualTrigger",
|
|
418
|
+
description: "Payload used to create a manual trigger, optionally with the actions it runs",
|
|
419
|
+
additionalProperties: false
|
|
420
|
+
}
|
|
421
|
+
);
|
|
422
|
+
const updateManualTriggerSchema = typebox.Type.Partial(createManualTriggerSchema, {
|
|
423
|
+
title: "UpdateManualTrigger",
|
|
424
|
+
description: "Payload used to update a manual trigger, optionally replacing the actions it runs",
|
|
425
|
+
additionalProperties: false
|
|
426
|
+
});
|
|
427
|
+
const manualTriggerAvailabilitySchema = typebox.Type.Object(
|
|
428
|
+
{
|
|
429
|
+
id: typebox.Type.Number({ description: "Identifier of the manual trigger" }),
|
|
430
|
+
name: typebox.Type.String({ description: "Human-readable label of the trigger" }),
|
|
431
|
+
matched: typebox.Type.Boolean({
|
|
432
|
+
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
|
+
}),
|
|
434
|
+
actionsCount: typebox.Type.Number({ description: "Number of actions the trigger would run" }),
|
|
435
|
+
relationsSkipped: typebox.Type.Optional(
|
|
436
|
+
typebox.Type.Union([typebox.Type.String(), typebox.Type.Null()], {
|
|
437
|
+
description: "Reason the declared relations could not be loaded before evaluating, when that happened. Null otherwise"
|
|
438
|
+
})
|
|
439
|
+
),
|
|
440
|
+
/**
|
|
441
|
+
* Resolved server-side: conditional styles already evaluated and label already compiled. Absent
|
|
442
|
+
* when the trigger has no config — the consumer then paints its own default button.
|
|
443
|
+
*/
|
|
444
|
+
style: typebox.Type.Optional(manualTriggerButtonStyleSchema)
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
title: "ManualTriggerAvailability",
|
|
448
|
+
description: "A manual trigger applicable to an entity, with its conditions already evaluated"
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
const manualTriggerAvailabilityListSchema = typebox.Type.Object(
|
|
452
|
+
{ results: typebox.Type.Array(manualTriggerAvailabilitySchema, { description: "Applicable manual triggers" }) },
|
|
453
|
+
{
|
|
454
|
+
title: "ManualTriggerAvailabilityList",
|
|
455
|
+
description: "Manual triggers applicable to an entity, with their conditions evaluated"
|
|
456
|
+
}
|
|
457
|
+
);
|
|
458
|
+
const manualTriggerAvailabilityQuerySchema = typebox.Type.Object(
|
|
459
|
+
{
|
|
460
|
+
source: triggerSourceSchema,
|
|
461
|
+
target: typebox.Type.String({ maxLength: 255, description: "Concrete model/designer/field the triggers are bound to" }),
|
|
462
|
+
entityId: typebox.Type.Number({ description: "Identifier of the entity the triggers would run against" })
|
|
463
|
+
},
|
|
464
|
+
{ title: "ManualTriggerAvailabilityQuery", description: "Entity the applicable manual triggers are listed for" }
|
|
465
|
+
);
|
|
466
|
+
const runManualTriggerSchema = typebox.Type.Object(
|
|
467
|
+
{ entityId: typebox.Type.Number({ description: "Identifier of the entity to run the trigger against" }) },
|
|
468
|
+
{ title: "RunManualTrigger", description: "Payload used to run a manual trigger against an entity" }
|
|
469
|
+
);
|
|
470
|
+
const automaticTriggerActionSchema = typebox.Type.Object(
|
|
471
|
+
{
|
|
472
|
+
id: typebox.Type.Number({ description: "Unique identifier of the trigger-action link" }),
|
|
473
|
+
automatic_trigger_id: typebox.Type.Number({
|
|
474
|
+
description: "Automatic trigger executing the action (FK to automatic_trigger)"
|
|
475
|
+
}),
|
|
476
|
+
action_id: typebox.Type.Number({ description: "Action executed by the trigger (FK to actions)" }),
|
|
477
|
+
execution_order: typebox.Type.Number({ description: "Execution order of the action within the trigger" })
|
|
478
|
+
},
|
|
479
|
+
{ title: "AutomaticTriggerAction", description: "Ordered link between an automatic trigger and an action" }
|
|
480
|
+
);
|
|
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
|
+
const manualTriggerActionSchema = typebox.Type.Object(
|
|
490
|
+
{
|
|
491
|
+
id: typebox.Type.Number({ description: "Unique identifier of the trigger-action link" }),
|
|
492
|
+
manual_trigger_id: typebox.Type.Number({
|
|
493
|
+
description: "Manual trigger executing the action (FK to manual_trigger)"
|
|
494
|
+
}),
|
|
495
|
+
action_id: typebox.Type.Number({ description: "Action executed by the trigger (FK to actions)" }),
|
|
496
|
+
execution_order: typebox.Type.Number({ description: "Execution order of the action within the trigger" })
|
|
497
|
+
},
|
|
498
|
+
{ title: "ManualTriggerAction", description: "Ordered link between a manual trigger and an action" }
|
|
499
|
+
);
|
|
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
|
+
const withResolvedActions = typebox.Type.Object({
|
|
509
|
+
actions: typebox.Type.Optional(typebox.Type.Array(actionSchema, { description: "Actions the trigger runs, in execution order" }))
|
|
510
|
+
});
|
|
511
|
+
const automaticTriggerWithActionsSchema = typebox.Type.Intersect([automaticTriggerSchema, withResolvedActions], {
|
|
512
|
+
title: "AutomaticTriggerWithActions",
|
|
513
|
+
description: "An automatic trigger and, when the request wrote them or `includeActions` asked for them, the actions it runs"
|
|
514
|
+
});
|
|
515
|
+
const manualTriggerWithActionsSchema = typebox.Type.Intersect([manualTriggerSchema, withResolvedActions], {
|
|
516
|
+
title: "ManualTriggerWithActions",
|
|
517
|
+
description: "A manual trigger and, when the request wrote them or `includeActions` asked for them, the actions it runs"
|
|
518
|
+
});
|
|
519
|
+
const triggerExecutionResultSchema = typebox.Type.Object(
|
|
520
|
+
{
|
|
521
|
+
triggerId: typebox.Type.Number({ description: "Identifier of the evaluated trigger" }),
|
|
522
|
+
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" })
|
|
525
|
+
},
|
|
526
|
+
{ title: "TriggerExecutionResult", description: "Outcome of evaluating and running one trigger" }
|
|
527
|
+
);
|
|
528
|
+
const successResponseSchema = typebox.Type.Object(
|
|
529
|
+
{ success: typebox.Type.Boolean({ description: "If the request success or not" }) },
|
|
530
|
+
{ title: "ActionSystemSuccessResponse", description: "Response when the request is successful" }
|
|
531
|
+
);
|
|
532
|
+
const withIdParamsSchema = typebox.Type.Intersect(
|
|
533
|
+
[ecosystemProjectParamsSchema, typebox.Type.Object({ id: typebox.Type.Number({ description: "Entity ID" }) })],
|
|
534
|
+
{ title: "EcosystemProjectWithActionSystemIdParams", description: "Params with ecosystem, project and entity ID" }
|
|
535
|
+
);
|
|
536
|
+
exports.ACTION_CONFIG_SCHEMAS = ACTION_CONFIG_SCHEMAS;
|
|
537
|
+
exports.ACTION_CONTEXT_SCHEMAS = ACTION_CONTEXT_SCHEMAS;
|
|
538
|
+
exports.ActionType = ActionType;
|
|
539
|
+
exports.ConditionsFormat = ConditionsFormat;
|
|
540
|
+
exports.IconPosition = IconPosition;
|
|
541
|
+
exports.TriggerOperation = TriggerOperation;
|
|
542
|
+
exports.TriggerSource = TriggerSource;
|
|
543
|
+
exports.UnmatchedBehavior = UnmatchedBehavior;
|
|
544
|
+
exports.actionConfigBaseSchema = actionConfigBaseSchema;
|
|
545
|
+
exports.actionConfigSchema = actionConfigSchema;
|
|
546
|
+
exports.actionContextBaseSchema = actionContextBaseSchema;
|
|
547
|
+
exports.actionSchema = actionSchema;
|
|
548
|
+
exports.actionTypeSchema = actionTypeSchema;
|
|
549
|
+
exports.apiActionConfigSchema = apiActionConfigSchema;
|
|
550
|
+
exports.apiActionContextSchema = apiActionContextSchema;
|
|
551
|
+
exports.automaticTriggerActionSchema = automaticTriggerActionSchema;
|
|
552
|
+
exports.automaticTriggerSchema = automaticTriggerSchema;
|
|
553
|
+
exports.automaticTriggerWithActionsSchema = automaticTriggerWithActionsSchema;
|
|
554
|
+
exports.conditionsFormatSchema = conditionsFormatSchema;
|
|
555
|
+
exports.createActionSchema = createActionSchema;
|
|
556
|
+
exports.createAutomaticTriggerActionSchema = createAutomaticTriggerActionSchema;
|
|
557
|
+
exports.createAutomaticTriggerSchema = createAutomaticTriggerSchema;
|
|
558
|
+
exports.createManualTriggerActionSchema = createManualTriggerActionSchema;
|
|
559
|
+
exports.createManualTriggerSchema = createManualTriggerSchema;
|
|
560
|
+
exports.iconPositionSchema = iconPositionSchema;
|
|
561
|
+
exports.includeActionsQuerySchema = includeActionsQuerySchema;
|
|
562
|
+
exports.manualTriggerActionSchema = manualTriggerActionSchema;
|
|
563
|
+
exports.manualTriggerAvailabilityListSchema = manualTriggerAvailabilityListSchema;
|
|
564
|
+
exports.manualTriggerAvailabilityQuerySchema = manualTriggerAvailabilityQuerySchema;
|
|
565
|
+
exports.manualTriggerAvailabilitySchema = manualTriggerAvailabilitySchema;
|
|
566
|
+
exports.manualTriggerButtonStyleSchema = manualTriggerButtonStyleSchema;
|
|
567
|
+
exports.manualTriggerConditionalStyleSchema = manualTriggerConditionalStyleSchema;
|
|
568
|
+
exports.manualTriggerConfigSchema = manualTriggerConfigSchema;
|
|
569
|
+
exports.manualTriggerSchema = manualTriggerSchema;
|
|
570
|
+
exports.manualTriggerWithActionsSchema = manualTriggerWithActionsSchema;
|
|
571
|
+
exports.runManualTriggerSchema = runManualTriggerSchema;
|
|
572
|
+
exports.successResponseSchema = successResponseSchema;
|
|
573
|
+
exports.triggerActionInputSchema = triggerActionInputSchema;
|
|
574
|
+
exports.triggerActionsInputSchema = triggerActionsInputSchema;
|
|
575
|
+
exports.triggerExecutionResultSchema = triggerExecutionResultSchema;
|
|
576
|
+
exports.triggerOperationSchema = triggerOperationSchema;
|
|
577
|
+
exports.triggerRelationsSchema = triggerRelationsSchema;
|
|
578
|
+
exports.triggerSourceSchema = triggerSourceSchema;
|
|
579
|
+
exports.unmatchedBehaviorSchema = unmatchedBehaviorSchema;
|
|
580
|
+
exports.updateActionSchema = updateActionSchema;
|
|
581
|
+
exports.updateAutomaticTriggerActionSchema = updateAutomaticTriggerActionSchema;
|
|
582
|
+
exports.updateAutomaticTriggerSchema = updateAutomaticTriggerSchema;
|
|
583
|
+
exports.updateManualTriggerActionSchema = updateManualTriggerActionSchema;
|
|
584
|
+
exports.updateManualTriggerSchema = updateManualTriggerSchema;
|
|
585
|
+
exports.withIdParamsSchema = withIdParamsSchema;
|
|
586
|
+
//# sourceMappingURL=ecosystem-action-system.cjs.map
|