@antcde/connect-ts 0.4.27-rc.9 → 0.4.28-rc.1

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 (91) hide show
  1. package/build/AntConnect.d.ts +4 -0
  2. package/build/AntConnect.d.ts.map +1 -1
  3. package/build/AntConnect.js +4 -0
  4. package/build/comms/signal.d.ts +1 -0
  5. package/build/comms/signal.d.ts.map +1 -1
  6. package/build/comms/signal.js +1 -0
  7. package/build/comms/signalFilePreviewTypes.d.ts +65 -0
  8. package/build/comms/signalFilePreviewTypes.d.ts.map +1 -0
  9. package/build/comms/signalFilePreviewTypes.js +9 -0
  10. package/build/comms/signalRouteTypes.d.ts +38 -0
  11. package/build/comms/signalRouteTypes.d.ts.map +1 -0
  12. package/build/comms/signalRouteTypes.js +8 -0
  13. package/build/comms/signalTypes.d.ts +11 -46
  14. package/build/comms/signalTypes.d.ts.map +1 -1
  15. package/build/index.d.ts +26 -2
  16. package/build/index.d.ts.map +1 -1
  17. package/build/index.js +5 -0
  18. package/build/service-runtime.d.ts +1 -1
  19. package/build/service-runtime.d.ts.map +1 -1
  20. package/build/service-runtime.js +1 -1
  21. package/build/service-types.d.ts +3 -1
  22. package/build/service-types.d.ts.map +1 -1
  23. package/build/services/ProjectService.d.ts +0 -1
  24. package/build/services/ProjectService.d.ts.map +1 -1
  25. package/build/services/TaskService.d.ts +6 -1
  26. package/build/services/TaskService.d.ts.map +1 -1
  27. package/build/services/TaskService.js +1 -1
  28. package/build/services/TaskService.requests.d.ts +61 -0
  29. package/build/services/TaskService.requests.d.ts.map +1 -0
  30. package/build/services/TaskService.requests.js +1 -0
  31. package/build/services/TaskService.types.d.ts +2 -51
  32. package/build/services/TaskService.types.d.ts.map +1 -1
  33. package/build/services/TaskServiceQueries.d.ts +9 -1
  34. package/build/services/TaskServiceQueries.d.ts.map +1 -1
  35. package/build/services/TaskServiceQueries.js +12 -1
  36. package/build/services/Webhook/ConfigService.d.ts +31 -1
  37. package/build/services/Webhook/ConfigService.d.ts.map +1 -1
  38. package/build/services/Webhook/ConfigService.js +1 -1
  39. package/build/services/Webhook/EventService.d.ts +117 -0
  40. package/build/services/Webhook/EventService.d.ts.map +1 -1
  41. package/build/services/Webhook/TriggerChaining.d.ts +45 -0
  42. package/build/services/Webhook/TriggerChaining.d.ts.map +1 -0
  43. package/build/services/Webhook/TriggerChaining.js +1 -0
  44. package/build/services/Webhook/TriggerDataset.types.d.ts +160 -0
  45. package/build/services/Webhook/TriggerDataset.types.d.ts.map +1 -0
  46. package/build/services/Webhook/TriggerDataset.types.js +74 -0
  47. package/build/services/Webhook/TriggerDatasetColumns.d.ts +72 -0
  48. package/build/services/Webhook/TriggerDatasetColumns.d.ts.map +1 -0
  49. package/build/services/Webhook/TriggerDatasetColumns.js +116 -0
  50. package/build/services/Webhook/TriggerDatasetResponses.types.d.ts +158 -0
  51. package/build/services/Webhook/TriggerDatasetResponses.types.d.ts.map +1 -0
  52. package/build/services/Webhook/TriggerDatasetResponses.types.js +98 -0
  53. package/build/services/Webhook/TriggerDatasetSourceService.d.ts +180 -0
  54. package/build/services/Webhook/TriggerDatasetSourceService.d.ts.map +1 -0
  55. package/build/services/Webhook/TriggerDatasetSourceService.js +23 -0
  56. package/build/services/Webhook/TriggerDispatch.types.d.ts +89 -0
  57. package/build/services/Webhook/TriggerDispatch.types.d.ts.map +1 -0
  58. package/build/services/Webhook/TriggerDispatch.types.js +24 -0
  59. package/build/services/Webhook/TriggerDivergence.d.ts +30 -0
  60. package/build/services/Webhook/TriggerDivergence.d.ts.map +1 -0
  61. package/build/services/Webhook/TriggerDivergence.js +25 -0
  62. package/build/services/Webhook/TriggerFailedRuns.types.d.ts +57 -0
  63. package/build/services/Webhook/TriggerFailedRuns.types.d.ts.map +1 -0
  64. package/build/services/Webhook/TriggerFailedRuns.types.js +1 -0
  65. package/build/services/Webhook/TriggerHistoryService.d.ts +88 -18
  66. package/build/services/Webhook/TriggerHistoryService.d.ts.map +1 -1
  67. package/build/services/Webhook/TriggerLastRun.types.d.ts +80 -0
  68. package/build/services/Webhook/TriggerLastRun.types.d.ts.map +1 -0
  69. package/build/services/Webhook/TriggerLastRun.types.js +1 -0
  70. package/build/services/Webhook/TriggerRefusalDetail.types.d.ts +63 -0
  71. package/build/services/Webhook/TriggerRefusalDetail.types.d.ts.map +1 -0
  72. package/build/services/Webhook/TriggerRefusalDetail.types.js +12 -0
  73. package/build/services/Webhook/TriggerRequest.types.d.ts +77 -0
  74. package/build/services/Webhook/TriggerRequest.types.d.ts.map +1 -0
  75. package/build/services/Webhook/TriggerRequest.types.js +1 -0
  76. package/build/services/Webhook/TriggerSearch.types.d.ts +42 -0
  77. package/build/services/Webhook/TriggerSearch.types.d.ts.map +1 -0
  78. package/build/services/Webhook/TriggerSearch.types.js +1 -0
  79. package/build/services/Webhook/TriggerService.d.ts +158 -150
  80. package/build/services/Webhook/TriggerService.d.ts.map +1 -1
  81. package/build/services/Webhook/TriggerService.js +0 -24
  82. package/build/services/Webhook/TriggerTimeline.types.d.ts +42 -0
  83. package/build/services/Webhook/TriggerTimeline.types.d.ts.map +1 -0
  84. package/build/services/Webhook/TriggerTimeline.types.js +1 -0
  85. package/build/services/Webhook/TriggerVersion.types.d.ts +107 -0
  86. package/build/services/Webhook/TriggerVersion.types.d.ts.map +1 -0
  87. package/build/services/Webhook/TriggerVersion.types.js +1 -0
  88. package/build/services/Webhook/TriggerVersionService.d.ts +64 -0
  89. package/build/services/Webhook/TriggerVersionService.d.ts.map +1 -0
  90. package/build/services/Webhook/TriggerVersionService.js +21 -0
  91. package/package.json +11 -10
