@assinafy/cli 2.7.0 → 2.7.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.
- package/README.md +78 -419
- package/dist/api.cjs +7 -4
- package/dist/api.cjs.map +1 -1
- package/dist/api.js +7 -4
- package/dist/api.js.map +1 -1
- package/dist/cli.cjs +9 -9
- package/dist/types/api/resources/webhooks.d.ts.map +1 -1
- package/docs/api-operations.json +1 -1
- package/docs/api-reference.md +1 -1
- package/docs/releasing.md +38 -12
- package/package.json +1 -1
package/dist/api.cjs
CHANGED
|
@@ -2354,7 +2354,7 @@ var DEFAULT_EVENTS = [
|
|
|
2354
2354
|
"signer_rejected_document",
|
|
2355
2355
|
"document_processing_failed"
|
|
2356
2356
|
];
|
|
2357
|
-
function validateWebhookFields(payload) {
|
|
2357
|
+
function validateWebhookFields(payload, requireHttps = false) {
|
|
2358
2358
|
if (payload.url !== void 0) {
|
|
2359
2359
|
let webhookUrl;
|
|
2360
2360
|
try {
|
|
@@ -2365,6 +2365,9 @@ function validateWebhookFields(payload) {
|
|
|
2365
2365
|
if (webhookUrl.protocol !== "http:" && webhookUrl.protocol !== "https:") {
|
|
2366
2366
|
throw new ValidationError("Webhook URL must be a valid HTTP(S) URL");
|
|
2367
2367
|
}
|
|
2368
|
+
if (requireHttps && webhookUrl.protocol !== "https:") {
|
|
2369
|
+
throw new ValidationError("Webhook URL must use HTTPS");
|
|
2370
|
+
}
|
|
2368
2371
|
}
|
|
2369
2372
|
if (payload.email !== void 0) requireEmail(payload.email);
|
|
2370
2373
|
if (payload.events !== void 0 && (!Array.isArray(payload.events) || payload.events.some((event) => typeof event !== "string" || !event))) {
|
|
@@ -2387,7 +2390,7 @@ var WebhookResource = class extends BaseResource {
|
|
|
2387
2390
|
*/
|
|
2388
2391
|
async register(payload, accountId) {
|
|
2389
2392
|
if (!payload.url) throw new ValidationError("Webhook URL is required");
|
|
2390
|
-
validateWebhookFields({ ...payload, email: payload.email ?? "" });
|
|
2393
|
+
validateWebhookFields({ ...payload, email: payload.email ?? "" }, true);
|
|
2391
2394
|
const id = this.accountId(accountId);
|
|
2392
2395
|
const body = {
|
|
2393
2396
|
url: payload.url,
|
|
@@ -2438,7 +2441,7 @@ var WebhookResource = class extends BaseResource {
|
|
|
2438
2441
|
*/
|
|
2439
2442
|
async createEndpoint(payload, accountId) {
|
|
2440
2443
|
if (!payload.url) throw new ValidationError("Webhook URL is required");
|
|
2441
|
-
validateWebhookFields({ ...payload, email: payload.email ?? "" });
|
|
2444
|
+
validateWebhookFields({ ...payload, email: payload.email ?? "" }, true);
|
|
2442
2445
|
const id = this.accountId(accountId);
|
|
2443
2446
|
const body = { ...payload, events: payload.events ?? DEFAULT_EVENTS };
|
|
2444
2447
|
this.logger.info("Creating webhook endpoint", { eventCount: body.events.length });
|
|
@@ -2468,7 +2471,7 @@ var WebhookResource = class extends BaseResource {
|
|
|
2468
2471
|
if (!payload || typeof payload !== "object" || Object.keys(payload).length === 0) {
|
|
2469
2472
|
throw new ValidationError("At least one webhook endpoint field is required");
|
|
2470
2473
|
}
|
|
2471
|
-
validateWebhookFields(payload);
|
|
2474
|
+
validateWebhookFields(payload, true);
|
|
2472
2475
|
return this.call(
|
|
2473
2476
|
"Failed to update webhook endpoint",
|
|
2474
2477
|
() => this.http.put(`/accounts/${id}/webhooks/endpoints/${eid}`, payload)
|