@persei/perseed-api 5.0.18 → 5.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/client.cjs +780 -71
  2. package/dist/client.cjs.map +1 -1
  3. package/dist/client.mjs +781 -72
  4. package/dist/client.mjs.map +1 -1
  5. package/dist/ecosystem-action-system.cjs +506 -0
  6. package/dist/ecosystem-action-system.cjs.map +1 -0
  7. package/dist/ecosystem-action-system.d.ts +1 -0
  8. package/dist/ecosystem-action-system.mjs +506 -0
  9. package/dist/ecosystem-action-system.mjs.map +1 -0
  10. package/dist/ecosystem-container-widget.cjs +4 -3
  11. package/dist/ecosystem-container-widget.cjs.map +1 -1
  12. package/dist/ecosystem-container-widget.mjs +4 -3
  13. package/dist/ecosystem-container-widget.mjs.map +1 -1
  14. package/dist/lib/src/client/customFetch.d.ts +51 -0
  15. package/dist/lib/src/client/customFetch.d.ts.map +1 -0
  16. package/dist/lib/src/client/customFetch.test.d.ts +2 -0
  17. package/dist/lib/src/client/customFetch.test.d.ts.map +1 -0
  18. package/dist/lib/src/client/index.d.ts +1 -0
  19. package/dist/lib/src/client/index.d.ts.map +1 -1
  20. package/dist/lib/src/generated/client.d.ts +4742 -678
  21. package/dist/lib/src/generated/client.d.ts.map +1 -1
  22. package/dist/src/Services/AuthenticationSecurityService.d.ts +1 -1
  23. package/dist/src/Services/MobileService.d.ts +26 -1
  24. package/dist/src/Services/MobileService.d.ts.map +1 -1
  25. package/dist/src/Services/ProcessLogService.d.ts.map +1 -1
  26. package/dist/src/Services/ProjectService.d.ts.map +1 -1
  27. package/dist/src/Services/RedisQueueService.d.ts +16 -0
  28. package/dist/src/Services/RedisQueueService.d.ts.map +1 -1
  29. package/dist/src/Services/TriggerProcessLogService.d.ts +90 -0
  30. package/dist/src/Services/TriggerProcessLogService.d.ts.map +1 -0
  31. package/dist/src/Services/TriggerService.d.ts +16 -11
  32. package/dist/src/Services/TriggerService.d.ts.map +1 -1
  33. package/dist/src/Services/trigger-process-log-service.test.d.ts +2 -0
  34. package/dist/src/Services/trigger-process-log-service.test.d.ts.map +1 -0
  35. package/dist/src/controllers/AuthController.d.ts +37 -1
  36. package/dist/src/controllers/AuthController.d.ts.map +1 -1
  37. package/dist/src/controllers/FormController.d.ts.map +1 -1
  38. package/dist/src/controllers/thryve-credentials-crypto.d.ts +25 -0
  39. package/dist/src/controllers/thryve-credentials-crypto.d.ts.map +1 -0
  40. package/dist/src/controllers/thryve-credentials-crypto.test.d.ts +2 -0
  41. package/dist/src/controllers/thryve-credentials-crypto.test.d.ts.map +1 -0
  42. package/dist/src/helpers/error.d.ts +12 -0
  43. package/dist/src/helpers/error.d.ts.map +1 -1
  44. package/dist/src/lib.d.ts +1 -0
  45. package/dist/src/lib.d.ts.map +1 -1
  46. package/dist/src/models/ecosystem/ProcessLog.d.ts +11 -0
  47. package/dist/src/models/ecosystem/ProcessLog.d.ts.map +1 -1
  48. package/dist/src/models/ecosystem/ProcessLog.test.d.ts +2 -0
  49. package/dist/src/models/ecosystem/ProcessLog.test.d.ts.map +1 -0
  50. package/dist/src/models/project/DesignerCrf.d.ts +3 -2
  51. package/dist/src/models/project/DesignerCrf.d.ts.map +1 -1
  52. package/dist/src/models/project/designer-crf-after-save.test.d.ts +2 -0
  53. package/dist/src/models/project/designer-crf-after-save.test.d.ts.map +1 -0
  54. package/dist/src/module.d.ts +5 -0
  55. package/dist/src/schemas/notification_configuration/types.d.ts +19 -8
  56. package/dist/src/schemas/notification_configuration/types.d.ts.map +1 -1
  57. package/dist/src/schemas/process_log/create_process_log_payload.schema.json +4 -0
  58. package/dist/src/schemas/process_log/types.d.ts +3 -0
  59. package/dist/src/schemas/process_log/types.d.ts.map +1 -1
  60. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action-system.controller.e2e.d.ts +2 -0
  61. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action-system.controller.e2e.d.ts.map +1 -0
  62. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action-system.controller.test.d.ts +2 -0
  63. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action-system.controller.test.d.ts.map +1 -0
  64. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action.controller.d.ts +3 -0
  65. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/action.controller.d.ts.map +1 -0
  66. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/automatic-trigger.controller.d.ts +3 -0
  67. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/automatic-trigger.controller.d.ts.map +1 -0
  68. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/index.d.ts +6 -0
  69. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/index.d.ts.map +1 -0
  70. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/manual-trigger.controller.d.ts +3 -0
  71. package/dist/src/v2/modules/ecosystem/action-system/action-system.controller/manual-trigger.controller.d.ts.map +1 -0
  72. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts +127 -0
  73. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.d.ts.map +1 -0
  74. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.test.d.ts +2 -0
  75. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.test.d.ts.map +1 -0
  76. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/conditions-matcher.helper.d.ts +5 -0
  77. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/conditions-matcher.helper.d.ts.map +1 -0
  78. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/conditions-matcher.helper.test.d.ts +2 -0
  79. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/conditions-matcher.helper.test.d.ts.map +1 -0
  80. package/dist/src/{Services/ConditionsMatcher/CustomConditionsFormat.d.ts → v2/modules/ecosystem/action-system/action-system.helper/custom-conditions-format.helper.d.ts} +2 -2
  81. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/custom-conditions-format.helper.d.ts.map +1 -0
  82. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/custom-conditions-format.helper.test.d.ts +2 -0
  83. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/custom-conditions-format.helper.test.d.ts.map +1 -0
  84. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/index.d.ts +4 -0
  85. package/dist/src/v2/modules/ecosystem/action-system/action-system.helper/index.d.ts.map +1 -0
  86. package/dist/src/v2/modules/ecosystem/action-system/action-system.model.d.ts +121 -0
  87. package/dist/src/v2/modules/ecosystem/action-system/action-system.model.d.ts.map +1 -0
  88. package/dist/src/v2/modules/ecosystem/action-system/action-system.schema.d.ts +579 -0
  89. package/dist/src/v2/modules/ecosystem/action-system/action-system.schema.d.ts.map +1 -0
  90. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.d.ts +37 -0
  91. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.d.ts.map +1 -0
  92. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.e2e.d.ts +2 -0
  93. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.e2e.d.ts.map +1 -0
  94. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.test.d.ts +2 -0
  95. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action-system.service.test.d.ts.map +1 -0
  96. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action.service.d.ts +18 -0
  97. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action.service.d.ts.map +1 -0
  98. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action.service.test.d.ts +2 -0
  99. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/action.service.test.d.ts.map +1 -0
  100. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.d.ts +137 -0
  101. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.d.ts.map +1 -0
  102. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.test.d.ts +2 -0
  103. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/automatic-trigger.service.test.d.ts.map +1 -0
  104. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/index.d.ts +8 -0
  105. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/index.d.ts.map +1 -0
  106. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.d.ts +28 -0
  107. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.d.ts.map +1 -0
  108. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.test.d.ts +2 -0
  109. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger-engine.service.test.d.ts.map +1 -0
  110. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.d.ts +137 -0
  111. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.d.ts.map +1 -0
  112. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.test.d.ts +2 -0
  113. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/manual-trigger.service.test.d.ts.map +1 -0
  114. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-actions.service.d.ts +31 -0
  115. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-actions.service.d.ts.map +1 -0
  116. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-actions.service.test.d.ts +2 -0
  117. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-actions.service.test.d.ts.map +1 -0
  118. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts +52 -0
  119. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.d.ts.map +1 -0
  120. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.test.d.ts +2 -0
  121. package/dist/src/v2/modules/ecosystem/action-system/action-system.service/trigger-engine.service.test.d.ts.map +1 -0
  122. package/dist/src/v2/modules/ecosystem/action-system/index.d.ts +6 -0
  123. package/dist/src/v2/modules/ecosystem/action-system/index.d.ts.map +1 -0
  124. package/dist/src/v2/modules/ecosystem/action-system/lib.d.ts +2 -0
  125. package/dist/src/v2/modules/ecosystem/action-system/lib.d.ts.map +1 -0
  126. package/dist/src/v2/modules/ecosystem/container-widget/container-widget.helper.d.ts +17 -10
  127. package/dist/src/v2/modules/ecosystem/container-widget/container-widget.helper.d.ts.map +1 -1
  128. package/dist/src/v2/modules/global/api-error/api-error.schema.d.ts +9 -0
  129. package/dist/src/v2/modules/global/api-error/api-error.schema.d.ts.map +1 -1
  130. package/dist/src/v2/modules/global/e2e-operation/e2e-operation.service.d.ts +2 -2
  131. package/dist/src/v2/modules/global/e2e-operation/e2e-operation.service.d.ts.map +1 -1
  132. package/dist/src/v2/modules/global/request-log/request-log.middleware.d.ts.map +1 -1
  133. package/dist/src/v2/modules/project/document/document.controller.d.ts.map +1 -1
  134. package/dist/src/v2/modules/project/thryve/thryve.controller.d.ts.map +1 -1
  135. package/dist/src/v2/modules/project/thryve/thryve.service.d.ts +27 -3
  136. package/dist/src/v2/modules/project/thryve/thryve.service.d.ts.map +1 -1
  137. package/dist/src/v2/routes/v2/e2e/index.d.ts.map +1 -1
  138. package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/action/index.d.ts +3 -0
  139. package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/action/index.d.ts.map +1 -0
  140. package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/automatic-trigger/index.d.ts +3 -0
  141. package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/automatic-trigger/index.d.ts.map +1 -0
  142. package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/manual-trigger/index.d.ts +3 -0
  143. package/dist/src/v2/routes/v2/ecosystem/_ecosystemName/project/_projectName/manual-trigger/index.d.ts.map +1 -0
  144. package/dist/v1/perseed-api.cjs +8 -11
  145. package/dist/v1/perseed-api.cjs.map +1 -1
  146. package/dist/v1/perseed-api.mjs +7 -10
  147. package/dist/v1/perseed-api.mjs.map +1 -1
  148. package/package.json +1 -1
  149. package/dist/src/Services/ConditionsMatcher/CustomConditionsFormat.d.ts.map +0 -1
  150. package/dist/src/Services/ConditionsMatcher/index.d.ts +0 -4
  151. package/dist/src/Services/ConditionsMatcher/index.d.ts.map +0 -1
  152. package/dist/src/Services/conditions-matcher.test.d.ts +0 -2
  153. package/dist/src/Services/conditions-matcher.test.d.ts.map +0 -1
  154. package/dist/src/Services/custom-conditions-format.test.d.ts +0 -2
  155. package/dist/src/Services/custom-conditions-format.test.d.ts.map +0 -1