@@ -0,0 +1,80 @@
1
+ import type { ResourceAccessReason } from '../AppService/types/resourceEntitlements';
2
+ import type { DatasetRefusalReason } from './TriggerDatasetResponses.types';
3
+ import type { TriggerResourceReason } from './TriggerDispatch.types';
4
+ import type { ExecutionStatus } from './TriggerHistoryService';
5
+ /**
6
+ * The most recent execution of a trigger, for the index's run-status column
7
+ * (AAD-961 §1).
8
+ *
9
+ * Split out of `TriggerService.ts`, which is at its size limit; re-exported from
10
+ * the package root, so no consumer import path changes.
11
+ *
12
+ * Backed server-side by `Trigger::latestExecution()` (`latestOfMany`) over a
13
+ * `(trigger_id, executed_at)` index, eager-loaded — so it costs one query per page
14
+ * rather than one per row.
15
+ */
16
+ /**
17
+ * ⚠️ **`null` means the trigger has NEVER RUN. That is not a run that failed.**
18
+ *
19
+ * The distinction is the entire point of the column. Defaulting a missing value to
20
+ * a green "ran clean" would call an unmeasured trigger healthy and hide the broken
21
+ * row beside it, which is the worst answer this column can give. Render "never
22
+ * run" as its own state.
23
+ *
24
+ * Every key below is always present when the object exists — the nullable ones
25
+ * carry `null`, they are not omitted.
26
+ */
27
+ export interface TriggerLastRun {
28
+ /**
29
+ * The execution id, so the row can link straight to the run.
30
+ *
31
+ * Present so a client need not search the history for the run it was just
32
+ * described.
33
+ */
34
+ id: string;
35
+ /**
36
+ * This execution's OWN status — the same vocabulary as
37
+ * {@link TriggerExecutionHistory.status}, so there is only one set of values to
38
+ * learn.
39
+ *
40
+ * ⚠️ **It is NOT `overall_status`, and the two genuinely disagree.**
41
+ * `overall_status` is chain-aware and can report `partial_success` when a
42
+ * CHILD execution failed; this reports how *this* trigger's own run ended, so a
43
+ * chained trigger whose child failed shows `success` here. `overall_status` is
44
+ * deliberately absent from the index: computing it walks every child execution,
45
+ * which is a query per row.
46
+ *
47
+ * If the column needs to reflect chain failures, read `overall_status` from the
48
+ * run detail rather than inferring it from this.
49
+ */
50
+ status: ExecutionStatus;
51
+ /** When it ran. ISO 8601; never null — the column is NOT NULL. */
52
+ at: string;
53
+ /** Wall-clock duration. Null when the run never recorded one. */
54
+ duration_ms: number | null;
55
+ /**
56
+ * The machine-readable code when the run was REFUSED, rather than merely failed.
57
+ *
58
+ * ⚠️ **`reason: null` does NOT mean the run succeeded.** A refusal is a
59
+ * deliberate, categorised "no"; an ordinary exception is not, and carries no
60
+ * code. So `status: 'error'` with `reason: null` is a real and common
61
+ * combination — an uncaught failure. Branch on `status` first and treat `reason`
62
+ * as extra detail when it is there, never as the presence test for failure.
63
+ *
64
+ * Values come from the same vocabulary as
65
+ * {@link TriggerExecutionHistory.refusal_reason}, covering both dataset refusals
66
+ * and entitlement refusals. The figures behind a ceiling refusal are not here —
67
+ * they are on the run itself, as `refusal_detail`.
68
+ */
69
+ reason: DatasetRefusalReason | ResourceAccessReason | TriggerResourceReason | null;
70
+ /**
71
+ * The publisher's label for the version that ran, e.g. `"1.0.0"`.
72
+ *
73
+ * Null when the trigger's own draft ran, AND null when the version that ran has
74
+ * since been deleted. The run detail's `trigger_version_id` tells those two
75
+ * apart; on the index there is only the label, so treat null as "no version to
76
+ * name" rather than as "no version was involved".
77
+ */
78
+ trigger_version_label: string | null;
79
+ }
80
+ //# sourceMappingURL=TriggerLastRun.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TriggerLastRun.types.d.ts","sourceRoot":"","sources":["../../../src/services/Webhook/TriggerLastRun.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAA;AACpF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAE9D;;;;;;;;;;GAUG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;;;;;;;;;;;;;OAcG;IACH,MAAM,EAAE,eAAe,CAAA;IAEvB,kEAAkE;IAClE,EAAE,EAAE,MAAM,CAAA;IAEV,iEAAiE;IACjE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAE1B;;;;;;;;;;;;;OAaG;IACH,MAAM,EAAE,oBAAoB,GAAG,oBAAoB,GAAG,qBAAqB,GAAG,IAAI,CAAA;IAElF;;;;;;;OAOG;IACH,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAA;CACrC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The numbers behind a ceiling refusal, for the run-diagnosis view (AAD-961 §4).
3
+ *
4
+ * Publisher-only, and it lives on the execution-history row rather than in a
5
+ * dispatch response — a caller never receives it. That is why this is its own file
6
+ * and not part of `TriggerDatasetResponses.types.ts`, which describes what a
7
+ * dispatch returns.
8
+ *
9
+ * It exists so a run view can offer "what would fix it" instead of only echoing a
10
+ * sentence. Parsing the prose for the figures works until somebody rewords it.
11
+ */
12
+ /**
13
+ * A ceiling and, when it was actually measured, the value that exceeded it.
14
+ *
15
+ * `null` on the history row for every refusal that is not a ceiling — see
16
+ * {@link TriggerExecutionHistory.refusal_detail}.
17
+ */
18
+ export interface DatasetRefusalDetail {
19
+ /** The ceiling that applied, in `unit`. */
20
+ limit: number;
21
+ /**
22
+ * ⚠️ **OPTIONAL, and ABSENT MEANS NEVER MEASURED — not zero.**
23
+ *
24
+ * Rendering a missing `actual` as `0` reproduces at this end exactly the
25
+ * fabrication the backend refuses to commit at the other: it would tell a
26
+ * publisher their file is 0 bytes. Show "over the limit" with no figure, and
27
+ * never substitute the ceiling — reporting the limit as though it were the
28
+ * measurement is the specific mistake this shape was built to prevent.
29
+ *
30
+ * On a trigger run it is normally PRESENT. `byte_limit_exceeded` here means the
31
+ * SOURCE FILE is too big, and the check compares the file's recorded size
32
+ * before opening anything — so the number is known.
33
+ *
34
+ * It is absent in one case: when the recorded size is not a canonical byte
35
+ * count. A malformed size is refused through the *same* reason so it cannot
36
+ * bypass the ceiling, which means `byte_limit_exceeded` covers both "too big"
37
+ * and "we do not trust the recorded size" — and only the first is a
38
+ * measurement. `Number("-1")` and `Number("1.5")` are not measurements of
39
+ * anything.
40
+ *
41
+ * (The Store's artifact writer is the caller that never knows the size, because
42
+ * it aborts the moment the ceiling is crossed. That path does not write trigger
43
+ * history, so you will not see it here — but it is why the field is optional in
44
+ * the shape at all.)
45
+ */
46
+ actual?: number;
47
+ /**
48
+ * The unit `limit` and `actual` are counted in.
49
+ *
50
+ * Only `bytes` occurs on a trigger run, and the narrow type is deliberate so no
51
+ * one builds a branch that never fires. A row ceiling cannot produce a refusal
52
+ * here at all: a dataset action CLAMPS to the declared limit and reports
53
+ * `dataset_truncated: true` on a **successful** response, rather than refusing —
54
+ * which is why `row_limit_exceeded` is absent from
55
+ * {@link DatasetRefusalReason} too.
56
+ *
57
+ * If a row-based refusal ever becomes reachable, widening this to
58
+ * `'bytes' | 'rows'` is the deliberate change, and TypeScript will flag every
59
+ * exhaustive switch at that point. That is the right moment to find them.
60
+ */
61
+ unit: 'bytes';
62
+ }
63
+ //# sourceMappingURL=TriggerRefusalDetail.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TriggerRefusalDetail.types.d.ts","sourceRoot":"","sources":["../../../src/services/Webhook/TriggerRefusalDetail.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAA;IAEb;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;;;;;;;;;;;OAaG;IACH,IAAI,EAAE,OAAO,CAAA;CACd"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The numbers behind a ceiling refusal, for the run-diagnosis view (AAD-961 §4).
3
+ *
4
+ * Publisher-only, and it lives on the execution-history row rather than in a
5
+ * dispatch response — a caller never receives it. That is why this is its own file
6
+ * and not part of `TriggerDatasetResponses.types.ts`, which describes what a
7
+ * dispatch returns.
8
+ *
9
+ * It exists so a run view can offer "what would fix it" instead of only echoing a
10
+ * sentence. Parsing the prose for the figures works until somebody rewords it.
11
+ */
12
+ export {};
@@ -0,0 +1,77 @@
1
+ import type { AuthType, HTTPMethod } from './ConfigService';
2
+ import type { CreateTriggerSecretBindingBody } from './TriggerSecretService';
3
+ /**
4
+ * The WRITE shape for a trigger — what create and update accept.
5
+ *
6
+ * Split out of `TriggerService.ts`, which holds the read shape and was at its
7
+ * size limit. Re-exported from the package root, so no consumer import path
8
+ * changes.
9
+ */
10
+ export interface TriggerRequestBody {
11
+ name?: string;
12
+ auth_type?: AuthType;
13
+ event_id?: string | null;
14
+ payload?: any;
15
+ when?: string | null;
16
+ http_method?: HTTPMethod | null;
17
+ secret_token?: string | null;
18
+ /**
19
+ * ⚠️ **ADDING a link is refused with a 422.** Chaining is being retired in
20
+ * favour of the Workflows app.
21
+ *
22
+ * What still works: sending a set with a link REMOVED, and re-sending an
23
+ * unchanged set, which is a no-op — so an ordinary full-object update of an
24
+ * already-chained trigger succeeds and a rename does not fail. What is refused
25
+ * is naming any trigger the link does not already point at.
26
+ *
27
+ * So a create can never include one, and an edit form must send back exactly
28
+ * what it received or fewer.
29
+ *
30
+ * The response now uses these same snake_case names (AAD-991), so request and
31
+ * response are symmetric — they were not, and that mismatch produced a live bug.
32
+ */
33
+ run_before_triggers?: string[];
34
+ run_after_triggers?: string[];
35
+ is_active?: boolean;
36
+ debug_mode?: boolean;
37
+ /**
38
+ * ⚠️ Added in AAD-980 because the triggers app had **always** sent this and the
39
+ * type had never listed it — the app's typecheck never surfaced it (its
40
+ * `@types/node` is missing, so `vue-tsc` bails before reporting). The backend
41
+ * accepts it, and `Trigger.close_task_after_execution` and
42
+ * `TriggerVersionLockedField` both carry it, so the omission was here.
43
+ */
44
+ close_task_after_execution?: boolean;
45
+ custom_path?: string | null;
46
+ /**
47
+ * Optional Vault-secret bindings created atomically with the trigger (create
48
+ * only). Each references an existing secret by id plus placement metadata; the
49
+ * backend creates the trigger and all bindings in one transaction, so a
50
+ * rejected binding (out-of-context / missing `use`) rolls the whole create back.
51
+ */
52
+ secret_bindings?: CreateTriggerSecretBindingBody[];
53
+ /**
54
+ * Refuse any event whose `access_mode` is `write`.
55
+ *
56
+ * Worth surfacing in the trigger form rather than hiding: without a toggle,
57
+ * "this action needs a non-read-only trigger" is advice a user cannot act on.
58
+ */
59
+ read_only?: boolean;
60
+ /**
61
+ * Check the declared resource targets against the trigger's own
62
+ * licence/project. New triggers default to `true`; older rows may be `false`
63
+ * and run the check in shadow mode.
64
+ */
65
+ authorization_enforced?: boolean;
66
+ /**
67
+ * 1..65535. Null clears any per-trigger override, handing the field back to the
68
+ * server default — see `Trigger.rate_limit_per_second` for why that is not
69
+ * the same as "unlimited".
70
+ */
71
+ rate_limit_per_second?: number | null;
72
+ /** 1..65535, or null. Must be >= `rate_limit_per_second` when both are set. */
73
+ rate_limit_per_minute?: number | null;
74
+ /** See `Trigger.payload_pins`. Null or `{}` clears every pin. */
75
+ payload_pins?: Record<string, any> | null;
76
+ }
77
+ //# sourceMappingURL=TriggerRequest.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TriggerRequest.types.d.ts","sourceRoot":"","sources":["../../../src/services/Webhook/TriggerRequest.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAA;AAE5E;;;;;;GAMG;AAEH,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,QAAQ,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,WAAW,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B;;;;;;;;;;;;;;OAcG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;OAMG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,8BAA8B,EAAE,CAAA;IAGlD;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,+EAA+E;IAC/E,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAA;CAC1C"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,42 @@
1
+ import type { LabelFilterParams } from '../LabelService';
2
+ /**
3
+ * Query parameters for listing triggers.
4
+ *
5
+ * Split out of `TriggerService.ts`, which holds the entity shape and is at its size
6
+ * limit. Re-exported from the package root, so no consumer import path changes.
7
+ */
8
+ /**
9
+ * Search parameters for triggers
10
+ */
11
+ export interface TriggerSearchParams {
12
+ search?: string;
13
+ page?: number;
14
+ per_page?: number;
15
+ /**
16
+ * Narrow the list to triggers that still hold a chain link, for working through
17
+ * the deprecation.
18
+ *
19
+ * Server-side on purpose: a client-side approximation would disagree with the
20
+ * unfiltered `TriggerChainingSummary.count` (on the index response) shown beside it, and it cannot
21
+ * see triggers on other pages anyway. Applying it does NOT change that count.
22
+ */
23
+ uses?: 'chaining';
24
+ filters?: LabelFilterParams & {
25
+ name?: {
26
+ $contains?: string;
27
+ $eq?: string;
28
+ };
29
+ when?: {
30
+ $contains?: string;
31
+ $eq?: string;
32
+ };
33
+ is_active?: {
34
+ $eq?: boolean;
35
+ };
36
+ event_id?: {
37
+ $eq?: string;
38
+ };
39
+ [key: string]: any;
40
+ };
41
+ }
42
+ //# sourceMappingURL=TriggerSearch.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TriggerSearch.types.d.ts","sourceRoot":"","sources":["../../../src/services/Webhook/TriggerSearch.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,OAAO,CAAC,EAAE,iBAAiB,GAAG;QAC5B,IAAI,CAAC,EAAE;YACL,SAAS,CAAC,EAAE,MAAM,CAAA;YAClB,GAAG,CAAC,EAAE,MAAM,CAAA;SACb,CAAA;QACD,IAAI,CAAC,EAAE;YACL,SAAS,CAAC,EAAE,MAAM,CAAA;YAClB,GAAG,CAAC,EAAE,MAAM,CAAA;SACb,CAAA;QACD,SAAS,CAAC,EAAE;YACV,GAAG,CAAC,EAAE,OAAO,CAAA;SACd,CAAA;QACD,QAAQ,CAAC,EAAE;YACT,GAAG,CAAC,EAAE,MAAM,CAAA;SACb,CAAA;QACD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB,CAAA;CACF"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,13 @@
1
- import type { DataWrapper, PaginatedResponse } from '../../types';
2
- import type { ResourceAccessReason } from '../AppService/types/resourceEntitlements';
3
- import type { LabelFilterParams } from '../LabelService';
1
+ import type { DataWrapper } from '../../types';
4
2
  import type { AuthType, HTTPMethod } from './ConfigService';
