@fiado/type-kit 3.397.0 → 3.399.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/bin/webhookBusiness/dtos/PendingWebhookDeliveryView.d.ts +30 -0
- package/bin/webhookBusiness/dtos/PendingWebhookDeliveryView.js +2 -0
- package/bin/webhookBusiness/dtos/RedeliveredWebhookRecipient.d.ts +10 -0
- package/bin/webhookBusiness/dtos/RedeliveredWebhookRecipient.js +2 -0
- package/bin/webhookBusiness/dtos/SkippedWebhookRedelivery.d.ts +6 -0
- package/bin/webhookBusiness/dtos/SkippedWebhookRedelivery.js +2 -0
- package/bin/webhookBusiness/dtos/requests/ListPendingWebhookDeliveriesRequest.d.ts +15 -0
- package/bin/webhookBusiness/dtos/requests/ListPendingWebhookDeliveriesRequest.js +58 -0
- package/bin/webhookBusiness/dtos/requests/RedeliverWebhookEventsBatchRequest.d.ts +17 -0
- package/bin/webhookBusiness/dtos/requests/RedeliverWebhookEventsBatchRequest.js +68 -0
- package/bin/webhookBusiness/dtos/responses/ListPendingWebhookDeliveriesResponse.d.ts +12 -0
- package/bin/webhookBusiness/dtos/responses/ListPendingWebhookDeliveriesResponse.js +2 -0
- package/bin/webhookBusiness/dtos/responses/RedeliverWebhookEventResponse.d.ts +7 -2
- package/bin/webhookBusiness/dtos/responses/RedeliverWebhookEventsBatchResponse.d.ts +14 -0
- package/bin/webhookBusiness/dtos/responses/RedeliverWebhookEventsBatchResponse.js +2 -0
- package/bin/webhookBusiness/enums/RedeliverySkipReasonEnum.d.ts +18 -0
- package/bin/webhookBusiness/enums/RedeliverySkipReasonEnum.js +22 -0
- package/bin/webhookBusiness/index.d.ts +8 -0
- package/bin/webhookBusiness/index.js +8 -0
- package/package.json +1 -1
- package/src/webhookBusiness/dtos/PendingWebhookDeliveryView.ts +31 -0
- package/src/webhookBusiness/dtos/RedeliveredWebhookRecipient.ts +11 -0
- package/src/webhookBusiness/dtos/SkippedWebhookRedelivery.ts +7 -0
- package/src/webhookBusiness/dtos/requests/ListPendingWebhookDeliveriesRequest.ts +44 -0
- package/src/webhookBusiness/dtos/requests/RedeliverWebhookEventsBatchRequest.ts +53 -0
- package/src/webhookBusiness/dtos/responses/ListPendingWebhookDeliveriesResponse.ts +13 -0
- package/src/webhookBusiness/dtos/responses/RedeliverWebhookEventResponse.ts +7 -2
- package/src/webhookBusiness/dtos/responses/RedeliverWebhookEventsBatchResponse.ts +15 -0
- package/src/webhookBusiness/enums/RedeliverySkipReasonEnum.ts +18 -0
- package/src/webhookBusiness/index.ts +8 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WebhookEventType } from '../enums/WebhookEventType';
|
|
2
|
+
import type { DeliveryOutcomeEnum } from '../enums/DeliveryOutcomeEnum';
|
|
3
|
+
/**
|
|
4
|
+
* Un evento que un suscriptor todavía no aceptó. Hay una sola fila por par (evento, suscriptor):
|
|
5
|
+
* lleva el desenlace vigente, no cada intento, así el listado no repite el mismo evento.
|
|
6
|
+
*/
|
|
7
|
+
export interface PendingWebhookDeliveryView {
|
|
8
|
+
eventId: string;
|
|
9
|
+
eventType: WebhookEventType;
|
|
10
|
+
/** Lambda que produjo el evento. */
|
|
11
|
+
source: string;
|
|
12
|
+
directoryId: string;
|
|
13
|
+
occurredAt: string;
|
|
14
|
+
/** Último desenlace asentado contra este suscriptor. Nunca `DELIVERED`: eso sale del listado. */
|
|
15
|
+
outcome: DeliveryOutcomeEnum;
|
|
16
|
+
subscriberName?: string;
|
|
17
|
+
url?: string;
|
|
18
|
+
/** Número del último asiento del par (evento, suscriptor). */
|
|
19
|
+
attempt?: number;
|
|
20
|
+
/** Intentos de red gastados en la ronda vigente. Un reenvío explícito la reabre en cero. */
|
|
21
|
+
sendAttempts?: number;
|
|
22
|
+
receiverHttpStatus?: number;
|
|
23
|
+
errorCode?: string;
|
|
24
|
+
failureReason?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Falso cuando el evento en bruto ya venció o nunca se guardó. Reenviarlo exigiría mandar el
|
|
27
|
+
* payload a mano por el endpoint de reposición individual.
|
|
28
|
+
*/
|
|
29
|
+
redeliverable: boolean;
|
|
30
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DeliveryOutcomeEnum } from '../enums/DeliveryOutcomeEnum';
|
|
2
|
+
import type { RedeliverySkipReasonEnum } from '../enums/RedeliverySkipReasonEnum';
|
|
3
|
+
/** Cómo terminó un destinatario dentro de un reenvío manual, uno por tag del comprador. */
|
|
4
|
+
export interface RedeliveredWebhookRecipient {
|
|
5
|
+
tag: string;
|
|
6
|
+
/** Desenlace vigente del destinatario, tal como quedó asentado en la bitácora. */
|
|
7
|
+
outcome: DeliveryOutcomeEnum;
|
|
8
|
+
/** Sólo cuando el evento NO volvió a salir a la red para este destinatario. */
|
|
9
|
+
skipReason?: RedeliverySkipReasonEnum;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query de `GET /private/webhook-deliveries/pending` — lo que un suscriptor todavía no aceptó.
|
|
3
|
+
* Va contra el índice `pendingSubscriberTag-createdAt-index`, que sólo contiene lo pendiente.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ListPendingWebhookDeliveriesRequest {
|
|
6
|
+
/** Tag del suscriptor, con el prefijo reservado `wh:`. */
|
|
7
|
+
tag: string;
|
|
8
|
+
/** Desde cuándo, por fecha del evento. Sin él la ventana arranca en el pendiente más viejo. */
|
|
9
|
+
from?: string;
|
|
10
|
+
to?: string;
|
|
11
|
+
/** Tope de filas de la página. El manager lo recorta a su máximo. */
|
|
12
|
+
limit?: number;
|
|
13
|
+
/** Cursor opaco de la página anterior. Se manda tal cual vino, sin interpretarlo. */
|
|
14
|
+
cursor?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ListPendingWebhookDeliveriesRequest = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const WebhookFieldLimits_1 = require("../../constants/WebhookFieldLimits");
|
|
16
|
+
/**
|
|
17
|
+
* Query de `GET /private/webhook-deliveries/pending` — lo que un suscriptor todavía no aceptó.
|
|
18
|
+
* Va contra el índice `pendingSubscriberTag-createdAt-index`, que sólo contiene lo pendiente.
|
|
19
|
+
*/
|
|
20
|
+
class ListPendingWebhookDeliveriesRequest {
|
|
21
|
+
}
|
|
22
|
+
exports.ListPendingWebhookDeliveriesRequest = ListPendingWebhookDeliveriesRequest;
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, class_transformer_1.Expose)(),
|
|
25
|
+
(0, class_validator_1.IsString)(),
|
|
26
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
27
|
+
(0, class_validator_1.MaxLength)(WebhookFieldLimits_1.WEBHOOK_TAG_MAX_LENGTH),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], ListPendingWebhookDeliveriesRequest.prototype, "tag", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, class_transformer_1.Expose)(),
|
|
32
|
+
(0, class_validator_1.IsOptional)(),
|
|
33
|
+
(0, class_validator_1.IsString)(),
|
|
34
|
+
(0, class_validator_1.IsISO8601)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], ListPendingWebhookDeliveriesRequest.prototype, "from", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_transformer_1.Expose)(),
|
|
39
|
+
(0, class_validator_1.IsOptional)(),
|
|
40
|
+
(0, class_validator_1.IsString)(),
|
|
41
|
+
(0, class_validator_1.IsISO8601)(),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], ListPendingWebhookDeliveriesRequest.prototype, "to", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, class_transformer_1.Expose)(),
|
|
46
|
+
(0, class_validator_1.IsOptional)(),
|
|
47
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
48
|
+
(0, class_validator_1.IsInt)(),
|
|
49
|
+
(0, class_validator_1.IsPositive)(),
|
|
50
|
+
__metadata("design:type", Number)
|
|
51
|
+
], ListPendingWebhookDeliveriesRequest.prototype, "limit", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, class_transformer_1.Expose)(),
|
|
54
|
+
(0, class_validator_1.IsOptional)(),
|
|
55
|
+
(0, class_validator_1.IsString)(),
|
|
56
|
+
(0, class_validator_1.MaxLength)(2048),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], ListPendingWebhookDeliveriesRequest.prototype, "cursor", void 0);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Body de `POST /private/webhook-deliveries/redeliver-batch` — reenvío masivo de lo que un
|
|
3
|
+
* suscriptor todavía no aceptó. La selección sale siempre del índice de pendientes: un evento ya
|
|
4
|
+
* entregado no se puede reenviar por acá.
|
|
5
|
+
*/
|
|
6
|
+
export declare class RedeliverWebhookEventsBatchRequest {
|
|
7
|
+
tag: string;
|
|
8
|
+
/** Ventana por fecha del evento. Sin ella entra todo lo pendiente hasta el tope del lote. */
|
|
9
|
+
from?: string;
|
|
10
|
+
to?: string;
|
|
11
|
+
/** Recorte de la ventana a estos eventos. Los que no estén pendientes no entran. */
|
|
12
|
+
eventIds?: string[];
|
|
13
|
+
/** Cuántos pendientes encolar como mucho. El manager rechaza tipado si se pasa de su tope. */
|
|
14
|
+
limit?: number;
|
|
15
|
+
/** Quién dispara el reenvío, para el log de la reposición. */
|
|
16
|
+
actor?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.RedeliverWebhookEventsBatchRequest = void 0;
|
|
13
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const WebhookFieldLimits_1 = require("../../constants/WebhookFieldLimits");
|
|
16
|
+
/**
|
|
17
|
+
* Body de `POST /private/webhook-deliveries/redeliver-batch` — reenvío masivo de lo que un
|
|
18
|
+
* suscriptor todavía no aceptó. La selección sale siempre del índice de pendientes: un evento ya
|
|
19
|
+
* entregado no se puede reenviar por acá.
|
|
20
|
+
*/
|
|
21
|
+
class RedeliverWebhookEventsBatchRequest {
|
|
22
|
+
}
|
|
23
|
+
exports.RedeliverWebhookEventsBatchRequest = RedeliverWebhookEventsBatchRequest;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, class_transformer_1.Expose)(),
|
|
26
|
+
(0, class_validator_1.IsString)(),
|
|
27
|
+
(0, class_validator_1.IsNotEmpty)(),
|
|
28
|
+
(0, class_validator_1.MaxLength)(WebhookFieldLimits_1.WEBHOOK_TAG_MAX_LENGTH),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], RedeliverWebhookEventsBatchRequest.prototype, "tag", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_transformer_1.Expose)(),
|
|
33
|
+
(0, class_validator_1.IsOptional)(),
|
|
34
|
+
(0, class_validator_1.IsString)(),
|
|
35
|
+
(0, class_validator_1.IsISO8601)(),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], RedeliverWebhookEventsBatchRequest.prototype, "from", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, class_transformer_1.Expose)(),
|
|
40
|
+
(0, class_validator_1.IsOptional)(),
|
|
41
|
+
(0, class_validator_1.IsString)(),
|
|
42
|
+
(0, class_validator_1.IsISO8601)(),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], RedeliverWebhookEventsBatchRequest.prototype, "to", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, class_transformer_1.Expose)(),
|
|
47
|
+
(0, class_validator_1.IsOptional)(),
|
|
48
|
+
(0, class_validator_1.IsArray)(),
|
|
49
|
+
(0, class_validator_1.ArrayNotEmpty)(),
|
|
50
|
+
(0, class_validator_1.IsString)({ each: true }),
|
|
51
|
+
(0, class_validator_1.MaxLength)(WebhookFieldLimits_1.WEBHOOK_EVENT_ID_MAX_LENGTH, { each: true }),
|
|
52
|
+
__metadata("design:type", Array)
|
|
53
|
+
], RedeliverWebhookEventsBatchRequest.prototype, "eventIds", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, class_transformer_1.Expose)(),
|
|
56
|
+
(0, class_validator_1.IsOptional)(),
|
|
57
|
+
(0, class_transformer_1.Type)(() => Number),
|
|
58
|
+
(0, class_validator_1.IsInt)(),
|
|
59
|
+
(0, class_validator_1.IsPositive)(),
|
|
60
|
+
__metadata("design:type", Number)
|
|
61
|
+
], RedeliverWebhookEventsBatchRequest.prototype, "limit", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, class_transformer_1.Expose)(),
|
|
64
|
+
(0, class_validator_1.IsOptional)(),
|
|
65
|
+
(0, class_validator_1.IsString)(),
|
|
66
|
+
(0, class_validator_1.MaxLength)(128),
|
|
67
|
+
__metadata("design:type", String)
|
|
68
|
+
], RedeliverWebhookEventsBatchRequest.prototype, "actor", void 0);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PendingWebhookDeliveryView } from '../PendingWebhookDeliveryView';
|
|
2
|
+
/**
|
|
3
|
+
* Respuesta de `GET /private/webhook-deliveries/pending`. Un suscriptor al día devuelve la lista
|
|
4
|
+
* vacía y no un 404: no deberle nada es el estado normal.
|
|
5
|
+
*/
|
|
6
|
+
export interface ListPendingWebhookDeliveriesResponse {
|
|
7
|
+
tag: string;
|
|
8
|
+
deliveries: PendingWebhookDeliveryView[];
|
|
9
|
+
count: number;
|
|
10
|
+
/** Cursor de la página siguiente. Ausente cuando no queda nada más pendiente. */
|
|
11
|
+
cursor?: string;
|
|
12
|
+
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import type { WebhookEventType } from '../../enums/WebhookEventType';
|
|
2
|
+
import type { RedeliveredWebhookRecipient } from '../RedeliveredWebhookRecipient';
|
|
2
3
|
/**
|
|
3
|
-
* Respuesta de `POST /private/webhook-deliveries/redeliver`.
|
|
4
|
-
*
|
|
4
|
+
* Respuesta de `POST /private/webhook-deliveries/redeliver`. El reenvío entrega en línea, así que
|
|
5
|
+
* dice qué pasó con cada destinatario: un 200 no significa por sí solo que el evento se repuso.
|
|
5
6
|
*/
|
|
6
7
|
export interface RedeliverWebhookEventResponse {
|
|
7
8
|
eventId: string;
|
|
8
9
|
eventType: WebhookEventType;
|
|
9
10
|
directoryId: string;
|
|
10
11
|
redeliveredAt: string;
|
|
12
|
+
/** Destinatarios que aceptaron el evento en este reenvío. En cero no se repuso nada. */
|
|
13
|
+
deliveredCount: number;
|
|
14
|
+
/** Uno por destinatario. Vacío significa que el comprador no tiene ningún tag `wh:*`. */
|
|
15
|
+
recipients: RedeliveredWebhookRecipient[];
|
|
11
16
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SkippedWebhookRedelivery } from '../SkippedWebhookRedelivery';
|
|
2
|
+
/**
|
|
3
|
+
* Respuesta de `POST /private/webhook-deliveries/redeliver-batch`. El lote se encola, así que
|
|
4
|
+
* devuelve cuántos se aceptaron y no cómo terminó cada destino: eso queda en la bitácora.
|
|
5
|
+
*/
|
|
6
|
+
export interface RedeliverWebhookEventsBatchResponse {
|
|
7
|
+
tag: string;
|
|
8
|
+
/** Pendientes que entraron en la selección, antes de descartar los que no se pueden reenviar. */
|
|
9
|
+
selectedCount: number;
|
|
10
|
+
/** Los que quedaron encolados. */
|
|
11
|
+
acceptedCount: number;
|
|
12
|
+
skipped: SkippedWebhookRedelivery[];
|
|
13
|
+
acceptedAt: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Por qué un evento no volvió a salir. El valor es el `code` que lo explica: los dos primeros son
|
|
3
|
+
* del error que dejó al evento fuera del lote; los demás, del destinatario que el reenvío no repuso.
|
|
4
|
+
*/
|
|
5
|
+
export declare enum RedeliverySkipReasonEnum {
|
|
6
|
+
/** El evento en bruto ya venció: sin payload no queda nada que reenviar. */
|
|
7
|
+
RAW_PAYLOAD_UNAVAILABLE = "WEBHOOK_RAW_PAYLOAD_UNAVAILABLE",
|
|
8
|
+
/** El bruto guardado no cumple el contrato de su tipo y no puede salir sin normalizar. */
|
|
9
|
+
PAYLOAD_INVALID = "WEBHOOK_PAYLOAD_INVALID",
|
|
10
|
+
/** El suscriptor ya había aceptado el evento. No se le repite nunca, ni a mano. */
|
|
11
|
+
ALREADY_DELIVERED = "WEBHOOK_ALREADY_DELIVERED",
|
|
12
|
+
/** El tag existe pero nadie declaró un destino para ese tipo de evento. */
|
|
13
|
+
NO_SUBSCRIPTION = "WEBHOOK_NO_SUBSCRIPTION",
|
|
14
|
+
/** El destino está dado de baja: es un no-op registrado, no un error. */
|
|
15
|
+
SUBSCRIPTION_INACTIVE = "WEBHOOK_SUBSCRIPTION_INACTIVE",
|
|
16
|
+
/** La ronda de intentos del destino ya estaba agotada y este pase no abrió otra. */
|
|
17
|
+
DELIVERY_EXHAUSTED = "WEBHOOK_DELIVERY_EXHAUSTED"
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RedeliverySkipReasonEnum = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Por qué un evento no volvió a salir. El valor es el `code` que lo explica: los dos primeros son
|
|
6
|
+
* del error que dejó al evento fuera del lote; los demás, del destinatario que el reenvío no repuso.
|
|
7
|
+
*/
|
|
8
|
+
var RedeliverySkipReasonEnum;
|
|
9
|
+
(function (RedeliverySkipReasonEnum) {
|
|
10
|
+
/** El evento en bruto ya venció: sin payload no queda nada que reenviar. */
|
|
11
|
+
RedeliverySkipReasonEnum["RAW_PAYLOAD_UNAVAILABLE"] = "WEBHOOK_RAW_PAYLOAD_UNAVAILABLE";
|
|
12
|
+
/** El bruto guardado no cumple el contrato de su tipo y no puede salir sin normalizar. */
|
|
13
|
+
RedeliverySkipReasonEnum["PAYLOAD_INVALID"] = "WEBHOOK_PAYLOAD_INVALID";
|
|
14
|
+
/** El suscriptor ya había aceptado el evento. No se le repite nunca, ni a mano. */
|
|
15
|
+
RedeliverySkipReasonEnum["ALREADY_DELIVERED"] = "WEBHOOK_ALREADY_DELIVERED";
|
|
16
|
+
/** El tag existe pero nadie declaró un destino para ese tipo de evento. */
|
|
17
|
+
RedeliverySkipReasonEnum["NO_SUBSCRIPTION"] = "WEBHOOK_NO_SUBSCRIPTION";
|
|
18
|
+
/** El destino está dado de baja: es un no-op registrado, no un error. */
|
|
19
|
+
RedeliverySkipReasonEnum["SUBSCRIPTION_INACTIVE"] = "WEBHOOK_SUBSCRIPTION_INACTIVE";
|
|
20
|
+
/** La ronda de intentos del destino ya estaba agotada y este pase no abrió otra. */
|
|
21
|
+
RedeliverySkipReasonEnum["DELIVERY_EXHAUSTED"] = "WEBHOOK_DELIVERY_EXHAUSTED";
|
|
22
|
+
})(RedeliverySkipReasonEnum || (exports.RedeliverySkipReasonEnum = RedeliverySkipReasonEnum = {}));
|
|
@@ -3,6 +3,7 @@ export * from './enums/ComplianceDecisionEnum';
|
|
|
3
3
|
export * from './enums/SubscriptionVisibilityEnum';
|
|
4
4
|
export * from './enums/SubscriptionStatusEnum';
|
|
5
5
|
export * from './enums/DeliveryOutcomeEnum';
|
|
6
|
+
export * from './enums/RedeliverySkipReasonEnum';
|
|
6
7
|
export * from './constants/CaseRefPattern';
|
|
7
8
|
export * from './constants/WebhookFieldLimits';
|
|
8
9
|
export * from './events/AccountIssuanceCompletedV1';
|
|
@@ -11,14 +12,21 @@ export * from './dtos/WebhookEventEnvelope';
|
|
|
11
12
|
export * from './dtos/WebhookOutboundMessage';
|
|
12
13
|
export * from './dtos/WebhookSubscriptionView';
|
|
13
14
|
export * from './dtos/WebhookDeliveryView';
|
|
15
|
+
export * from './dtos/PendingWebhookDeliveryView';
|
|
16
|
+
export * from './dtos/SkippedWebhookRedelivery';
|
|
17
|
+
export * from './dtos/RedeliveredWebhookRecipient';
|
|
14
18
|
export * from './dtos/requests/UpsertWebhookSubscriptionRequest';
|
|
15
19
|
export * from './dtos/requests/GetWebhookSubscriptionRequest';
|
|
16
20
|
export * from './dtos/requests/DeactivateWebhookSubscriptionRequest';
|
|
17
21
|
export * from './dtos/requests/ListWebhookDeliveriesRequest';
|
|
18
22
|
export * from './dtos/requests/RedeliverWebhookEventRequest';
|
|
23
|
+
export * from './dtos/requests/ListPendingWebhookDeliveriesRequest';
|
|
24
|
+
export * from './dtos/requests/RedeliverWebhookEventsBatchRequest';
|
|
19
25
|
export * from './dtos/responses/UpsertWebhookSubscriptionResponse';
|
|
20
26
|
export * from './dtos/responses/GetWebhookSubscriptionResponse';
|
|
21
27
|
export * from './dtos/responses/ListWebhookSubscriptionsResponse';
|
|
22
28
|
export * from './dtos/responses/DeactivateWebhookSubscriptionResponse';
|
|
23
29
|
export * from './dtos/responses/ListWebhookDeliveriesResponse';
|
|
24
30
|
export * from './dtos/responses/RedeliverWebhookEventResponse';
|
|
31
|
+
export * from './dtos/responses/ListPendingWebhookDeliveriesResponse';
|
|
32
|
+
export * from './dtos/responses/RedeliverWebhookEventsBatchResponse';
|
|
@@ -20,6 +20,7 @@ __exportStar(require("./enums/ComplianceDecisionEnum"), exports);
|
|
|
20
20
|
__exportStar(require("./enums/SubscriptionVisibilityEnum"), exports);
|
|
21
21
|
__exportStar(require("./enums/SubscriptionStatusEnum"), exports);
|
|
22
22
|
__exportStar(require("./enums/DeliveryOutcomeEnum"), exports);
|
|
23
|
+
__exportStar(require("./enums/RedeliverySkipReasonEnum"), exports);
|
|
23
24
|
// Formatos y topes compartidos por los contratos
|
|
24
25
|
__exportStar(require("./constants/CaseRefPattern"), exports);
|
|
25
26
|
__exportStar(require("./constants/WebhookFieldLimits"), exports);
|
|
@@ -32,12 +33,17 @@ __exportStar(require("./dtos/WebhookOutboundMessage"), exports);
|
|
|
32
33
|
// Vistas del padrón y de la bitácora, tal como salen por la API de administración
|
|
33
34
|
__exportStar(require("./dtos/WebhookSubscriptionView"), exports);
|
|
34
35
|
__exportStar(require("./dtos/WebhookDeliveryView"), exports);
|
|
36
|
+
__exportStar(require("./dtos/PendingWebhookDeliveryView"), exports);
|
|
37
|
+
__exportStar(require("./dtos/SkippedWebhookRedelivery"), exports);
|
|
38
|
+
__exportStar(require("./dtos/RedeliveredWebhookRecipient"), exports);
|
|
35
39
|
// API privada de administración — requests
|
|
36
40
|
__exportStar(require("./dtos/requests/UpsertWebhookSubscriptionRequest"), exports);
|
|
37
41
|
__exportStar(require("./dtos/requests/GetWebhookSubscriptionRequest"), exports);
|
|
38
42
|
__exportStar(require("./dtos/requests/DeactivateWebhookSubscriptionRequest"), exports);
|
|
39
43
|
__exportStar(require("./dtos/requests/ListWebhookDeliveriesRequest"), exports);
|
|
40
44
|
__exportStar(require("./dtos/requests/RedeliverWebhookEventRequest"), exports);
|
|
45
|
+
__exportStar(require("./dtos/requests/ListPendingWebhookDeliveriesRequest"), exports);
|
|
46
|
+
__exportStar(require("./dtos/requests/RedeliverWebhookEventsBatchRequest"), exports);
|
|
41
47
|
// API privada de administración — responses
|
|
42
48
|
__exportStar(require("./dtos/responses/UpsertWebhookSubscriptionResponse"), exports);
|
|
43
49
|
__exportStar(require("./dtos/responses/GetWebhookSubscriptionResponse"), exports);
|
|
@@ -45,3 +51,5 @@ __exportStar(require("./dtos/responses/ListWebhookSubscriptionsResponse"), expor
|
|
|
45
51
|
__exportStar(require("./dtos/responses/DeactivateWebhookSubscriptionResponse"), exports);
|
|
46
52
|
__exportStar(require("./dtos/responses/ListWebhookDeliveriesResponse"), exports);
|
|
47
53
|
__exportStar(require("./dtos/responses/RedeliverWebhookEventResponse"), exports);
|
|
54
|
+
__exportStar(require("./dtos/responses/ListPendingWebhookDeliveriesResponse"), exports);
|
|
55
|
+
__exportStar(require("./dtos/responses/RedeliverWebhookEventsBatchResponse"), exports);
|
package/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { WebhookEventType } from '../enums/WebhookEventType';
|
|
2
|
+
import type { DeliveryOutcomeEnum } from '../enums/DeliveryOutcomeEnum';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Un evento que un suscriptor todavía no aceptó. Hay una sola fila por par (evento, suscriptor):
|
|
6
|
+
* lleva el desenlace vigente, no cada intento, así el listado no repite el mismo evento.
|
|
7
|
+
*/
|
|
8
|
+
export interface PendingWebhookDeliveryView {
|
|
9
|
+
eventId: string;
|
|
10
|
+
eventType: WebhookEventType;
|
|
11
|
+
/** Lambda que produjo el evento. */
|
|
12
|
+
source: string;
|
|
13
|
+
directoryId: string;
|
|
14
|
+
occurredAt: string;
|
|
15
|
+
/** Último desenlace asentado contra este suscriptor. Nunca `DELIVERED`: eso sale del listado. */
|
|
16
|
+
outcome: DeliveryOutcomeEnum;
|
|
17
|
+
subscriberName?: string;
|
|
18
|
+
url?: string;
|
|
19
|
+
/** Número del último asiento del par (evento, suscriptor). */
|
|
20
|
+
attempt?: number;
|
|
21
|
+
/** Intentos de red gastados en la ronda vigente. Un reenvío explícito la reabre en cero. */
|
|
22
|
+
sendAttempts?: number;
|
|
23
|
+
receiverHttpStatus?: number;
|
|
24
|
+
errorCode?: string;
|
|
25
|
+
failureReason?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Falso cuando el evento en bruto ya venció o nunca se guardó. Reenviarlo exigiría mandar el
|
|
28
|
+
* payload a mano por el endpoint de reposición individual.
|
|
29
|
+
*/
|
|
30
|
+
redeliverable: boolean;
|
|
31
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DeliveryOutcomeEnum } from '../enums/DeliveryOutcomeEnum';
|
|
2
|
+
import type { RedeliverySkipReasonEnum } from '../enums/RedeliverySkipReasonEnum';
|
|
3
|
+
|
|
4
|
+
/** Cómo terminó un destinatario dentro de un reenvío manual, uno por tag del comprador. */
|
|
5
|
+
export interface RedeliveredWebhookRecipient {
|
|
6
|
+
tag: string;
|
|
7
|
+
/** Desenlace vigente del destinatario, tal como quedó asentado en la bitácora. */
|
|
8
|
+
outcome: DeliveryOutcomeEnum;
|
|
9
|
+
/** Sólo cuando el evento NO volvió a salir a la red para este destinatario. */
|
|
10
|
+
skipReason?: RedeliverySkipReasonEnum;
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RedeliverySkipReasonEnum } from '../enums/RedeliverySkipReasonEnum';
|
|
2
|
+
|
|
3
|
+
/** Un pendiente que el lote no pudo encolar, con el motivo que lo explica. */
|
|
4
|
+
export interface SkippedWebhookRedelivery {
|
|
5
|
+
eventId: string;
|
|
6
|
+
reason: RedeliverySkipReasonEnum;
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Expose, Type } from 'class-transformer';
|
|
2
|
+
import { IsInt, IsISO8601, IsNotEmpty, IsOptional, IsPositive, IsString, MaxLength } from 'class-validator';
|
|
3
|
+
import { WEBHOOK_TAG_MAX_LENGTH } from '../../constants/WebhookFieldLimits';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Query de `GET /private/webhook-deliveries/pending` — lo que un suscriptor todavía no aceptó.
|
|
7
|
+
* Va contra el índice `pendingSubscriberTag-createdAt-index`, que sólo contiene lo pendiente.
|
|
8
|
+
*/
|
|
9
|
+
export class ListPendingWebhookDeliveriesRequest {
|
|
10
|
+
/** Tag del suscriptor, con el prefijo reservado `wh:`. */
|
|
11
|
+
@Expose()
|
|
12
|
+
@IsString()
|
|
13
|
+
@IsNotEmpty()
|
|
14
|
+
@MaxLength(WEBHOOK_TAG_MAX_LENGTH)
|
|
15
|
+
tag!: string;
|
|
16
|
+
|
|
17
|
+
/** Desde cuándo, por fecha del evento. Sin él la ventana arranca en el pendiente más viejo. */
|
|
18
|
+
@Expose()
|
|
19
|
+
@IsOptional()
|
|
20
|
+
@IsString()
|
|
21
|
+
@IsISO8601()
|
|
22
|
+
from?: string;
|
|
23
|
+
|
|
24
|
+
@Expose()
|
|
25
|
+
@IsOptional()
|
|
26
|
+
@IsString()
|
|
27
|
+
@IsISO8601()
|
|
28
|
+
to?: string;
|
|
29
|
+
|
|
30
|
+
/** Tope de filas de la página. El manager lo recorta a su máximo. */
|
|
31
|
+
@Expose()
|
|
32
|
+
@IsOptional()
|
|
33
|
+
@Type(() => Number)
|
|
34
|
+
@IsInt()
|
|
35
|
+
@IsPositive()
|
|
36
|
+
limit?: number;
|
|
37
|
+
|
|
38
|
+
/** Cursor opaco de la página anterior. Se manda tal cual vino, sin interpretarlo. */
|
|
39
|
+
@Expose()
|
|
40
|
+
@IsOptional()
|
|
41
|
+
@IsString()
|
|
42
|
+
@MaxLength(2048)
|
|
43
|
+
cursor?: string;
|
|
44
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Expose, Type } from 'class-transformer';
|
|
2
|
+
import { ArrayNotEmpty, IsArray, IsInt, IsISO8601, IsNotEmpty, IsOptional, IsPositive, IsString, MaxLength } from 'class-validator';
|
|
3
|
+
import { WEBHOOK_EVENT_ID_MAX_LENGTH, WEBHOOK_TAG_MAX_LENGTH } from '../../constants/WebhookFieldLimits';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Body de `POST /private/webhook-deliveries/redeliver-batch` — reenvío masivo de lo que un
|
|
7
|
+
* suscriptor todavía no aceptó. La selección sale siempre del índice de pendientes: un evento ya
|
|
8
|
+
* entregado no se puede reenviar por acá.
|
|
9
|
+
*/
|
|
10
|
+
export class RedeliverWebhookEventsBatchRequest {
|
|
11
|
+
@Expose()
|
|
12
|
+
@IsString()
|
|
13
|
+
@IsNotEmpty()
|
|
14
|
+
@MaxLength(WEBHOOK_TAG_MAX_LENGTH)
|
|
15
|
+
tag!: string;
|
|
16
|
+
|
|
17
|
+
/** Ventana por fecha del evento. Sin ella entra todo lo pendiente hasta el tope del lote. */
|
|
18
|
+
@Expose()
|
|
19
|
+
@IsOptional()
|
|
20
|
+
@IsString()
|
|
21
|
+
@IsISO8601()
|
|
22
|
+
from?: string;
|
|
23
|
+
|
|
24
|
+
@Expose()
|
|
25
|
+
@IsOptional()
|
|
26
|
+
@IsString()
|
|
27
|
+
@IsISO8601()
|
|
28
|
+
to?: string;
|
|
29
|
+
|
|
30
|
+
/** Recorte de la ventana a estos eventos. Los que no estén pendientes no entran. */
|
|
31
|
+
@Expose()
|
|
32
|
+
@IsOptional()
|
|
33
|
+
@IsArray()
|
|
34
|
+
@ArrayNotEmpty()
|
|
35
|
+
@IsString({ each: true })
|
|
36
|
+
@MaxLength(WEBHOOK_EVENT_ID_MAX_LENGTH, { each: true })
|
|
37
|
+
eventIds?: string[];
|
|
38
|
+
|
|
39
|
+
/** Cuántos pendientes encolar como mucho. El manager rechaza tipado si se pasa de su tope. */
|
|
40
|
+
@Expose()
|
|
41
|
+
@IsOptional()
|
|
42
|
+
@Type(() => Number)
|
|
43
|
+
@IsInt()
|
|
44
|
+
@IsPositive()
|
|
45
|
+
limit?: number;
|
|
46
|
+
|
|
47
|
+
/** Quién dispara el reenvío, para el log de la reposición. */
|
|
48
|
+
@Expose()
|
|
49
|
+
@IsOptional()
|
|
50
|
+
@IsString()
|
|
51
|
+
@MaxLength(128)
|
|
52
|
+
actor?: string;
|
|
53
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PendingWebhookDeliveryView } from '../PendingWebhookDeliveryView';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Respuesta de `GET /private/webhook-deliveries/pending`. Un suscriptor al día devuelve la lista
|
|
5
|
+
* vacía y no un 404: no deberle nada es el estado normal.
|
|
6
|
+
*/
|
|
7
|
+
export interface ListPendingWebhookDeliveriesResponse {
|
|
8
|
+
tag: string;
|
|
9
|
+
deliveries: PendingWebhookDeliveryView[];
|
|
10
|
+
count: number;
|
|
11
|
+
/** Cursor de la página siguiente. Ausente cuando no queda nada más pendiente. */
|
|
12
|
+
cursor?: string;
|
|
13
|
+
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import type { WebhookEventType } from '../../enums/WebhookEventType';
|
|
2
|
+
import type { RedeliveredWebhookRecipient } from '../RedeliveredWebhookRecipient';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
* Respuesta de `POST /private/webhook-deliveries/redeliver`.
|
|
5
|
-
*
|
|
5
|
+
* Respuesta de `POST /private/webhook-deliveries/redeliver`. El reenvío entrega en línea, así que
|
|
6
|
+
* dice qué pasó con cada destinatario: un 200 no significa por sí solo que el evento se repuso.
|
|
6
7
|
*/
|
|
7
8
|
export interface RedeliverWebhookEventResponse {
|
|
8
9
|
eventId: string;
|
|
9
10
|
eventType: WebhookEventType;
|
|
10
11
|
directoryId: string;
|
|
11
12
|
redeliveredAt: string;
|
|
13
|
+
/** Destinatarios que aceptaron el evento en este reenvío. En cero no se repuso nada. */
|
|
14
|
+
deliveredCount: number;
|
|
15
|
+
/** Uno por destinatario. Vacío significa que el comprador no tiene ningún tag `wh:*`. */
|
|
16
|
+
recipients: RedeliveredWebhookRecipient[];
|
|
12
17
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SkippedWebhookRedelivery } from '../SkippedWebhookRedelivery';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Respuesta de `POST /private/webhook-deliveries/redeliver-batch`. El lote se encola, así que
|
|
5
|
+
* devuelve cuántos se aceptaron y no cómo terminó cada destino: eso queda en la bitácora.
|
|
6
|
+
*/
|
|
7
|
+
export interface RedeliverWebhookEventsBatchResponse {
|
|
8
|
+
tag: string;
|
|
9
|
+
/** Pendientes que entraron en la selección, antes de descartar los que no se pueden reenviar. */
|
|
10
|
+
selectedCount: number;
|
|
11
|
+
/** Los que quedaron encolados. */
|
|
12
|
+
acceptedCount: number;
|
|
13
|
+
skipped: SkippedWebhookRedelivery[];
|
|
14
|
+
acceptedAt: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Por qué un evento no volvió a salir. El valor es el `code` que lo explica: los dos primeros son
|
|
3
|
+
* del error que dejó al evento fuera del lote; los demás, del destinatario que el reenvío no repuso.
|
|
4
|
+
*/
|
|
5
|
+
export enum RedeliverySkipReasonEnum {
|
|
6
|
+
/** El evento en bruto ya venció: sin payload no queda nada que reenviar. */
|
|
7
|
+
RAW_PAYLOAD_UNAVAILABLE = 'WEBHOOK_RAW_PAYLOAD_UNAVAILABLE',
|
|
8
|
+
/** El bruto guardado no cumple el contrato de su tipo y no puede salir sin normalizar. */
|
|
9
|
+
PAYLOAD_INVALID = 'WEBHOOK_PAYLOAD_INVALID',
|
|
10
|
+
/** El suscriptor ya había aceptado el evento. No se le repite nunca, ni a mano. */
|
|
11
|
+
ALREADY_DELIVERED = 'WEBHOOK_ALREADY_DELIVERED',
|
|
12
|
+
/** El tag existe pero nadie declaró un destino para ese tipo de evento. */
|
|
13
|
+
NO_SUBSCRIPTION = 'WEBHOOK_NO_SUBSCRIPTION',
|
|
14
|
+
/** El destino está dado de baja: es un no-op registrado, no un error. */
|
|
15
|
+
SUBSCRIPTION_INACTIVE = 'WEBHOOK_SUBSCRIPTION_INACTIVE',
|
|
16
|
+
/** La ronda de intentos del destino ya estaba agotada y este pase no abrió otra. */
|
|
17
|
+
DELIVERY_EXHAUSTED = 'WEBHOOK_DELIVERY_EXHAUSTED',
|
|
18
|
+
}
|
|
@@ -4,6 +4,7 @@ export * from './enums/ComplianceDecisionEnum';
|
|
|
4
4
|
export * from './enums/SubscriptionVisibilityEnum';
|
|
5
5
|
export * from './enums/SubscriptionStatusEnum';
|
|
6
6
|
export * from './enums/DeliveryOutcomeEnum';
|
|
7
|
+
export * from './enums/RedeliverySkipReasonEnum';
|
|
7
8
|
|
|
8
9
|
// Formatos y topes compartidos por los contratos
|
|
9
10
|
export * from './constants/CaseRefPattern';
|
|
@@ -20,6 +21,9 @@ export * from './dtos/WebhookOutboundMessage';
|
|
|
20
21
|
// Vistas del padrón y de la bitácora, tal como salen por la API de administración
|
|
21
22
|
export * from './dtos/WebhookSubscriptionView';
|
|
22
23
|
export * from './dtos/WebhookDeliveryView';
|
|
24
|
+
export * from './dtos/PendingWebhookDeliveryView';
|
|
25
|
+
export * from './dtos/SkippedWebhookRedelivery';
|
|
26
|
+
export * from './dtos/RedeliveredWebhookRecipient';
|
|
23
27
|
|
|
24
28
|
// API privada de administración — requests
|
|
25
29
|
export * from './dtos/requests/UpsertWebhookSubscriptionRequest';
|
|
@@ -27,6 +31,8 @@ export * from './dtos/requests/GetWebhookSubscriptionRequest';
|
|
|
27
31
|
export * from './dtos/requests/DeactivateWebhookSubscriptionRequest';
|
|
28
32
|
export * from './dtos/requests/ListWebhookDeliveriesRequest';
|
|
29
33
|
export * from './dtos/requests/RedeliverWebhookEventRequest';
|
|
34
|
+
export * from './dtos/requests/ListPendingWebhookDeliveriesRequest';
|
|
35
|
+
export * from './dtos/requests/RedeliverWebhookEventsBatchRequest';
|
|
30
36
|
|
|
31
37
|
// API privada de administración — responses
|
|
32
38
|
export * from './dtos/responses/UpsertWebhookSubscriptionResponse';
|
|
@@ -35,3 +41,5 @@ export * from './dtos/responses/ListWebhookSubscriptionsResponse';
|
|
|
35
41
|
export * from './dtos/responses/DeactivateWebhookSubscriptionResponse';
|
|
36
42
|
export * from './dtos/responses/ListWebhookDeliveriesResponse';
|
|
37
43
|
export * from './dtos/responses/RedeliverWebhookEventResponse';
|
|
44
|
+
export * from './dtos/responses/ListPendingWebhookDeliveriesResponse';
|
|
45
|
+
export * from './dtos/responses/RedeliverWebhookEventsBatchResponse';
|