@timeback/webhooks 0.1.2-beta.20260223234236 → 0.1.2-beta.20260224163826
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/dist/index.js +16 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1482,6 +1482,11 @@ class InputValidationError extends ApiError {
|
|
|
1482
1482
|
function createInputValidationError(message, issues) {
|
|
1483
1483
|
return new InputValidationError(message, issues);
|
|
1484
1484
|
}
|
|
1485
|
+
function isApiError(error) {
|
|
1486
|
+
if (!(error instanceof Error))
|
|
1487
|
+
return false;
|
|
1488
|
+
return "statusCode" in error && "response" in error;
|
|
1489
|
+
}
|
|
1485
1490
|
// ../../internal/client-infra/src/transport/constants.ts
|
|
1486
1491
|
var MAX_RETRIES = 3;
|
|
1487
1492
|
var RETRY_STATUS_CODES = [429, 503];
|
|
@@ -1523,6 +1528,17 @@ class BaseTransport {
|
|
|
1523
1528
|
const response = await this.requestRaw(path, options);
|
|
1524
1529
|
return this.handleResponse(response);
|
|
1525
1530
|
}
|
|
1531
|
+
async exists(path, options = {}) {
|
|
1532
|
+
try {
|
|
1533
|
+
await this.requestRaw(path, options);
|
|
1534
|
+
return true;
|
|
1535
|
+
} catch (error) {
|
|
1536
|
+
if (isApiError(error) && error.statusCode === 404) {
|
|
1537
|
+
return false;
|
|
1538
|
+
}
|
|
1539
|
+
throw error;
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1526
1542
|
async requestRaw(path, options = {}) {
|
|
1527
1543
|
const { method = "GET", params, body, headers = {} } = options;
|
|
1528
1544
|
const url = this.buildUrl(path, params);
|