5
3
  import type { Event } from './EventService';
4
+ import type { TriggerIndexResponse } from './TriggerChaining';
5
+ import type { TriggerDispatchResult } from './TriggerDispatch.types';
6
6
  import type { TriggerExecutionHistoryDetail } from './TriggerHistoryService';
7
- import type { CreateTriggerSecretBindingBody } from './TriggerSecretService';
7
+ import type { TriggerLastRun } from './TriggerLastRun.types';
8
+ import type { TriggerRequestBody } from './TriggerRequest.types';
9
+ import type { TriggerSearchParams } from './TriggerSearch.types';
10
+ import type { TriggerVersion, TriggerVersionLockedField } from './TriggerVersion.types';
8
11
  import type { AntHttpClient } from "../../AntHttpClient";
9
12
  import type { ResourceLabel } from "../LabelService";
10
13
  export type TriggerableType = 'licenses' | 'projects';
@@ -24,173 +27,178 @@ export interface Trigger {
24
27
  payload: any;
25
28
  secret_token?: string | null;
26
29
  event: Event;
27
- run_before_triggers: Trigger[];
28
- run_after_triggers: Trigger[];
30
+ /**
31
+ * ⚠️ **DIRECTION — the names admit the opposite reading, and it is wrong.**
32
+ *
33
+ * | Field | Means | Order |
34
+ * | --- | --- | --- |
35
+ * | `run_before_triggers` | triggers that run BEFORE this one | the NAMED ones go first |
36
+ * | `run_after_triggers` | triggers that run AFTER this one | the NAMED ones go last |
37
+ * | `triggers_running_before` | the reverse edge: triggers this one runs before | — |
38
+ *
39
+ * So for a trigger H with `run_before_triggers: [A, B]` and
40
+ * `run_after_triggers: [C]`, the execution order is **A, B, H, C**.
41
+ *
42
+ * It is NOT "this trigger runs before those". Confirmed from the dispatch path:
43
+ * `TriggerDispatcherService` dispatches each `before` trigger ABOVE the line that
44
+ * executes the owner, and a failure there records `Execution stopped: BEFORE
45
+ * trigger failed` on the OWNER's execution — only coherent if the named trigger
46
+ * already ran. The `after` loop sits below, and is skipped when the owner did not
47
+ * succeed.
48
+ *
49
+ * **Label rows from the named trigger's perspective, not the owner's** — e.g.
50
+ * "Runs first: {name}" / "Then runs: {name}". A row reading "Runs before {name}"
51
+ * asserts the reverse. This is not a cosmetic slip: chaining is being retired in
52
+ * favour of the Workflows app, so a publisher reads execution order off this list
53
+ * to rebuild it — and a reversed label yields a workflow that runs backwards, with
54
+ * correct counts and nothing erroring.
55
+ *
56
+ * The trigger's chain links, **snake_case — matching the request keys of the same
57
+ * name** and every other field on this resource.
58
+ *
59
+ * ⚠️ **RENAMED (AAD-991).** These were `runBeforeTriggers` / `runAfterTriggers`,
60
+ * and the mismatch cost a live bug: a client reading the name the REQUEST uses got
61
+ * `undefined`, and `?? 0` turned that into a plausible zero, so the chaining
62
+ * banner reported "nothing to migrate" against data that had chains. Nothing
63
+ * errored. The old keys are gone rather than aliased.
64
+ *
65
+ * Optional because they come from `whenLoaded`. Both are loaded on the index and
66
+ * on show; `triggers_running_before` is declared by the API but eager-loaded by no
67
+ * path, so it is absent in practice.
68
+ *
69
+ * ⚠️ **ADDING a link is refused with a 422** — chaining is being retired. See
70
+ * {@link TriggerRequestBody.run_before_triggers}, which carries the request-side
71
+ * rule.
72
+ *
73
+ * For "how much is left to migrate", use `TriggerChainingSummary.count` (on the
74
+ * index response) — not the length of these, which describes one trigger.
75
+ */
76
+ run_before_triggers?: Trigger[];
77
+ run_after_triggers?: Trigger[];
78
+ triggers_running_before?: Trigger[];
29
79
  secret_header: string;
30
80
  debug_mode: boolean;
31
81
  custom_path?: string | null;
32
82
  close_task_after_execution: boolean;
33
83
  labels: ResourceLabel[];
34
84
  /**
35
- * Caller must have a relationship to the triggerable, and payload target ids are
36
- * locked to it (AAD-897). Defaults to false server-side, including for triggers
37
- * created before it existed.
85
+ * Whether declared resource targets are checked against the trigger's own
86
+ * licence/project. New triggers get `true`; rows predating the check are `false`
87
+ * and run in shadow mode (logged, not refused). Dataset actions always enforce.
38
88
  */
39
89
  authorization_enforced: boolean;
40
- /** Rejects any event whose `access_mode` is `write` (AAD-897). */
90
+ /** A read-only trigger refuses any event whose `access_mode` is `write`. */
41
91
  read_only: boolean;
42
92
  /**
43
- * Per-trigger burst limit. Null is not "unlimited" — it means no per-trigger
44
- * override, so the server default (`triggers.rate_limit.per_second`) applies. That
45
- * default currently ships as null, which is what makes null behave as unlimited
46
- * today; raise the default and every null-limit trigger inherits it.
93
+ * Null is NOT "unlimited": it means no per-trigger override, so the server
94
+ * default (`triggers.rate_limit.per_second`) applies. That default ships as null
95
+ * today, which is the only reason null behaves as unlimited.
47
96
  */
48
97
  rate_limit_per_second: number | null;
49
- /** Per-trigger sustained limit. Same null semantics as `rate_limit_per_second`. */
98
+ /** Same null semantics as `rate_limit_per_second`. */
50
99
  rate_limit_per_minute: number | null;
51
100
  /**
52
- * Payload keys the caller cannot override (AAD-970). Applied AFTER the
53
- * `payload < URL params < request body` merge, which is the point — a stored
54
- * payload value is a default the caller can replace, a pinned one is not.
55
- *
56
- * Top-level keys only, and a pin REPLACES rather than deep-merges, whatever the
57
- * value's type.
101
+ * Payload keys a caller cannot override (AAD-970). Applied AFTER the
102
+ * `payload < URL params < body` merge: a stored value is a default, a pinned one
103
+ * is final. Top-level keys only; a pin replaces, never deep-merges.
58
104
  */
59
105
  payload_pins: Record<string, any> | null;
60
- /** Resolved from the event class, not stored. Tells you whether `read_only` is even an option. */
61
- access_mode: 'read' | 'write' | null;
62
- }
63
- export interface TriggerBase extends Pick<Trigger, 'id' | 'name' | 'is_active' | 'close_task_after_execution'> {
64
- event: Pick<Event, 'id' | 'name' | 'code' | 'description'>;
65
- }
66
- export interface TriggerRequestBody {
67
- name?: string;
68
- auth_type?: AuthType;
69
- event_id?: string | null;
70
- payload?: any;
71
- when?: string | null;
72
- http_method?: HTTPMethod | null;
73
- secret_token?: string | null;
74
- run_before_triggers?: string[];
75
- run_after_triggers?: string[];
76
- is_active?: boolean;
77
- debug_mode?: boolean;
78
- custom_path?: string | null;
79
106
  /**
80
- * Optional Vault-secret bindings created atomically with the trigger (create
81
- * only). Each references an existing secret by id plus placement metadata; the
82
- * backend creates the trigger and all bindings in one transaction, so a
83
- * rejected binding (out-of-context / missing `use`) rolls the whole create back.
107
+ * Whether the SELECTED event reads or writes, resolved from the event class — so
108
+ * whether `read_only` is even offerable. `TransformWithScriptEvent` is `write`
109
+ * despite returning data: it runs user code with real credentials.
84
110
  */
85
- secret_bindings?: CreateTriggerSecretBindingBody[];
86
- authorization_enforced?: boolean;
87
- read_only?: boolean;
88
- /** Null clears any per-trigger override, handing the field back to the server default. */
89
- rate_limit_per_second?: number | null;
90
- /** Null clears any per-trigger override, handing the field back to the server default. */
91
- rate_limit_per_minute?: number | null;
92
- /** See `Trigger.payload_pins`. Null or `{}` clears every pin. */
93
- payload_pins?: Record<string, any> | null;
94
- }
95
- export interface TriggerExecutionResult {
96
- trigger: {
97
- id: string;
98
- name: string;
99
- event: Event;
100
- };
101
- data: any;
102
- error: string | null;
103
- status: 'error' | 'success';
104
- }
105
- /**
106
- * Search parameters for triggers
107
- */
108
- export interface TriggerSearchParams {
109
- search?: string;
110
- page?: number;
111
- per_page?: number;
112
- filters?: LabelFilterParams & {
113
- name?: {
114
- $contains?: string;
115
- $eq?: string;
116
- };
117
- when?: {
118
- $contains?: string;
119
- $eq?: string;
120
- };
121
- is_active?: {
122
- $eq?: boolean;
123
- };
124
- event_id?: {
125
- $eq?: string;
126
- };
127
- [key: string]: any;
128
- };
129
- }
130
- /**
131
- * The actionable response a dispatch returns when a bound per-user
132
- * (`oauth2_authorization_code`) secret has no token yet for the signed-in user.
133
- * The OS host opens `authorize_url` in a consent popup and re-dispatches. This is
134
- * NOT an error — the backend returns it with HTTP 200.
135
- */
136
- export interface AuthorizationRequiredResult {
137
- authorization_required: true;
138
- authorize_url: string;
139
- secret_id: string;
111
+ access_mode: TriggerAccessMode;
112
+ user_id: string | null;
113
+ /** Which version the bare dispatch URL follows. Null when there are none. */
114
+ default_version_id: string | null;
115
+ /**
116
+ * ⚠️ **TRI-STATE. `null` is a real answer, not a missing one.**
117
+ *
118
+ * | Value | Means |
119
+ * | ------- | -------------------------------------------------------- |
120
+ * | `null` | no version has ever been released — nothing was compared |
121
+ * | `false` | released, and the draft still matches it |
122
+ * | `true` | released, and the draft has moved since |
123
+ *
124
+ * **`?? false` and `!!value` are both WRONG here.** Each collapses `null` into
125
+ * `false`, which shows a publisher a reassuring "in sync" badge for a trigger
126
+ * nothing ever compared. That is a real bug this project has shipped once
127
+ * already. Read it with `===`, or use {@link triggerDivergence}, which returns a
128
+ * named state and cannot be coerced by accident. Present on index rows too.
129
+ *
130
+ * `unreleased_changed_fields` lists only the fields a version FREEZES, so a
131
+ * rename deliberately never appears — see TriggerVersionLockedField. It is `[]`
132
+ * when in sync and `null` when nothing was compared, mirroring the flag.
133
+ */
134
+ has_unreleased_changes: boolean | null;
135
+ unreleased_changed_fields: TriggerVersionLockedField[] | null;
136
+ /**
137
+ * How many dispatch URLs actually call this trigger.
138
+ *
139
+ * ⚠️ **Not `1 + versions.length`, and computing it yourself gets a custom path
140
+ * wrong.** The rule:
141
+ *
142
+ * | Trigger | Count |
143
+ * | --- | --- |
144
+ * | driven by `when` (a system event) | `0` — nothing calls it over HTTP |
145
+ * | has a `custom_path` | `1`, however many versions exist |
146
+ * | otherwise | the bare URL plus one per CALLABLE version |
147
+ *
148
+ * A custom path REPLACES the bare URL and has no version-qualified form — the
149
+ * route pattern would swallow the version segment — so `TriggerVersion.dispatch_url`
150
+ * is `''` for every version of such a trigger. Counting versions there would list
151
+ * URLs that 404.
152
+ *
153
+ * Retiring a version reduces this: retired is not callable, so it is not a URL
154
+ * anyone can reach.
155
+ *
156
+ * Server-side so a rail rendering on every screen does not have to fetch each
157
+ * trigger's versions to count them.
158
+ */
159
+ callable_url_count: number;
160
+ /**
161
+ * When this trigger last FAILED — `null` when it never has.
162
+ *
163
+ * ⚠️ **DETAIL RESPONSES ONLY. Absent from index rows**, not null there — the
164
+ * backend loads the aggregate on show/create/update and on nothing else, so a
165
+ * list does not pay a query per row for a line it does not show. Distinguish
166
+ * `undefined` (not asked) from `null` (asked, and there has never been a
167
+ * failure).
168
+ *
169
+ * ⚠️ **This is not a "clean streak", on purpose.** A streak cannot be read back
170
+ * honestly: a trigger that has not run for four days is also "clean for four
171
+ * days", and so is one that has never run at all — so a streak field invites the
172
+ * never-run case to render as a four-day success. Derive the sentence you want
173
+ * from this timestamp and from `last_run`, which tells you whether it has run at
174
+ * all.
175
+ *
176
+ * Counts `error` only, matching the failed-runs badge: `authorization_required`
177
+ * is waiting on a person and `pending` has not finished.
178
+ */
179
+ last_failure_at?: string | null;
180
+ /**
181
+ * The most recent execution, or `null` when the trigger has NEVER RUN.
182
+ *
183
+ * ⚠️ Never-run is not a failed run, and never-run is not "ran clean" — see
184
+ * {@link TriggerLastRun} before defaulting anything from it.
185
+ */
186
+ last_run: TriggerLastRun | null;
187
+ /**
188
+ * The version the bare dispatch URL follows, nested for convenience.
189
+ *
190
+ * Unlike before, this DOES now carry `dispatch_url` and `is_default` — both are
191
+ * unconditional on a version, including a nested one.
192
+ */
193
+ default_version?: TriggerVersion | null;
140
194
  }
