@garuhq/node 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/index.cjs +45 -2
- package/dist/index.d.cts +46 -2
- package/dist/index.d.ts +46 -2
- package/dist/index.js +45 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,34 @@
|
|
|
3
3
|
All notable changes to `@garuhq/node` are documented in this file. Format:
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versioning: [SemVer](https://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [0.12.0] — 2026-05-19
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- `webhookEvents.resend(id)` — `POST /api/webhook-events/{id}/resend`,
|
|
11
|
+
the audit-trail-preserving counterpart to `retry()`. The backend
|
|
12
|
+
inserts a *clone* event (new numeric id) that points back at the
|
|
13
|
+
source via `manualResendOf`, then dispatches that clone. The
|
|
14
|
+
original row is untouched, so the historical record of the prior
|
|
15
|
+
failure (status, response status/body, attempts) survives. Works on
|
|
16
|
+
any source status (`success` / `failed` / `pending`).
|
|
17
|
+
- Outbound delivery uses `Idempotency-Key: resend_<originalId>`, so
|
|
18
|
+
recipient handlers can distinguish a resend from a fresh delivery
|
|
19
|
+
both by the header prefix and by reading the response payload's
|
|
20
|
+
`manualResendOf` field.
|
|
21
|
+
- `WebhookEvent.manualResendOf: number | null` — populated with the
|
|
22
|
+
source event's numeric id on rows produced by `resend()`, `null`
|
|
23
|
+
everywhere else (originally-fired events and legacy `retry()`
|
|
24
|
+
outputs).
|
|
25
|
+
|
|
26
|
+
### Deprecated
|
|
27
|
+
|
|
28
|
+
- `webhookEvents.retry(id)` is soft-deprecated. It still works and is
|
|
29
|
+
not scheduled for removal — older CLI / MCP releases depend on it —
|
|
30
|
+
but new integrations should prefer `resend()`, which preserves the
|
|
31
|
+
original event's audit trail by cloning instead of mutating the row
|
|
32
|
+
in place.
|
|
33
|
+
|
|
6
34
|
## [0.11.1] — 2026-05-19
|
|
7
35
|
|
|
8
36
|
### Fixed
|
package/dist/index.cjs
CHANGED
|
@@ -898,10 +898,16 @@ var WebhookEvents = class {
|
|
|
898
898
|
);
|
|
899
899
|
}
|
|
900
900
|
/**
|
|
901
|
+
* @deprecated For most cases prefer {@link resend}, which preserves the
|
|
902
|
+
* original event's audit trail by cloning rather than mutating. `retry()`
|
|
903
|
+
* resets the original row in place — once it succeeds, the historical
|
|
904
|
+
* record of the prior failure is gone. Kept here for callers that
|
|
905
|
+
* explicitly want the legacy in-place semantics (and for backwards
|
|
906
|
+
* compatibility with older CLI / MCP releases).
|
|
907
|
+
*
|
|
901
908
|
* Re-deliver a webhook event by ID. Resets it to `pending`, clears the
|
|
902
909
|
* retry schedule, and triggers an immediate delivery attempt. Works on
|
|
903
|
-
* any status (`success`, `failed`, `pending`)
|
|
904
|
-
* customer reports a missed or unprocessed event.
|
|
910
|
+
* any status (`success`, `failed`, `pending`).
|
|
905
911
|
*
|
|
906
912
|
* @example
|
|
907
913
|
* const failed = await garu.webhookEvents.list({ status: 'failed', limit: 5 });
|
|
@@ -917,6 +923,43 @@ var WebhookEvents = class {
|
|
|
917
923
|
}).then((r) => r)
|
|
918
924
|
);
|
|
919
925
|
}
|
|
926
|
+
/**
|
|
927
|
+
* Re-deliver a webhook event by ID, audit-trail preserving. Unlike
|
|
928
|
+
* {@link retry}, this does *not* mutate the original row — it inserts a
|
|
929
|
+
* fresh event (new numeric id) that points back at the source via
|
|
930
|
+
* `manualResendOf`, then dispatches that clone. The original row is
|
|
931
|
+
* untouched, so the historical record of the prior failure (and its
|
|
932
|
+
* response status / body) is preserved.
|
|
933
|
+
*
|
|
934
|
+
* Works on any source status (`success`, `failed`, `pending`). Use this
|
|
935
|
+
* when a customer reports a missed or unprocessed event, or to replay an
|
|
936
|
+
* event during a backfill — both reasons where you want the original
|
|
937
|
+
* delivery's outcome to remain on the record.
|
|
938
|
+
*
|
|
939
|
+
* **Outbound delivery semantics**: the gateway POSTs the clone with
|
|
940
|
+
* `Idempotency-Key: resend_<originalId>` (where `<originalId>` is the id
|
|
941
|
+
* of the source event, not the clone). Recipient handlers that key off
|
|
942
|
+
* `Idempotency-Key` will see this as a distinct delivery from the
|
|
943
|
+
* original — distinguishable both by the `resend_` prefix and by reading
|
|
944
|
+
* the response payload's `manualResendOf` field.
|
|
945
|
+
*
|
|
946
|
+
* Returns the *clone* event (new id), not the original. The original is
|
|
947
|
+
* unchanged on the server.
|
|
948
|
+
*
|
|
949
|
+
* @example
|
|
950
|
+
* const event = await garu.webhookEvents.get(42);
|
|
951
|
+
* const clone = await garu.webhookEvents.resend(42);
|
|
952
|
+
* clone.id !== event.id; // true — clone has its own id
|
|
953
|
+
* clone.manualResendOf === event.id; // true — points back at the source
|
|
954
|
+
*/
|
|
955
|
+
async resend(id) {
|
|
956
|
+
return this.http.call(
|
|
957
|
+
(signal) => this.http.client.POST(`/api/webhook-events/${id}/resend`, {
|
|
958
|
+
body: {},
|
|
959
|
+
signal
|
|
960
|
+
}).then((r) => r)
|
|
961
|
+
);
|
|
962
|
+
}
|
|
920
963
|
};
|
|
921
964
|
var webhooks = {
|
|
922
965
|
verify(params) {
|
package/dist/index.d.cts
CHANGED
|
@@ -596,6 +596,14 @@ interface WebhookEvent {
|
|
|
596
596
|
responseStatus: number | null;
|
|
597
597
|
/** Response body from the most recent attempt, truncated by the gateway. */
|
|
598
598
|
responseBody: string | null;
|
|
599
|
+
/**
|
|
600
|
+
* When this row is a clone produced by `webhookEvents.resend(id)`, this is
|
|
601
|
+
* the numeric id of the original event the clone was forked from. `null`
|
|
602
|
+
* on every originally-fired event (and on events resurrected via the
|
|
603
|
+
* legacy `webhookEvents.retry(id)` mutation, which mutates in place
|
|
604
|
+
* instead of cloning).
|
|
605
|
+
*/
|
|
606
|
+
manualResendOf: number | null;
|
|
599
607
|
createdAt: string;
|
|
600
608
|
[key: string]: unknown;
|
|
601
609
|
}
|
|
@@ -1117,10 +1125,16 @@ declare class WebhookEvents {
|
|
|
1117
1125
|
*/
|
|
1118
1126
|
get(id: number): Promise<WebhookEvent>;
|
|
1119
1127
|
/**
|
|
1128
|
+
* @deprecated For most cases prefer {@link resend}, which preserves the
|
|
1129
|
+
* original event's audit trail by cloning rather than mutating. `retry()`
|
|
1130
|
+
* resets the original row in place — once it succeeds, the historical
|
|
1131
|
+
* record of the prior failure is gone. Kept here for callers that
|
|
1132
|
+
* explicitly want the legacy in-place semantics (and for backwards
|
|
1133
|
+
* compatibility with older CLI / MCP releases).
|
|
1134
|
+
*
|
|
1120
1135
|
* Re-deliver a webhook event by ID. Resets it to `pending`, clears the
|
|
1121
1136
|
* retry schedule, and triggers an immediate delivery attempt. Works on
|
|
1122
|
-
* any status (`success`, `failed`, `pending`)
|
|
1123
|
-
* customer reports a missed or unprocessed event.
|
|
1137
|
+
* any status (`success`, `failed`, `pending`).
|
|
1124
1138
|
*
|
|
1125
1139
|
* @example
|
|
1126
1140
|
* const failed = await garu.webhookEvents.list({ status: 'failed', limit: 5 });
|
|
@@ -1129,6 +1143,36 @@ declare class WebhookEvents {
|
|
|
1129
1143
|
* }
|
|
1130
1144
|
*/
|
|
1131
1145
|
retry(id: number): Promise<WebhookEvent>;
|
|
1146
|
+
/**
|
|
1147
|
+
* Re-deliver a webhook event by ID, audit-trail preserving. Unlike
|
|
1148
|
+
* {@link retry}, this does *not* mutate the original row — it inserts a
|
|
1149
|
+
* fresh event (new numeric id) that points back at the source via
|
|
1150
|
+
* `manualResendOf`, then dispatches that clone. The original row is
|
|
1151
|
+
* untouched, so the historical record of the prior failure (and its
|
|
1152
|
+
* response status / body) is preserved.
|
|
1153
|
+
*
|
|
1154
|
+
* Works on any source status (`success`, `failed`, `pending`). Use this
|
|
1155
|
+
* when a customer reports a missed or unprocessed event, or to replay an
|
|
1156
|
+
* event during a backfill — both reasons where you want the original
|
|
1157
|
+
* delivery's outcome to remain on the record.
|
|
1158
|
+
*
|
|
1159
|
+
* **Outbound delivery semantics**: the gateway POSTs the clone with
|
|
1160
|
+
* `Idempotency-Key: resend_<originalId>` (where `<originalId>` is the id
|
|
1161
|
+
* of the source event, not the clone). Recipient handlers that key off
|
|
1162
|
+
* `Idempotency-Key` will see this as a distinct delivery from the
|
|
1163
|
+
* original — distinguishable both by the `resend_` prefix and by reading
|
|
1164
|
+
* the response payload's `manualResendOf` field.
|
|
1165
|
+
*
|
|
1166
|
+
* Returns the *clone* event (new id), not the original. The original is
|
|
1167
|
+
* unchanged on the server.
|
|
1168
|
+
*
|
|
1169
|
+
* @example
|
|
1170
|
+
* const event = await garu.webhookEvents.get(42);
|
|
1171
|
+
* const clone = await garu.webhookEvents.resend(42);
|
|
1172
|
+
* clone.id !== event.id; // true — clone has its own id
|
|
1173
|
+
* clone.manualResendOf === event.id; // true — points back at the source
|
|
1174
|
+
*/
|
|
1175
|
+
resend(id: number): Promise<WebhookEvent>;
|
|
1132
1176
|
}
|
|
1133
1177
|
|
|
1134
1178
|
interface GaruOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -596,6 +596,14 @@ interface WebhookEvent {
|
|
|
596
596
|
responseStatus: number | null;
|
|
597
597
|
/** Response body from the most recent attempt, truncated by the gateway. */
|
|
598
598
|
responseBody: string | null;
|
|
599
|
+
/**
|
|
600
|
+
* When this row is a clone produced by `webhookEvents.resend(id)`, this is
|
|
601
|
+
* the numeric id of the original event the clone was forked from. `null`
|
|
602
|
+
* on every originally-fired event (and on events resurrected via the
|
|
603
|
+
* legacy `webhookEvents.retry(id)` mutation, which mutates in place
|
|
604
|
+
* instead of cloning).
|
|
605
|
+
*/
|
|
606
|
+
manualResendOf: number | null;
|
|
599
607
|
createdAt: string;
|
|
600
608
|
[key: string]: unknown;
|
|
601
609
|
}
|
|
@@ -1117,10 +1125,16 @@ declare class WebhookEvents {
|
|
|
1117
1125
|
*/
|
|
1118
1126
|
get(id: number): Promise<WebhookEvent>;
|
|
1119
1127
|
/**
|
|
1128
|
+
* @deprecated For most cases prefer {@link resend}, which preserves the
|
|
1129
|
+
* original event's audit trail by cloning rather than mutating. `retry()`
|
|
1130
|
+
* resets the original row in place — once it succeeds, the historical
|
|
1131
|
+
* record of the prior failure is gone. Kept here for callers that
|
|
1132
|
+
* explicitly want the legacy in-place semantics (and for backwards
|
|
1133
|
+
* compatibility with older CLI / MCP releases).
|
|
1134
|
+
*
|
|
1120
1135
|
* Re-deliver a webhook event by ID. Resets it to `pending`, clears the
|
|
1121
1136
|
* retry schedule, and triggers an immediate delivery attempt. Works on
|
|
1122
|
-
* any status (`success`, `failed`, `pending`)
|
|
1123
|
-
* customer reports a missed or unprocessed event.
|
|
1137
|
+
* any status (`success`, `failed`, `pending`).
|
|
1124
1138
|
*
|
|
1125
1139
|
* @example
|
|
1126
1140
|
* const failed = await garu.webhookEvents.list({ status: 'failed', limit: 5 });
|
|
@@ -1129,6 +1143,36 @@ declare class WebhookEvents {
|
|
|
1129
1143
|
* }
|
|
1130
1144
|
*/
|
|
1131
1145
|
retry(id: number): Promise<WebhookEvent>;
|
|
1146
|
+
/**
|
|
1147
|
+
* Re-deliver a webhook event by ID, audit-trail preserving. Unlike
|
|
1148
|
+
* {@link retry}, this does *not* mutate the original row — it inserts a
|
|
1149
|
+
* fresh event (new numeric id) that points back at the source via
|
|
1150
|
+
* `manualResendOf`, then dispatches that clone. The original row is
|
|
1151
|
+
* untouched, so the historical record of the prior failure (and its
|
|
1152
|
+
* response status / body) is preserved.
|
|
1153
|
+
*
|
|
1154
|
+
* Works on any source status (`success`, `failed`, `pending`). Use this
|
|
1155
|
+
* when a customer reports a missed or unprocessed event, or to replay an
|
|
1156
|
+
* event during a backfill — both reasons where you want the original
|
|
1157
|
+
* delivery's outcome to remain on the record.
|
|
1158
|
+
*
|
|
1159
|
+
* **Outbound delivery semantics**: the gateway POSTs the clone with
|
|
1160
|
+
* `Idempotency-Key: resend_<originalId>` (where `<originalId>` is the id
|
|
1161
|
+
* of the source event, not the clone). Recipient handlers that key off
|
|
1162
|
+
* `Idempotency-Key` will see this as a distinct delivery from the
|
|
1163
|
+
* original — distinguishable both by the `resend_` prefix and by reading
|
|
1164
|
+
* the response payload's `manualResendOf` field.
|
|
1165
|
+
*
|
|
1166
|
+
* Returns the *clone* event (new id), not the original. The original is
|
|
1167
|
+
* unchanged on the server.
|
|
1168
|
+
*
|
|
1169
|
+
* @example
|
|
1170
|
+
* const event = await garu.webhookEvents.get(42);
|
|
1171
|
+
* const clone = await garu.webhookEvents.resend(42);
|
|
1172
|
+
* clone.id !== event.id; // true — clone has its own id
|
|
1173
|
+
* clone.manualResendOf === event.id; // true — points back at the source
|
|
1174
|
+
*/
|
|
1175
|
+
resend(id: number): Promise<WebhookEvent>;
|
|
1132
1176
|
}
|
|
1133
1177
|
|
|
1134
1178
|
interface GaruOptions {
|
package/dist/index.js
CHANGED
|
@@ -892,10 +892,16 @@ var WebhookEvents = class {
|
|
|
892
892
|
);
|
|
893
893
|
}
|
|
894
894
|
/**
|
|
895
|
+
* @deprecated For most cases prefer {@link resend}, which preserves the
|
|
896
|
+
* original event's audit trail by cloning rather than mutating. `retry()`
|
|
897
|
+
* resets the original row in place — once it succeeds, the historical
|
|
898
|
+
* record of the prior failure is gone. Kept here for callers that
|
|
899
|
+
* explicitly want the legacy in-place semantics (and for backwards
|
|
900
|
+
* compatibility with older CLI / MCP releases).
|
|
901
|
+
*
|
|
895
902
|
* Re-deliver a webhook event by ID. Resets it to `pending`, clears the
|
|
896
903
|
* retry schedule, and triggers an immediate delivery attempt. Works on
|
|
897
|
-
* any status (`success`, `failed`, `pending`)
|
|
898
|
-
* customer reports a missed or unprocessed event.
|
|
904
|
+
* any status (`success`, `failed`, `pending`).
|
|
899
905
|
*
|
|
900
906
|
* @example
|
|
901
907
|
* const failed = await garu.webhookEvents.list({ status: 'failed', limit: 5 });
|
|
@@ -911,6 +917,43 @@ var WebhookEvents = class {
|
|
|
911
917
|
}).then((r) => r)
|
|
912
918
|
);
|
|
913
919
|
}
|
|
920
|
+
/**
|
|
921
|
+
* Re-deliver a webhook event by ID, audit-trail preserving. Unlike
|
|
922
|
+
* {@link retry}, this does *not* mutate the original row — it inserts a
|
|
923
|
+
* fresh event (new numeric id) that points back at the source via
|
|
924
|
+
* `manualResendOf`, then dispatches that clone. The original row is
|
|
925
|
+
* untouched, so the historical record of the prior failure (and its
|
|
926
|
+
* response status / body) is preserved.
|
|
927
|
+
*
|
|
928
|
+
* Works on any source status (`success`, `failed`, `pending`). Use this
|
|
929
|
+
* when a customer reports a missed or unprocessed event, or to replay an
|
|
930
|
+
* event during a backfill — both reasons where you want the original
|
|
931
|
+
* delivery's outcome to remain on the record.
|
|
932
|
+
*
|
|
933
|
+
* **Outbound delivery semantics**: the gateway POSTs the clone with
|
|
934
|
+
* `Idempotency-Key: resend_<originalId>` (where `<originalId>` is the id
|
|
935
|
+
* of the source event, not the clone). Recipient handlers that key off
|
|
936
|
+
* `Idempotency-Key` will see this as a distinct delivery from the
|
|
937
|
+
* original — distinguishable both by the `resend_` prefix and by reading
|
|
938
|
+
* the response payload's `manualResendOf` field.
|
|
939
|
+
*
|
|
940
|
+
* Returns the *clone* event (new id), not the original. The original is
|
|
941
|
+
* unchanged on the server.
|
|
942
|
+
*
|
|
943
|
+
* @example
|
|
944
|
+
* const event = await garu.webhookEvents.get(42);
|
|
945
|
+
* const clone = await garu.webhookEvents.resend(42);
|
|
946
|
+
* clone.id !== event.id; // true — clone has its own id
|
|
947
|
+
* clone.manualResendOf === event.id; // true — points back at the source
|
|
948
|
+
*/
|
|
949
|
+
async resend(id) {
|
|
950
|
+
return this.http.call(
|
|
951
|
+
(signal) => this.http.client.POST(`/api/webhook-events/${id}/resend`, {
|
|
952
|
+
body: {},
|
|
953
|
+
signal
|
|
954
|
+
}).then((r) => r)
|
|
955
|
+
);
|
|
956
|
+
}
|
|
914
957
|
};
|
|
915
958
|
var webhooks = {
|
|
916
959
|
verify(params) {
|