@foxnose/sdk 0.7.0 → 0.8.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/README.md +65 -0
- package/dist/index.cjs +251 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +344 -3
- package/dist/index.d.ts +344 -3
- package/dist/index.js +246 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,6 +15,7 @@ Official TypeScript SDK for the [FoxNose](https://foxnose.net/?utm_source=github
|
|
|
15
15
|
- **Four auth strategies** — Anonymous, JWT, Simple key, and Secure (ECDSA P-256)
|
|
16
16
|
- **Flux introspection** — discover route contracts with `/_router` and `/_schema`
|
|
17
17
|
- **FoxNose Files** — upload links, analysis, review, policy and short-lived downloads
|
|
18
|
+
- **Outbound webhooks** — endpoints, signing secrets, the event log, redelivery and recovery
|
|
18
19
|
- **Zero dependencies** — uses only Node.js built-in modules
|
|
19
20
|
- **Dual output** — ESM and CommonJS builds with full `.d.ts` declarations
|
|
20
21
|
|
|
@@ -423,6 +424,70 @@ const flux = new FluxClient({ baseUrl, apiPrefix: 'support', auth: new Anonymous
|
|
|
423
424
|
const status = await flux.getUploadStatus(path, uploadId, { statusToken });
|
|
424
425
|
```
|
|
425
426
|
|
|
427
|
+
## Webhooks
|
|
428
|
+
|
|
429
|
+
FoxNose sends a signed `POST` to your endpoint when a subscribed event happens. Endpoints and the event log run through the Management client. The calls need the `webhooks` permission: `read` to list and read, `create`, `update` for every action on an endpoint, `delete`.
|
|
430
|
+
|
|
431
|
+
```typescript
|
|
432
|
+
const endpoint = await client.createWebhookEndpoint({
|
|
433
|
+
url: 'https://hooks.example.com/foxnose',
|
|
434
|
+
event_types: ['revision.published', 'resource.deleted'],
|
|
435
|
+
collection_keys: ['mK8nP3tYvBcX'], // omit for every collection
|
|
436
|
+
payload_mode: 'content', // or 'references' (the default)
|
|
437
|
+
});
|
|
438
|
+
storeSecret(endpoint.secret); // also readable later with getWebhookEndpointSecret
|
|
439
|
+
|
|
440
|
+
await client.sendWebhookTestEvent(endpoint.id, 'revision.published');
|
|
441
|
+
|
|
442
|
+
// After an outage: send the failed deliveries of the last day again.
|
|
443
|
+
const since = new Date(Date.now() - 24 * 60 * 60 * 1000);
|
|
444
|
+
let more = true;
|
|
445
|
+
while (more) {
|
|
446
|
+
({ more } = await client.recoverWebhookDeliveries(endpoint.id, since));
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const failed = await client.listWebhookEvents({ endpoint: endpoint.id, status: 'dead' });
|
|
450
|
+
for (const event of failed.results) {
|
|
451
|
+
await client.redeliverWebhookEvent(event.id, { endpoint_id: endpoint.id });
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
| Call | What it does |
|
|
456
|
+
|---|---|
|
|
457
|
+
| `listWebhookEndpoints` / `createWebhookEndpoint` / `getWebhookEndpoint` / `updateWebhookEndpoint` / `deleteWebhookEndpoint` | Endpoints of the environment; a list carries `stats_24h` |
|
|
458
|
+
| `listWebhookEndpointDeliveries` | An endpoint's deliveries, each with the event it carries |
|
|
459
|
+
| `getWebhookEndpointSecret` / `rotateWebhookEndpointSecret` | Read or replace the signing secret |
|
|
460
|
+
| `sendWebhookTestEvent` | A sample event to one endpoint |
|
|
461
|
+
| `recoverWebhookDeliveries` | Send an endpoint's failed deliveries again |
|
|
462
|
+
| `listWebhookEvents` / `getWebhookEvent` / `listWebhookEventAttempts` | The 30-day event log |
|
|
463
|
+
| `redeliverWebhookEvent` | Send a logged event again |
|
|
464
|
+
| `listWebhookEventTypes` | The event-type catalogue with JSON Schemas |
|
|
465
|
+
|
|
466
|
+
`updateWebhookEndpoint` sends only the fields given, and `status: 'active'` resumes a paused or disabled endpoint. `rotateWebhookEndpointSecret` keeps the old secret valid for 24 hours unless you pass `{ expire_previous_now: true }`.
|
|
467
|
+
|
|
468
|
+
The signing `secret` is a credential. The responses that carry it (`createWebhookEndpoint`, `getWebhookEndpointSecret`, `rotateWebhookEndpointSecret`) define it as a non-enumerable property: `console.log`, `JSON.stringify`, `util.inspect` and a spread leave it out, and `response.secret` still returns it. Keep it out of logs.
|
|
469
|
+
|
|
470
|
+
Deliveries follow [Standard Webhooks](https://www.standardwebhooks.com/), so the SDK has no verifier of its own: use a Standard Webhooks library with the endpoint's secret.
|
|
471
|
+
|
|
472
|
+
```typescript
|
|
473
|
+
// npm install standardwebhooks
|
|
474
|
+
import { Webhook } from 'standardwebhooks';
|
|
475
|
+
|
|
476
|
+
const event = new Webhook(secret).verify(rawBody, headers); // throws on a bad signature
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
These errors are subclasses of `FoxnoseAPIError`:
|
|
480
|
+
|
|
481
|
+
| Error | Status / code |
|
|
482
|
+
|---|---|
|
|
483
|
+
| `WebhookEndpointNotFoundError` | 404 `webhook_endpoint_not_found` |
|
|
484
|
+
| `WebhookEventNotFoundError` | 404 `webhook_event_not_found` |
|
|
485
|
+
| `WebhookEndpointLimitExceededError` | 409 `limit_exceeded` (20 endpoints per environment) |
|
|
486
|
+
| `WebhookEndpointNotActiveError` | 409 `endpoint_not_active`, with `reason` and `skipped` |
|
|
487
|
+
| `WebhookEndpointNotSubscribedError` | 409 `endpoint_not_subscribed`, with `skipped` |
|
|
488
|
+
|
|
489
|
+
A rejected request body is a `400` `FoxnoseAPIError`: `errorCode` is the code (`invalid_url`, `unknown_event_type`, `unknown_collection`, ...) and `detail` says what is wrong when there is something to say: `field`, and for example `unknown` or `reason`.
|
|
490
|
+
|
|
426
491
|
## Authentication
|
|
427
492
|
|
|
428
493
|
The SDK supports four authentication strategies:
|
package/dist/index.cjs
CHANGED
|
@@ -47,6 +47,11 @@ __export(index_exports, {
|
|
|
47
47
|
StaticTokenProvider: () => StaticTokenProvider,
|
|
48
48
|
UpstreamError: () => UpstreamError,
|
|
49
49
|
VERSION: () => SDK_VERSION,
|
|
50
|
+
WebhookEndpointLimitExceededError: () => WebhookEndpointLimitExceededError,
|
|
51
|
+
WebhookEndpointNotActiveError: () => WebhookEndpointNotActiveError,
|
|
52
|
+
WebhookEndpointNotFoundError: () => WebhookEndpointNotFoundError,
|
|
53
|
+
WebhookEndpointNotSubscribedError: () => WebhookEndpointNotSubscribedError,
|
|
54
|
+
WebhookEventNotFoundError: () => WebhookEventNotFoundError,
|
|
50
55
|
buildSearchBody: () => buildSearchBody,
|
|
51
56
|
createConfig: () => createConfig,
|
|
52
57
|
nestedFieldMeta: () => nestedFieldMeta,
|
|
@@ -237,6 +242,45 @@ var UpstreamError = class extends FoxnoseAPIError {
|
|
|
237
242
|
this.name = "UpstreamError";
|
|
238
243
|
}
|
|
239
244
|
};
|
|
245
|
+
var WebhookEndpointNotFoundError = class extends FoxnoseAPIError {
|
|
246
|
+
constructor(options) {
|
|
247
|
+
super(options);
|
|
248
|
+
this.name = "WebhookEndpointNotFoundError";
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
var WebhookEventNotFoundError = class extends FoxnoseAPIError {
|
|
252
|
+
constructor(options) {
|
|
253
|
+
super(options);
|
|
254
|
+
this.name = "WebhookEventNotFoundError";
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
var WebhookEndpointLimitExceededError = class extends FoxnoseAPIError {
|
|
258
|
+
constructor(options) {
|
|
259
|
+
super(options);
|
|
260
|
+
this.name = "WebhookEndpointLimitExceededError";
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
var WebhookEndpointNotActiveError = class extends FoxnoseAPIError {
|
|
264
|
+
/** The endpoint's state (`paused`, `disabled` or `deleted`) when the call named it. */
|
|
265
|
+
reason;
|
|
266
|
+
/** Endpoints a redelivery without `endpoint_id` passed over, each with `endpoint_id` and `reason`. */
|
|
267
|
+
skipped;
|
|
268
|
+
constructor(options) {
|
|
269
|
+
super(options);
|
|
270
|
+
this.name = "WebhookEndpointNotActiveError";
|
|
271
|
+
this.reason = options.reason;
|
|
272
|
+
this.skipped = options.skipped ?? [];
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
var WebhookEndpointNotSubscribedError = class extends FoxnoseAPIError {
|
|
276
|
+
/** Endpoints a redelivery without `endpoint_id` passed over, each with `endpoint_id` and `reason`. */
|
|
277
|
+
skipped;
|
|
278
|
+
constructor(options) {
|
|
279
|
+
super(options);
|
|
280
|
+
this.name = "WebhookEndpointNotSubscribedError";
|
|
281
|
+
this.skipped = options.skipped ?? [];
|
|
282
|
+
}
|
|
283
|
+
};
|
|
240
284
|
function isPlainObject(value) {
|
|
241
285
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
242
286
|
}
|
|
@@ -333,6 +377,30 @@ function buildAPIError(options) {
|
|
|
333
377
|
errorsTruncated: d.errors_truncated === true
|
|
334
378
|
});
|
|
335
379
|
}
|
|
380
|
+
if (statusCode === 404 && errorCode === "webhook_endpoint_not_found") {
|
|
381
|
+
return new WebhookEndpointNotFoundError(options);
|
|
382
|
+
}
|
|
383
|
+
if (statusCode === 404 && errorCode === "webhook_event_not_found") {
|
|
384
|
+
return new WebhookEventNotFoundError(options);
|
|
385
|
+
}
|
|
386
|
+
if (statusCode === 409 && errorCode === "limit_exceeded") {
|
|
387
|
+
return new WebhookEndpointLimitExceededError(options);
|
|
388
|
+
}
|
|
389
|
+
if (statusCode === 409 && errorCode === "endpoint_not_active") {
|
|
390
|
+
const d = isPlainObject(detail) ? detail : {};
|
|
391
|
+
return new WebhookEndpointNotActiveError({
|
|
392
|
+
...options,
|
|
393
|
+
reason: typeof d.reason === "string" ? d.reason : void 0,
|
|
394
|
+
skipped: Array.isArray(d.skipped) ? d.skipped : void 0
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
if (statusCode === 409 && errorCode === "endpoint_not_subscribed") {
|
|
398
|
+
const d = isPlainObject(detail) ? detail : {};
|
|
399
|
+
return new WebhookEndpointNotSubscribedError({
|
|
400
|
+
...options,
|
|
401
|
+
skipped: Array.isArray(d.skipped) ? d.skipped : void 0
|
|
402
|
+
});
|
|
403
|
+
}
|
|
336
404
|
if (statusCode === 502 && errorCode === "upstream_error") {
|
|
337
405
|
return new UpstreamError(options);
|
|
338
406
|
}
|
|
@@ -422,7 +490,7 @@ var DEFAULT_RETRY_CONFIG = {
|
|
|
422
490
|
statusCodes: [408, 425, 429, 500, 502, 503, 504],
|
|
423
491
|
methods: ["GET", "HEAD", "OPTIONS", "PUT", "DELETE"]
|
|
424
492
|
};
|
|
425
|
-
var SDK_VERSION = "0.
|
|
493
|
+
var SDK_VERSION = "0.8.0";
|
|
426
494
|
var DEFAULT_USER_AGENT = `foxnose-sdk-js/${SDK_VERSION}`;
|
|
427
495
|
function createConfig(options) {
|
|
428
496
|
if (!options.baseUrl) {
|
|
@@ -729,6 +797,10 @@ function managementPaths(environmentKey) {
|
|
|
729
797
|
fileTombstonesRoot: (collectionKey) => `/v1/${environmentKey}/collections/${collectionKey}/files/tombstones`,
|
|
730
798
|
filesPolicyRoot: (collectionKey) => `/v1/${environmentKey}/collections/${collectionKey}/files-policy`,
|
|
731
799
|
filesReviewRoot: () => `/v1/${environmentKey}/files/review`,
|
|
800
|
+
// Webhooks paths
|
|
801
|
+
webhooksRoot: () => `/v1/${environmentKey}/webhooks`,
|
|
802
|
+
webhookEndpointRoot: (endpointId) => `/v1/${environmentKey}/webhooks/endpoints/${encodeURIComponent(endpointId)}`,
|
|
803
|
+
webhookEventRoot: (eventId) => `/v1/${environmentKey}/webhooks/events/${encodeURIComponent(eventId)}`,
|
|
732
804
|
// Caller's own permissions
|
|
733
805
|
myPermissionsRoot: () => `/v1/${environmentKey}/permissions/me`,
|
|
734
806
|
// Management API key paths
|
|
@@ -762,6 +834,21 @@ function managementPaths(environmentKey) {
|
|
|
762
834
|
}
|
|
763
835
|
|
|
764
836
|
// src/management/client.ts
|
|
837
|
+
function hideSecret(response) {
|
|
838
|
+
if (response && typeof response === "object" && "secret" in response) {
|
|
839
|
+
Object.defineProperty(response, "secret", {
|
|
840
|
+
value: response.secret,
|
|
841
|
+
enumerable: false,
|
|
842
|
+
writable: false,
|
|
843
|
+
configurable: true
|
|
844
|
+
});
|
|
845
|
+
}
|
|
846
|
+
return response;
|
|
847
|
+
}
|
|
848
|
+
function webhookEndpointBody(request) {
|
|
849
|
+
const { collection_keys, ...rest } = request;
|
|
850
|
+
return collection_keys === void 0 ? rest : { ...rest, collection_keys: collection_keys.map((key) => resolveKey(key)) };
|
|
851
|
+
}
|
|
765
852
|
var ManagementClient = class {
|
|
766
853
|
environmentKey;
|
|
767
854
|
transport;
|
|
@@ -2155,6 +2242,164 @@ var ManagementClient = class {
|
|
|
2155
2242
|
async getMyPermissions() {
|
|
2156
2243
|
return this.request("GET", `${this.paths.myPermissionsRoot()}/`);
|
|
2157
2244
|
}
|
|
2245
|
+
// ------------------------------------------------------------------ //
|
|
2246
|
+
// Webhooks
|
|
2247
|
+
// ------------------------------------------------------------------ //
|
|
2248
|
+
/**
|
|
2249
|
+
* List the environment's webhook endpoints, newest first. Each item carries
|
|
2250
|
+
* `stats_24h`; secrets are never included. `params` carries `status` (`active`,
|
|
2251
|
+
* `paused` or `disabled`), `limit` (at most 200) and `offset`.
|
|
2252
|
+
*/
|
|
2253
|
+
async listWebhookEndpoints(params) {
|
|
2254
|
+
return this.request("GET", `${this.paths.webhooksRoot()}/endpoints/`, { params });
|
|
2255
|
+
}
|
|
2256
|
+
/**
|
|
2257
|
+
* Create a webhook endpoint.
|
|
2258
|
+
*
|
|
2259
|
+
* The answer carries the signing `secret`, which is not enumerable: read it as
|
|
2260
|
+
* `created.secret`, and read it again later with {@link getWebhookEndpointSecret}.
|
|
2261
|
+
* An environment holds at most 20 endpoints ({@link WebhookEndpointLimitExceededError}).
|
|
2262
|
+
* A `content` endpoint also needs read access to the content it will deliver.
|
|
2263
|
+
*/
|
|
2264
|
+
async createWebhookEndpoint(request) {
|
|
2265
|
+
const created = await this.transport.request(
|
|
2266
|
+
"POST",
|
|
2267
|
+
`${this.paths.webhooksRoot()}/endpoints/`,
|
|
2268
|
+
{
|
|
2269
|
+
jsonBody: webhookEndpointBody(request),
|
|
2270
|
+
allowRetries: false
|
|
2271
|
+
}
|
|
2272
|
+
);
|
|
2273
|
+
return hideSecret(created);
|
|
2274
|
+
}
|
|
2275
|
+
/** Read one webhook endpoint. It carries neither the secret nor `stats_24h`. */
|
|
2276
|
+
async getWebhookEndpoint(endpointId) {
|
|
2277
|
+
return this.request("GET", `${this.paths.webhookEndpointRoot(endpointId)}/`);
|
|
2278
|
+
}
|
|
2279
|
+
/**
|
|
2280
|
+
* Change the given fields of an endpoint and leave the rest alone.
|
|
2281
|
+
*
|
|
2282
|
+
* `status: 'active'` resumes a paused or disabled endpoint and clears its failure
|
|
2283
|
+
* streak; events that happened meanwhile are not sent, but failed deliveries can be
|
|
2284
|
+
* sent again with {@link recoverWebhookDeliveries}.
|
|
2285
|
+
*/
|
|
2286
|
+
async updateWebhookEndpoint(endpointId, changes) {
|
|
2287
|
+
return this.request("PATCH", `${this.paths.webhookEndpointRoot(endpointId)}/`, {
|
|
2288
|
+
jsonBody: webhookEndpointBody(changes)
|
|
2289
|
+
});
|
|
2290
|
+
}
|
|
2291
|
+
/**
|
|
2292
|
+
* Delete an endpoint and its pending deliveries. Its finished deliveries and
|
|
2293
|
+
* attempts stay in the event log for 30 days, with `endpoint.deleted` true.
|
|
2294
|
+
*/
|
|
2295
|
+
async deleteWebhookEndpoint(endpointId) {
|
|
2296
|
+
await this.request("DELETE", `${this.paths.webhookEndpointRoot(endpointId)}/`, {
|
|
2297
|
+
parseJson: false
|
|
2298
|
+
});
|
|
2299
|
+
}
|
|
2300
|
+
/**
|
|
2301
|
+
* List an endpoint's deliveries, newest first, each with the event it carries.
|
|
2302
|
+
* `params` carries `limit` (at most 200) and `offset`.
|
|
2303
|
+
*/
|
|
2304
|
+
async listWebhookEndpointDeliveries(endpointId, params) {
|
|
2305
|
+
return this.request("GET", `${this.paths.webhookEndpointRoot(endpointId)}/deliveries/`, {
|
|
2306
|
+
params
|
|
2307
|
+
});
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Read the endpoint's current signing secret: the newest, during a rotation. Needs
|
|
2311
|
+
* `webhooks:update`. `secret` is not enumerable: read it as `response.secret`.
|
|
2312
|
+
*/
|
|
2313
|
+
async getWebhookEndpointSecret(endpointId) {
|
|
2314
|
+
const response = await this.request(
|
|
2315
|
+
"GET",
|
|
2316
|
+
`${this.paths.webhookEndpointRoot(endpointId)}/secret/`
|
|
2317
|
+
);
|
|
2318
|
+
return hideSecret(response);
|
|
2319
|
+
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Create a new signing secret and return it.
|
|
2322
|
+
*
|
|
2323
|
+
* The previous secret stays valid for 24 hours, and deliveries carry a signature for
|
|
2324
|
+
* each valid secret; with `expire_previous_now` it stops at once. Needs
|
|
2325
|
+
* `webhooks:update`. `secret` is not enumerable: read it as `rotation.secret`.
|
|
2326
|
+
*/
|
|
2327
|
+
async rotateWebhookEndpointSecret(endpointId, options) {
|
|
2328
|
+
const response = await this.transport.request(
|
|
2329
|
+
"POST",
|
|
2330
|
+
`${this.paths.webhookEndpointRoot(endpointId)}/secret/rotate/`,
|
|
2331
|
+
{
|
|
2332
|
+
jsonBody: { expire_previous_now: options?.expire_previous_now ?? false },
|
|
2333
|
+
allowRetries: false
|
|
2334
|
+
}
|
|
2335
|
+
);
|
|
2336
|
+
return hideSecret(response);
|
|
2337
|
+
}
|
|
2338
|
+
/**
|
|
2339
|
+
* Send a sample event of `eventType` to this endpoint only, with `test` true in the
|
|
2340
|
+
* envelope. It is sent whatever the endpoint's event types and collection filter,
|
|
2341
|
+
* but the endpoint must be active ({@link WebhookEndpointNotActiveError}).
|
|
2342
|
+
*/
|
|
2343
|
+
async sendWebhookTestEvent(endpointId, eventType) {
|
|
2344
|
+
return this.transport.request("POST", `${this.paths.webhookEndpointRoot(endpointId)}/test/`, {
|
|
2345
|
+
jsonBody: { event_type: eventType },
|
|
2346
|
+
allowRetries: false
|
|
2347
|
+
});
|
|
2348
|
+
}
|
|
2349
|
+
/**
|
|
2350
|
+
* Send again the endpoint's failed deliveries created at or after `since`.
|
|
2351
|
+
*
|
|
2352
|
+
* Each becomes a new pending delivery of the same event. One call queues at most
|
|
2353
|
+
* 10,000 deliveries; when `more` is true, call again with the same `since`. `since`
|
|
2354
|
+
* is an ISO 8601 time within the last 30 days; a time without a zone is read as UTC.
|
|
2355
|
+
*/
|
|
2356
|
+
async recoverWebhookDeliveries(endpointId, since) {
|
|
2357
|
+
return this.transport.request(
|
|
2358
|
+
"POST",
|
|
2359
|
+
`${this.paths.webhookEndpointRoot(endpointId)}/recover/`,
|
|
2360
|
+
{
|
|
2361
|
+
jsonBody: { since: since instanceof Date ? since.toISOString() : since },
|
|
2362
|
+
allowRetries: false
|
|
2363
|
+
}
|
|
2364
|
+
);
|
|
2365
|
+
}
|
|
2366
|
+
/**
|
|
2367
|
+
* List the events of the last 30 days, newest first, with `delivery_counts`.
|
|
2368
|
+
* `params` carries `type`, `endpoint` (an endpoint `id`), `status` (`pending`,
|
|
2369
|
+
* `succeeded` or `dead`), `test`, `after`, `before` (ISO 8601), `limit` (at most 200)
|
|
2370
|
+
* and `offset`.
|
|
2371
|
+
*/
|
|
2372
|
+
async listWebhookEvents(params) {
|
|
2373
|
+
return this.request("GET", `${this.paths.webhooksRoot()}/events/`, { params });
|
|
2374
|
+
}
|
|
2375
|
+
/** Read one event with its envelope and all its deliveries, oldest first. */
|
|
2376
|
+
async getWebhookEvent(eventId) {
|
|
2377
|
+
return this.request("GET", `${this.paths.webhookEventRoot(eventId)}/`);
|
|
2378
|
+
}
|
|
2379
|
+
/**
|
|
2380
|
+
* List every attempt to deliver the event, across endpoints, oldest first. `params`
|
|
2381
|
+
* carries `limit` (at most 200) and `offset`.
|
|
2382
|
+
*/
|
|
2383
|
+
async listWebhookEventAttempts(eventId, params) {
|
|
2384
|
+
return this.request("GET", `${this.paths.webhookEventRoot(eventId)}/attempts/`, { params });
|
|
2385
|
+
}
|
|
2386
|
+
/**
|
|
2387
|
+
* Send the event again as a new delivery, with the same event `id`.
|
|
2388
|
+
*
|
|
2389
|
+
* With `endpoint_id` the event goes to that endpoint. Without it, the event goes to
|
|
2390
|
+
* every endpoint that had a delivery of it and is active and subscribed to it now;
|
|
2391
|
+
* the others are listed in `skipped`.
|
|
2392
|
+
*/
|
|
2393
|
+
async redeliverWebhookEvent(eventId, options) {
|
|
2394
|
+
return this.transport.request("POST", `${this.paths.webhookEventRoot(eventId)}/redeliver/`, {
|
|
2395
|
+
jsonBody: options?.endpoint_id !== void 0 ? { endpoint_id: options.endpoint_id } : {},
|
|
2396
|
+
allowRetries: false
|
|
2397
|
+
});
|
|
2398
|
+
}
|
|
2399
|
+
/** List the event-type catalogue with the JSON Schema of each payload mode. */
|
|
2400
|
+
async listWebhookEventTypes() {
|
|
2401
|
+
return this.request("GET", `${this.paths.webhooksRoot()}/event-types/`);
|
|
2402
|
+
}
|
|
2158
2403
|
fileRoot(collectionKey, resourceKey) {
|
|
2159
2404
|
return this.paths.fileRoot(resolveKey(collectionKey), resolveKey(resourceKey));
|
|
2160
2405
|
}
|
|
@@ -2617,6 +2862,11 @@ var FluxClient = class {
|
|
|
2617
2862
|
StaticTokenProvider,
|
|
2618
2863
|
UpstreamError,
|
|
2619
2864
|
VERSION,
|
|
2865
|
+
WebhookEndpointLimitExceededError,
|
|
2866
|
+
WebhookEndpointNotActiveError,
|
|
2867
|
+
WebhookEndpointNotFoundError,
|
|
2868
|
+
WebhookEndpointNotSubscribedError,
|
|
2869
|
+
WebhookEventNotFoundError,
|
|
2620
2870
|
buildSearchBody,
|
|
2621
2871
|
createConfig,
|
|
2622
2872
|
nestedFieldMeta,
|