141
- /**
142
- * A trigger that consumes a purchased store resource was refused (AAD-940).
143
- *
144
- * ⚠️ This arrives as a NON-2xx response, so it surfaces as a rejected request —
145
- * read it off the error body, not the resolved value. It is wrapped in the
146
- * dispatch envelope: `error.response.data.response`.
147
- *
148
- * **Branch on `reason`, never on the HTTP status** — several reasons share 403.
149
- * `reason` is a {@link ResourceAccessReason} (`not_entitled`,
150
- * `entitlement_revoked`, `subscription_expired`, `version_withdrawn`, …) or one
151
- * of the trigger-side reasons below, which describe the trigger's own
152
- * configuration rather than the licence's entitlement:
153
- *
154
- * | reason | status | what it means |
155
- * | --- | --- | --- |
156
- * | `resource_not_configured` | 422 | the trigger names no resource — send the user to edit it |
157
- * | `resource_not_found` | 404 | the configured listing is gone |
158
- * | `no_license_context` | 409 | the trigger resolves to no owning licence |
159
- * | `store_resources_disabled` | 404 | the resource surface is off for this deployment |
160
- *
161
- * ⚠️ **Never render this as an empty result.** "Not entitled" and "this dataset
162
- * has no rows" look identical to a user and call for opposite actions, which is
163
- * exactly why the refusal is a populated body rather than an empty one.
164
- */
165
- export interface ResourceAccessDeniedResult {
166
- resource_access_denied: true;
167
- reason: ResourceAccessReason | TriggerResourceReason;
168
- message: string;
169
- /** The status the response carried. Informational — branch on `reason`. */
170
- status_code: number;
195
+ /** Whether an event reads or writes. Resolved from the event class, not stored. */
196
+ export type TriggerAccessMode = 'read' | 'write';
197
+ export interface TriggerBase extends Pick<Trigger, 'id' | 'name' | 'is_active' | 'close_task_after_execution'> {
198
+ event: Pick<Event, 'id' | 'name' | 'code' | 'description'>;
171
199
  }
172
- /** Refusals that are about the trigger's configuration, not the entitlement. */
173
- export type TriggerResourceReason = 'resource_not_configured' | 'resource_not_found' | 'no_license_context' | 'store_resources_disabled';
174
- /**
175
- * A dispatch returns either the trigger's own response payload or, for an
176
- * unconsented per-user OAuth2 binding, an {@link AuthorizationRequiredResult}.
177
- * Narrow with {@link isAuthorizationRequired}.
178
- *
179
- * A refused resource-consuming trigger does NOT appear here — it is a non-2xx
180
- * response; see {@link ResourceAccessDeniedResult}.
181
- */
182
- export type TriggerDispatchResult = AuthorizationRequiredResult | unknown;
183
- /** Type guard: is this dispatch result the "user must authorize" envelope? */
184
- export declare function isAuthorizationRequired(result: unknown): result is AuthorizationRequiredResult;
185
- /**
186
- * Type guard: is this a refused resource-consuming dispatch?
187
- *
188
- * Accepts either the dispatch envelope or the inner body, so it can be pointed
189
- * straight at `error.response?.data` without unwrapping first.
190
- */
191
- export declare function isResourceAccessDenied(result: unknown): result is ResourceAccessDeniedResult;
192
200
  export interface TriggerService {
193
- fetchTriggers: (triggerableType: TriggerableType, triggerableId: string, params?: TriggerSearchParams) => Promise<PaginatedResponse<Trigger>>;
201
+ fetchTriggers: (triggerableType: TriggerableType, triggerableId: string, params?: TriggerSearchParams) => Promise<TriggerIndexResponse>;
194
202
  createTrigger: (triggerableType: TriggerableType, triggerableId: string, data: TriggerRequestBody) => Promise<DataWrapper<Trigger>>;
195
203
  fetchTrigger: (triggerableType: TriggerableType, triggerableId: string, triggerId: string) => Promise<DataWrapper<Trigger>>;
196
204
  updateTrigger: (triggerableType: TriggerableType, triggerableId: string, triggerId: string, data: TriggerRequestBody) => Promise<DataWrapper<Trigger>>;