@@ -0,0 +1,127 @@
1
+ import { TSchema } from 'typebox';
2
+ import { FastifyRequest } from 'fastify';
3
+ import { ActionType, ActionData, ContextValidationResult, ActionConfigLike, EffectiveConfigResult, TriggerSource, TriggerRelations } from '../action-system.schema';
4
+ import { ApiActionContextData } from '../../../../../schemas/api_action/ApiActionTypes';
5
+ import { default as RequestContext, RequestContextData } from '../../../../../models/request/RequestContext';
6
+ /**
7
+ * Loads the entity a manual trigger runs against, scoped to the request project.
8
+ *
9
+ * The id comes from the caller here, unlike the automatic kind where it arrives from an event the
10
+ * platform emitted — hence the narrowing. A model without `project_id` (users are ecosystem-wide)
11
+ * cannot be narrowed and stays reachable across the projects of one ecosystem; see the README.
12
+ */
13
+ export declare function loadTriggerEntity(ctx: RequestContext, source: TriggerSource, target: string, entityId: number): Promise<Record<string, unknown> | undefined>;
14
+ /**
15
+ * Eager-loads the relations declared in `relations.join` onto `current`, each under its own name,
16
+ * so conditions and action payloads can reference them as `current.patient.name`.
17
+ *
18
+ * The model is resolved by `resolveTargetQuery`, with the joins passed up front so a displayer
19
+ * target builds its model with them already in place.
20
+ *
21
+ * Never throws: returns `current` untouched, with a `skipped` reason, when there is nothing to
22
+ * load or no way to load it. The trigger is then evaluated without the relations instead of
23
+ * aborting the whole batch.
24
+ */
25
+ export declare function loadRelations(ctx: RequestContext, source: TriggerSource, target: string | null | undefined, current: Record<string, unknown>, relations?: TriggerRelations | null): Promise<{
26
+ current: Record<string, unknown>;
27
+ skipped?: string;
28
+ }>;
29
+ export declare function safeGetRequestContextData(ctx: RequestContext): RequestContextData | undefined;
30
+ /**
31
+ * Returns whether an action type is registered (has a known config schema).
32
+ */
33
+ export declare function isKnownActionType(type: string): type is ActionType;
34
+ /**
35
+ * Resolves the config schema for a given action type. Used as the single entry
36
+ * point to validate an action config against the structure expected by its type.
37
+ * Throws when the type has no registered schema.
38
+ */
39
+ export declare function getActionConfigSchema(type: ActionType): TSchema;
40
+ /**
41
+ * Resolves the context schema for a given action type. Mirrors `getActionConfigSchema`.
42
+ * Throws when the type has no registered schema (unknown action type).
43
+ */
44
+ export declare function getActionContextSchema(type: string): TSchema;
45
+ /**
46
+ * Validates `config` against the schema registered for `type`. Throws a public
47
+ * 400 listing the errors. `index` is the position within a trigger payload's
48
+ * `actions` array: the array validates as a whole, so without it the client
49
+ * cannot tell which item is malformed. Single-action endpoints omit it.
50
+ */
51
+ export declare function assertValidActionConfig(type: ActionData['type'], config: ActionData['config'], index?: number): void;
52
+ /**
53
+ * Best-effort static extraction of the data paths a Handlebars payload references.
54
+ * Walks the payload recursively (objects/arrays/strings) and parses every mustache.
55
+ * A single-token mustache is a data path unless it names a helper/keyword. A helper
56
+ * invocation (`{{ json current.patient }}`, `{{#if current.enabled}}`) contributes
57
+ * its path-like arguments — never the helper name itself. Block markers (`#`/`/`),
58
+ * comments (`!`), partials (`>`), string/number literals and hash-arg keys are
59
+ * skipped. This is not a full Handlebars parser — it is a pragmatic scan good enough
60
+ * to validate that the referenced context paths exist before running the action.
61
+ */
62
+ export declare function extractTemplateRefs(value: unknown): string[];
63
+ /**
64
+ * Resolves a dotted path (e.g. `current.patient.id`) against the assembled action
65
+ * context. A segment is considered found only when its parent is a plain object
66
+ * that owns the key and its value is not `undefined`.
67
+ */
68
+ export declare function resolvePathValue(context: Record<string, unknown>, path: string): {
69
+ found: boolean;
70
+ value: unknown;
71
+ };
72
+ /**
73
+ * Resolves the expiry date-time for a process_log row from a *resolved* retention
74
+ * window in days. The caller passes `from` so this stays pure/testable.
75
+ *
76
+ * `retention_days` convention (issue #175, closed 2026-07-22). Three states,
77
+ * resolved differently per table (see `action-system.schema.ts`):
78
+ * - **desactivado** (`0`, or `null`/`0` on the trigger, the origin) → **never
79
+ * expires** → `null`.
80
+ * - **heredado** (`null` on an action) → inheritance sentinel, resolved by the
81
+ * caller *before* this call (see `executeTriggerActions`); a `null`
82
+ * still reaching here means "never".
83
+ * - **definido** (`N` (>0)) → expires `N` days after `from`.
84
+ *
85
+ * This function is retention-source-agnostic: it only turns an already-resolved
86
+ * value into an expiry (never stored/derived on the action row). `0` and
87
+ * `null`/`undefined` (and, defensively, any non-positive/non-finite value) map
88
+ * to "never".
89
+ *
90
+ * The result is formatted with `getMySQLDateTime` (UTC `YYYY-MM-DD HH:mm:ss`), the
91
+ * repo-wide convention for DATETIME columns. An ISO-8601 string is *not* usable
92
+ * here: MySQL rejects the `T`/`Z` form for a DATETIME under the default
93
+ * `STRICT_TRANS_TABLES` sql_mode, which would abort the process_log write.
94
+ */
95
+ export declare function resolveExpiresAt(retentionDays: number | null | undefined, from: Date): string | null;
96
+ /**
97
+ * Resolves the effective config an action executes with, from its static config.
98
+ * Pure and type-agnostic — driven only by the presence of `overridable`:
99
+ * - Override-type (`overridable` is an array): `effective` merges `default` with
100
+ * only the `payload` keys allow-listed by `overridable`; `overridableErrors`
101
+ * lists payload keys outside that allow-list.
102
+ * - Non-override type (no `overridable`, e.g. ApiAction): `effective` is the
103
+ * payload unchanged (identity) and there are no `overridableErrors` — the
104
+ * payload is a data mapping, not an override of a default config.
105
+ */
106
+ export declare function buildEffectiveConfig(config: ActionConfigLike): EffectiveConfigResult;
107
+ /**
108
+ * Three-level context validation for an action about to run:
109
+ * 0. Unknown `type` — returned (not thrown) as a single `baseErrors` entry, so
110
+ * callers get a uniform `ContextValidationResult` regardless of whether the
111
+ * type is registered; consistent with the other two checks below.
112
+ * 1. `baseErrors` — the assembled context matches the shape the action type expects.
113
+ * 2. `missingRefs` — every handlebars path referenced by the action payload resolves
114
+ * against the context (refs rooted at `ctx`, which is runtime-only, are ignored).
115
+ * 3. `overridableErrors` — for override-types, every payload key is allow-listed by
116
+ * `config.overridable` (via `buildEffectiveConfig`); always empty for non-override
117
+ * types such as ApiAction.
118
+ */
119
+ export declare function validateActionContext(type: string, context: ApiActionContextData, config: ActionConfigLike | undefined): ContextValidationResult;
120
+ /**
121
+ * Permission preHandler shared by every endpoint of this module (read and write alike —
122
+ * there is no read/write split for the triggers management privilege, unlike documents).
123
+ * Reuses the legacy v1
124
+ * `SEED_PRIVILEGE.TRIGGERS_MANAGEMENT` privilege (see `src/controllers/TriggerController.ts`).
125
+ */
126
+ export declare function requireTriggersManagement(req: FastifyRequest): Promise<void>;
127
+ //# sourceMappingURL=action-system.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-system.helper.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EACL,UAAU,EAGV,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AACjF,OAAO,KAAK,cAAc,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAY3E,OAAO,EAAE,aAAa,EAAE,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AIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAanH;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAMpG;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,gBAAgB,GAAG,qBAAqB,CAiBpF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,gBAAgB,GAAG,SAAS,GACnC,uBAAuB,CAiCzB;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAOlF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=action-system.helper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-system.helper.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.helper/action-system.helper.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { ConditionsRules } from '../../../../../schemas/notification_configuration/types';
2
+ import { ConditionsFormat } from '../action-system.schema';
3
+ import { ApiActionContextData } from '../../../../../schemas/api_action/ApiActionTypes';
4
+ export declare function conditionsMatch(context: ApiActionContextData, conditions: ConditionsRules, format?: ConditionsFormat, logPrefix?: string): Promise<boolean>;
5
+ //# sourceMappingURL=conditions-matcher.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions-matcher.helper.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.helper/conditions-matcher.helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,eAAe,EAAE,MAAM,8CAA8C,CAAA;AAC/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAM1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AA4BjF,wBAAsB,eAAe,CACnC,OAAO,EAAE,oBAAoB,EAC7B,UAAU,EAAE,eAAe,EAC3B,MAAM,CAAC,EAAE,gBAAgB,EACzB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,OAAO,CAAC,CAmBlB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=conditions-matcher.helper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conditions-matcher.helper.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.helper/conditions-matcher.helper.test.ts"],"names":[],"mappings":""}
@@ -1,7 +1,7 @@
1
- import { Conditions } from '../../schemas/notification_configuration/types';
1
+ import { Conditions } from '../../../../../schemas/notification_configuration/types';
2
2
  declare function conditionsToJqFilter(conditions: Conditions): string;
