@antcde/connect-ts 0.4.27 → 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 (86) 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/TaskServiceQueries.d.ts +9 -1
  29. package/build/services/TaskServiceQueries.d.ts.map +1 -1
  30. package/build/services/TaskServiceQueries.js +12 -1
  31. package/build/services/Webhook/ConfigService.d.ts +31 -1
  32. package/build/services/Webhook/ConfigService.d.ts.map +1 -1
  33. package/build/services/Webhook/ConfigService.js +1 -1
  34. package/build/services/Webhook/EventService.d.ts +117 -0
  35. package/build/services/Webhook/EventService.d.ts.map +1 -1
  36. package/build/services/Webhook/TriggerChaining.d.ts +45 -0
  37. package/build/services/Webhook/TriggerChaining.d.ts.map +1 -0
  38. package/build/services/Webhook/TriggerChaining.js +1 -0
  39. package/build/services/Webhook/TriggerDataset.types.d.ts +160 -0
  40. package/build/services/Webhook/TriggerDataset.types.d.ts.map +1 -0
  41. package/build/services/Webhook/TriggerDataset.types.js +74 -0
  42. package/build/services/Webhook/TriggerDatasetColumns.d.ts +72 -0
  43. package/build/services/Webhook/TriggerDatasetColumns.d.ts.map +1 -0
  44. package/build/services/Webhook/TriggerDatasetColumns.js +116 -0
  45. package/build/services/Webhook/TriggerDatasetResponses.types.d.ts +158 -0
  46. package/build/services/Webhook/TriggerDatasetResponses.types.d.ts.map +1 -0
  47. package/build/services/Webhook/TriggerDatasetResponses.types.js +98 -0
  48. package/build/services/Webhook/TriggerDatasetSourceService.d.ts +180 -0
  49. package/build/services/Webhook/TriggerDatasetSourceService.d.ts.map +1 -0
  50. package/build/services/Webhook/TriggerDatasetSourceService.js +23 -0
  51. package/build/services/Webhook/TriggerDispatch.types.d.ts +89 -0
  52. package/build/services/Webhook/TriggerDispatch.types.d.ts.map +1 -0
  53. package/build/services/Webhook/TriggerDispatch.types.js +24 -0
  54. package/build/services/Webhook/TriggerDivergence.d.ts +30 -0
  55. package/build/services/Webhook/TriggerDivergence.d.ts.map +1 -0
  56. package/build/services/Webhook/TriggerDivergence.js +25 -0
  57. package/build/services/Webhook/TriggerFailedRuns.types.d.ts +57 -0
  58. package/build/services/Webhook/TriggerFailedRuns.types.d.ts.map +1 -0
  59. package/build/services/Webhook/TriggerFailedRuns.types.js +1 -0
  60. package/build/services/Webhook/TriggerHistoryService.d.ts +88 -18
  61. package/build/services/Webhook/TriggerHistoryService.d.ts.map +1 -1
  62. package/build/services/Webhook/TriggerLastRun.types.d.ts +80 -0
  63. package/build/services/Webhook/TriggerLastRun.types.d.ts.map +1 -0
  64. package/build/services/Webhook/TriggerLastRun.types.js +1 -0
  65. package/build/services/Webhook/TriggerRefusalDetail.types.d.ts +63 -0
  66. package/build/services/Webhook/TriggerRefusalDetail.types.d.ts.map +1 -0
  67. package/build/services/Webhook/TriggerRefusalDetail.types.js +12 -0
  68. package/build/services/Webhook/TriggerRequest.types.d.ts +77 -0
  69. package/build/services/Webhook/TriggerRequest.types.d.ts.map +1 -0
  70. package/build/services/Webhook/TriggerRequest.types.js +1 -0
  71. package/build/services/Webhook/TriggerSearch.types.d.ts +42 -0
  72. package/build/services/Webhook/TriggerSearch.types.d.ts.map +1 -0
  73. package/build/services/Webhook/TriggerSearch.types.js +1 -0
  74. package/build/services/Webhook/TriggerService.d.ts +158 -150
  75. package/build/services/Webhook/TriggerService.d.ts.map +1 -1
  76. package/build/services/Webhook/TriggerService.js +0 -24
  77. package/build/services/Webhook/TriggerTimeline.types.d.ts +42 -0
  78. package/build/services/Webhook/TriggerTimeline.types.d.ts.map +1 -0
  79. package/build/services/Webhook/TriggerTimeline.types.js +1 -0
  80. package/build/services/Webhook/TriggerVersion.types.d.ts +107 -0
  81. package/build/services/Webhook/TriggerVersion.types.d.ts.map +1 -0
  82. package/build/services/Webhook/TriggerVersion.types.js +1 -0
  83. package/build/services/Webhook/TriggerVersionService.d.ts +64 -0
  84. package/build/services/Webhook/TriggerVersionService.d.ts.map +1 -0
  85. package/build/services/Webhook/TriggerVersionService.js +21 -0
  86. package/package.json +8 -7