3
3
  declare const CustomConditionsFormat: {
4
4
  conditionsToJqFilter: typeof conditionsToJqFilter;
5
5
  };
6
6
  export default CustomConditionsFormat;
7
- //# sourceMappingURL=CustomConditionsFormat.d.ts.map
7
+ //# sourceMappingURL=custom-conditions-format.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-conditions-format.helper.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.helper/custom-conditions-format.helper.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,8CAA8C,CAAA;AAK9F,iBAAS,oBAAoB,CAAC,UAAU,EAAE,UAAU,UAwCnD;AA+BD,QAAA,MAAM,sBAAsB;;CAE3B,CAAA;AAED,eAAe,sBAAsB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=custom-conditions-format.helper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-conditions-format.helper.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.helper/custom-conditions-format.helper.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export * from './action-system.helper';
2
+ export * from './conditions-matcher.helper';
3
+ export { default as CustomConditionsFormat } from './custom-conditions-format.helper';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/v2/modules/ecosystem/action-system/action-system.helper/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,mCAAmC,CAAA"}
@@ -0,0 +1,121 @@
1
+ import { default as Objection } from 'objection';
2
+ import { default as BaseModel } from '../../../../models/BaseModel';
3
+ import { default as RequestContext } from '../../../../models/request/RequestContext';
4
+ import { TypedQueryBuilder } from '../../global/objection';
5
+ import { AutomaticTriggerData, ActionData, AutomaticTriggerActionData, ManualTriggerData, ManualTriggerActionData, ActionConfig, TriggerSource, TriggerOperation, TriggerRelations, ActionType } from './action-system.schema';
6
+ export declare class AutomaticTrigger extends BaseModel implements AutomaticTriggerData {
7
+ project_id?: number | null;
8
+ source: TriggerSource;
9
+ target?: string | null;
10
+ operation?: TriggerOperation | null;
11
+ conditions?: object | null;
12
+ relations?: TriggerRelations | null;
13
+ enabled?: boolean;
14
+ retention_days?: number | null;
15
+ trigger_actions?: AutomaticTriggerAction[];
16
+ static tableName: string;
17
+ static jsonAttributes: string[];
18
+ static jsonSchema: Objection.JSONSchema;
19
+ static get relationMappings(): {
20
+ trigger_actions: {
21
+ relation: Objection.RelationType;
22
+ modelClass: typeof AutomaticTriggerAction;
23
+ join: {
24
+ from: string;
25
+ to: string;
26
+ };
27
+ };
28
+ };
29
+ static QueryBuilder: typeof Objection.QueryBuilder;
30
+ static query(): TypedQueryBuilder<AutomaticTrigger, typeof AutomaticTrigger, never>;
31
+ static getModel(ctx: RequestContext): typeof AutomaticTrigger;
32
+ static getModelByPool(ecosystemPool: Objection.TransactionOrKnex): typeof AutomaticTrigger;
33
+ }
34
+ export declare class Action extends BaseModel implements ActionData {
35
+ project_id?: number | null;
36
+ name: string;
37
+ type: ActionType;
38
+ config: ActionConfig;
39
+ retention_days?: number | null;
40
+ library?: boolean;
41
+ static tableName: string;
42
+ static jsonAttributes: string[];
43
+ static jsonSchema: Objection.JSONSchema;
44
+ static QueryBuilder: typeof Objection.QueryBuilder;
45
+ static query(): TypedQueryBuilder<Action, typeof Action, never>;
46
+ static getModel(ctx: RequestContext): typeof Action;
47
+ static getModelByPool(ecosystemPool: Objection.TransactionOrKnex): typeof Action;
48
+ }
49
+ export declare class AutomaticTriggerAction extends BaseModel implements AutomaticTriggerActionData {
50
+ automatic_trigger_id: number;
51
+ action_id: number;
52
+ execution_order: number;
53
+ action?: Action;
54
+ static tableName: string;
55
+ static jsonSchema: Objection.JSONSchema;
56
+ static get relationMappings(): {
57
+ action: {
58
+ relation: Objection.RelationType;
59
+ modelClass: typeof Action;
60
+ join: {
61
+ from: string;
62
+ to: string;
63
+ };
64
+ };
65
+ };
66
+ static QueryBuilder: typeof Objection.QueryBuilder;
67
+ static query(): TypedQueryBuilder<AutomaticTriggerAction, typeof AutomaticTriggerAction, never>;
68
+ static getModel(ctx: RequestContext): typeof AutomaticTriggerAction;
69
+ static getModelByPool(ecosystemPool: Objection.TransactionOrKnex): typeof AutomaticTriggerAction;
70
+ }
71
+ export declare class ManualTrigger extends BaseModel implements ManualTriggerData {
72
+ project_id?: number | null;
73
+ name: string;
74
+ source: TriggerSource;
75
+ target: string;
76
+ conditions?: object | null;
77
+ relations?: TriggerRelations | null;
78
+ enabled?: boolean;
79
+ retention_days?: number | null;
80
+ trigger_actions?: ManualTriggerAction[];
81
+ static tableName: string;
82
+ static jsonAttributes: string[];
83
+ static jsonSchema: Objection.JSONSchema;
84
+ static get relationMappings(): {
85
+ trigger_actions: {
86
+ relation: Objection.RelationType;
87
+ modelClass: typeof ManualTriggerAction;
88
+ join: {
89
+ from: string;
90
+ to: string;
91
+ };
92
+ };
93
+ };
94
+ static QueryBuilder: typeof Objection.QueryBuilder;
95
+ static query(): TypedQueryBuilder<ManualTrigger, typeof ManualTrigger, never>;
96
+ static getModel(ctx: RequestContext): typeof ManualTrigger;
97
+ static getModelByPool(ecosystemPool: Objection.TransactionOrKnex): typeof ManualTrigger;
98
+ }
99
+ export declare class ManualTriggerAction extends BaseModel implements ManualTriggerActionData {
100
+ manual_trigger_id: number;
101
+ action_id: number;
102
+ execution_order: number;
103
+ action?: Action;
104
+ static tableName: string;
105
+ static jsonSchema: Objection.JSONSchema;
106
+ static get relationMappings(): {
107
+ action: {
108
+ relation: Objection.RelationType;
109
+ modelClass: typeof Action;
110
+ join: {
111
+ from: string;
112
+ to: string;
113
+ };
114
+ };
115
+ };
116
+ static QueryBuilder: typeof Objection.QueryBuilder;
117
+ static query(): TypedQueryBuilder<ManualTriggerAction, typeof ManualTriggerAction, never>;
118
+ static getModel(ctx: RequestContext): typeof ManualTriggerAction;
119
+ static getModelByPool(ecosystemPool: Objection.TransactionOrKnex): typeof ManualTriggerAction;
120
+ }
121
+ //# sourceMappingURL=action-system.model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-system.model.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/modules/ecosystem/action-system/action-system.model.ts"],"names":[],"mappings":"AAAA,OAAO,SAAkC,MAAM,WAAW,CAAA;AAC1D,OAAO,SAAS,MAAM,sBAAsB,CAAA;AAC5C,OAAO,cAAc,MAAM,mCAAmC,CAAA;AAE9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4B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