@@ -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>>;
@@ -1 +1 @@
1
- {"version":3,"file":"TriggerService.d.ts","sourceRoot":"","sources":["../../../src/services/Webhook/TriggerService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAA;AACpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,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AAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3H,aAAa,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,KAAK,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IACtJ,aAAa,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5H,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,6BAA6B,CAAC,CAAA;IAG1E,QAAQ,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;CACzJ;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,aAAa,GAAG,cAAc,CAuB9E"}
@@ -1,27 +1,3 @@
1
- /** Type guard: is this dispatch result the "user must authorize" envelope? */
2
- export function isAuthorizationRequired(result) {
3
- if (typeof result !== 'object' || result === null)
4
- return false;
5
- const record = result;
6
- return record.authorization_required === true
7
- && typeof record.authorize_url === 'string'
8
- && typeof record.secret_id === 'string';
9
- }
10
- /**
11
- * Type guard: is this a refused resource-consuming dispatch?
12
- *
13
- * Accepts either the dispatch envelope or the inner body, so it can be pointed
14
- * straight at `error.response?.data` without unwrapping first.
15
- */
16
- export function isResourceAccessDenied(result) {
17
- if (typeof result !== 'object' || result === null)
18
- return false;
19
- const envelope = result;
20
- const body = (typeof envelope.response === 'object' && envelope.response !== null)
21
- ? envelope.response
22
- : envelope;
23
- return body.resource_access_denied === true && typeof body.reason === 'string';
24
- }
25
1
  export function createTriggerService(httpClient) {
26
2
  return {
27
3
  fetchTriggers: (triggerableType, triggerableId, params) => httpClient.get(`/webhook/${triggerableType}/${triggerableId}/triggers`, { params }),
@@ -0,0 +1,42 @@
1
+ import type { ExecutionStatus } from './TriggerHistoryService';
2
+ /**
3
+ * One step of an execution's timeline.
4
+ *
5
+ * Split out of `TriggerHistoryService.ts`, which is at its size limit. Re-exported
6
+ * from the package root, so no consumer import path changes.
7
+ */
8
+ export interface ExecutionTimelineItem {
9
+ id: string;
10
+ trigger_id: string;
11
+ trigger_name: string;
12
+ event_id: string | null;
13
+ event_name: string | null;
14
+ executed_at: string;
15
+ execution_duration_ms: number | null;
16
+ status: ExecutionStatus;
17
+ error_message: string | null;
18
+ response: any;
19
+ is_main_trigger: boolean;
20
+ execution_order: number;
21
+ /**
22
+ * ⚠️ **Do NOT read this as "was this run asynchronous". It is not.**
23
+ *
24
+ * It is derived from the presence of an `async` key in the stored payload, and
25
+ * only `RunScriptEvent` ever sets one — so **every other action reports
26
+ * `is_async: true` even though it ran inline**: all three dataset actions, the
27
+ * HTTP request, the email, the table action. `TransformWithScriptEvent` is
28
+ * documented as always synchronous and still reports true.
29
+ *
30
+ * It is also **load-bearing on the dispatch contract**, not merely a label: the
31
+ * dispatcher uses this same value to choose the response SHAPE. `true` yields the
32
+ * `{ response, error }` envelope every dataset action returns; `false` yields raw
33
+ * output. So it cannot simply be made truthful — doing so drops the envelope from
34
+ * every non-script dispatch. Correcting it means separating the two jobs first,
35
+ * which is tracked as AAD-976.
36
+ *
37
+ * Until then: to know whether an action runs inline, read the EVENT
38
+ * (`Event.code`), not this field.
39
+ */
40
+ is_async: boolean;
41
+ }
42
+ //# sourceMappingURL=TriggerTimeline.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TriggerTimeline.types.d.ts","sourceRoot":"","sources":["../../../src/services/Webhook/TriggerTimeline.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAE9D;;;;;GAKG;AAEH,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,qBAAqB,EAAE,MAAM,GAAG,IAAI,CAAA;IACpC,MAAM,EAAE,eAAe,CAAA;IACvB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,QAAQ,EAAE,GAAG,CAAA;IACb,eAAe,EAAE,OAAO,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;IAEvB;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,EAAE,OAAO,CAAA;CAClB"}
@@ -0,0 +1 @@
1
+ export {};