@laburen/delta-sdk 1.1.1 → 1.5.0-canary.10
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 +84 -0
- package/README.md +32 -23
- package/dist/core/config.d.ts +12 -12
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +88 -88
- package/dist/core/config.js.map +1 -1
- package/dist/core/{constantes.d.ts → constants.d.ts} +3 -3
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/{constantes.js → constants.js} +3 -3
- package/dist/core/constants.js.map +1 -0
- package/dist/core/{contadores.d.ts → counters.d.ts} +12 -11
- package/dist/core/counters.d.ts.map +1 -0
- package/dist/core/counters.js +53 -0
- package/dist/core/counters.js.map +1 -0
- package/dist/core/{sobre.d.ts → envelope.d.ts} +17 -17
- package/dist/core/envelope.d.ts.map +1 -0
- package/dist/core/envelope.js +198 -0
- package/dist/core/envelope.js.map +1 -0
- package/dist/core/scrubbing.d.ts +4 -4
- package/dist/core/scrubbing.d.ts.map +1 -1
- package/dist/core/scrubbing.js +38 -38
- package/dist/core/scrubbing.js.map +1 -1
- package/dist/core/{sesion.d.ts → session.d.ts} +2 -2
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/{sesion.js → session.js} +2 -2
- package/dist/core/session.js.map +1 -0
- package/dist/core/{transporte.d.ts → transport.d.ts} +9 -9
- package/dist/core/transport.d.ts.map +1 -0
- package/dist/core/{transporte.js → transport.js} +15 -15
- package/dist/core/transport.js.map +1 -0
- package/dist/core/{tipos.d.ts → types.d.ts} +4 -4
- package/dist/core/{tipos.d.ts.map → types.d.ts.map} +1 -1
- package/dist/core/{tipos.js → types.js} +1 -1
- package/dist/core/{tipos.js.map → types.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/platform/client.d.ts +8 -0
- package/dist/platform/client.d.ts.map +1 -0
- package/dist/platform/client.js +30 -0
- package/dist/platform/client.js.map +1 -0
- package/dist/platform/core/errors.d.ts +150 -0
- package/dist/platform/core/errors.d.ts.map +1 -0
- package/dist/platform/core/errors.js +265 -0
- package/dist/platform/core/errors.js.map +1 -0
- package/dist/platform/core/oauth.d.ts +37 -0
- package/dist/platform/core/oauth.d.ts.map +1 -0
- package/dist/platform/core/oauth.js +144 -0
- package/dist/platform/core/oauth.js.map +1 -0
- package/dist/platform/core/pagination.d.ts +30 -0
- package/dist/platform/core/pagination.d.ts.map +1 -0
- package/dist/platform/core/pagination.js +44 -0
- package/dist/platform/core/pagination.js.map +1 -0
- package/dist/platform/core/request.d.ts +6 -0
- package/dist/platform/core/request.d.ts.map +1 -0
- package/dist/platform/core/request.js +24 -0
- package/dist/platform/core/request.js.map +1 -0
- package/dist/platform/core/send.d.ts +36 -0
- package/dist/platform/core/send.d.ts.map +1 -0
- package/dist/platform/core/send.js +171 -0
- package/dist/platform/core/send.js.map +1 -0
- package/dist/platform/core/sse.d.ts +8 -0
- package/dist/platform/core/sse.d.ts.map +1 -0
- package/dist/platform/core/sse.js +72 -0
- package/dist/platform/core/sse.js.map +1 -0
- package/dist/platform/core/stream.d.ts +21 -0
- package/dist/platform/core/stream.d.ts.map +1 -0
- package/dist/platform/core/stream.js +268 -0
- package/dist/platform/core/stream.js.map +1 -0
- package/dist/platform/generated/resources.d.ts +120 -0
- package/dist/platform/generated/resources.d.ts.map +1 -0
- package/dist/platform/generated/resources.js +65 -0
- package/dist/platform/generated/resources.js.map +1 -0
- package/dist/platform/generated/schemas.d.ts +78 -0
- package/dist/platform/generated/schemas.d.ts.map +1 -0
- package/dist/platform/generated/schemas.js +2 -0
- package/dist/platform/generated/schemas.js.map +1 -0
- package/dist/platform/generated/types.d.ts +5167 -0
- package/dist/platform/generated/types.d.ts.map +1 -0
- package/dist/platform/generated/types.js +6 -0
- package/dist/platform/generated/types.js.map +1 -0
- package/dist/platform/index.d.ts +9 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +7 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/telemetry/{captura.d.ts → capture.d.ts} +3 -3
- package/dist/telemetry/capture.d.ts.map +1 -0
- package/dist/telemetry/{captura.js → capture.js} +54 -54
- package/dist/telemetry/capture.js.map +1 -0
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/telemetry/index.js +1 -1
- package/dist/telemetry/{tipos.d.ts → types.d.ts} +2 -2
- package/dist/telemetry/types.d.ts.map +1 -0
- package/dist/telemetry/types.js +2 -0
- package/dist/telemetry/types.js.map +1 -0
- package/dist/telemetry/with-telemetry.d.ts +9 -9
- package/dist/telemetry/with-telemetry.d.ts.map +1 -1
- package/dist/telemetry/with-telemetry.js +36 -33
- package/dist/telemetry/with-telemetry.js.map +1 -1
- package/dist/telemetry/with-tool.d.ts +2 -2
- package/dist/telemetry/with-tool.d.ts.map +1 -1
- package/dist/telemetry/with-tool.js +3 -3
- package/dist/telemetry/with-tool.js.map +1 -1
- package/docs/empezar.md +35 -0
- package/docs/platform/guide.md +554 -0
- package/docs/superficies.md +1 -1
- package/docs/{telemetria.md → telemetry/guia.md} +52 -5
- package/docs/{que-se-manda.md → telemetry/que-se-manda.md} +14 -3
- package/docs/telemetry/troubleshooting.md +48 -0
- package/docs/troubleshooting.md +13 -46
- package/package.json +15 -5
- package/src/core/config.ts +81 -83
- package/src/core/{constantes.ts → constants.ts} +2 -2
- package/src/core/counters.ts +72 -0
- package/src/core/envelope.ts +234 -0
- package/src/core/scrubbing.ts +41 -41
- package/src/core/{sesion.ts → session.ts} +1 -1
- package/src/core/{transporte.ts → transport.ts} +20 -20
- package/src/core/{tipos.ts → types.ts} +3 -3
- package/src/index.ts +1 -1
- package/src/platform/client.ts +32 -0
- package/src/platform/core/errors.ts +348 -0
- package/src/platform/core/oauth.ts +201 -0
- package/src/platform/core/pagination.ts +67 -0
- package/src/platform/core/request.ts +27 -0
- package/src/platform/core/send.ts +212 -0
- package/src/platform/core/sse.ts +68 -0
- package/src/platform/core/stream.ts +314 -0
- package/src/platform/generated/resources.ts +192 -0
- package/src/platform/generated/schemas.ts +79 -0
- package/src/platform/generated/types.ts +5167 -0
- package/src/platform/index.ts +45 -0
- package/src/telemetry/{captura.ts → capture.ts} +57 -57
- package/src/telemetry/index.ts +2 -2
- package/src/telemetry/{tipos.ts → types.ts} +1 -1
- package/src/telemetry/with-telemetry.ts +56 -50
- package/src/telemetry/with-tool.ts +5 -5
- package/dist/core/constantes.d.ts.map +0 -1
- package/dist/core/constantes.js.map +0 -1
- package/dist/core/contadores.d.ts.map +0 -1
- package/dist/core/contadores.js +0 -53
- package/dist/core/contadores.js.map +0 -1
- package/dist/core/sesion.d.ts.map +0 -1
- package/dist/core/sesion.js.map +0 -1
- package/dist/core/sobre.d.ts.map +0 -1
- package/dist/core/sobre.js +0 -200
- package/dist/core/sobre.js.map +0 -1
- package/dist/core/transporte.d.ts.map +0 -1
- package/dist/core/transporte.js.map +0 -1
- package/dist/telemetry/captura.d.ts.map +0 -1
- package/dist/telemetry/captura.js.map +0 -1
- package/dist/telemetry/tipos.d.ts.map +0 -1
- package/dist/telemetry/tipos.js +0 -2
- package/dist/telemetry/tipos.js.map +0 -1
- package/src/core/contadores.ts +0 -71
- package/src/core/sobre.ts +0 -236
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,90 @@ Formato: [Keep a Changelog](https://keepachangelog.com/es-ES/1.1.0/).
|
|
|
4
4
|
El paquete es **additive-only**: se agregan funciones y campos opcionales, nunca se renombra ni se
|
|
5
5
|
saca nada. Un worker que se queda en una versión vieja sigue funcionando.
|
|
6
6
|
|
|
7
|
+
## [1.5.0] — 2026-11-05
|
|
8
|
+
|
|
9
|
+
La puerta `/platform` suma `agents.generate` y `agents.stream`: correr un turno de un agente. `generate` devuelve el JSON final; `stream` devuelve `{ chunks, result }` (`chunks` es un `AsyncIterable` de pedazos y `result` se resuelve con el `finish` y el texto completo). Tipos nuevos: `AgentStream`, `AgentRunChunk` y `AgentRunMetadata`. El timeout de estas dos rutas viene del contrato (630 s por intento). Ver `docs/platform/guide.md`, sección 8.
|
|
10
|
+
|
|
11
|
+
La puerta `/platform` suma las rutas de la etapa agregar: `models.list`, `me.get`, `knowledge.projects.list`, `mcp.connections.tools.list` y `meta.schemas.agentConfig`. Códigos de error nuevos: `base_version_mismatch` y `mcp_connection_name_taken`. En `config.knowledge`, `datastore_ids` se reemplazó por `project_ids`: el campo viejo se quitó del contrato, no solo se sumó el nuevo.
|
|
12
|
+
|
|
13
|
+
Cada item de `models.list` suma `capabilities.image_handling` (`native` o `described_as_text`) y `capabilities.pdf_handling` (`native`, `text_and_image_per_page` o `transcribed_to_text`): cómo le llega cada adjunto al modelo. `pricing.cache_write` se quitó del contrato.
|
|
14
|
+
|
|
15
|
+
La vista de versión del agente puede traer `warnings` (`mcp_tools_unverified`, con `connection_id`) y un filtro `tools` de una asignación MCP con un nombre desconocido devuelve 400 `invalid_request`.
|
|
16
|
+
|
|
17
|
+
El config del agente acepta `$schema` (string opcional); la API lo ignora y no lo guarda.
|
|
18
|
+
|
|
19
|
+
El contrato suma las reglas de tools y effort: `reasoning_effort` debe ser un nivel del modelo, las variantes de tool únicas (todas menos `http`) se marcan con `x-single: true`, y la tool `thinking` no va con un modelo que razona salvo con effort `off`.
|
|
20
|
+
|
|
21
|
+
## [1.4.0] — 2026-11-02
|
|
22
|
+
|
|
23
|
+
Nueva puerta `/platform`. No hay que hacer nada si no la usás.
|
|
24
|
+
|
|
25
|
+
`waitForDeviceToken` ya no corta ante un error de red o un timeout: espera 5 segundos más y vuelve a consultar hasta el vencimiento. La puerta exporta `DEFAULT_BASE_URL`.
|
|
26
|
+
|
|
27
|
+
## [1.3.1] — 2026-11-02
|
|
28
|
+
|
|
29
|
+
Cambio interno: nombres de código en inglés. No hay que hacer nada.
|
|
30
|
+
|
|
31
|
+
## [1.3.0] — 2026-08-05
|
|
32
|
+
|
|
33
|
+
Solo documentación. **El código no cambió**: si ya estás en `1.2.0`, actualizar es opcional. Es una
|
|
34
|
+
reestructuración de la documentación para que el paquete deje de leerse como "el paquete de
|
|
35
|
+
telemetría" y pase a leerse como lo que es: un paquete con **puertas** (`exports` map), hoy con una
|
|
36
|
+
sola (`/telemetry`) y la raíz preparada para sumar más de forma aditiva.
|
|
37
|
+
|
|
38
|
+
### Cambiado
|
|
39
|
+
|
|
40
|
+
- El README ya no arranca describiendo `/telemetry`: ahora presenta el paquete y sus puertas
|
|
41
|
+
primero, con una tabla que lista cada una y a dónde va. El quickstart de `/telemetry` (los tres
|
|
42
|
+
casos de uso) se queda en el README, igual que antes, solo que enmarcado como el quickstart de esa
|
|
43
|
+
puerta.
|
|
44
|
+
- Lo transversal a cualquier puerta (instalar, la API key como secret, el `ctx` original del
|
|
45
|
+
handler, qué puerta usar) se juntó en un archivo nuevo, corto: `docs/empezar.md`.
|
|
46
|
+
- `docs/troubleshooting.md` se dividió en dos: los síntomas que valen para cualquier puerta se
|
|
47
|
+
quedan ahí, y los propios de `/telemetry` (`413`, los dos límites del scrubbing, la semántica de
|
|
48
|
+
captura de un `catch` que devuelve un valor) se movieron a `docs/telemetry/troubleshooting.md`
|
|
49
|
+
(nuevo). Cada uno de los dos archivos funciona solo, con un puntero al otro.
|
|
50
|
+
- `docs/superficies.md` no se movió: sigue siendo compartido entre puertas.
|
|
51
|
+
|
|
52
|
+
### Hay que hacer algo
|
|
53
|
+
|
|
54
|
+
**Los paths de la documentación cambiaron.** Si tenías un link guardado o una lista de lectura
|
|
55
|
+
apuntando a los paths viejos, actualizala:
|
|
56
|
+
|
|
57
|
+
| Path viejo | Path nuevo |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `docs/telemetria.md` | `docs/telemetry/guia.md` |
|
|
60
|
+
| `docs/que-se-manda.md` | `docs/telemetry/que-se-manda.md` |
|
|
61
|
+
| `docs/troubleshooting.md` (síntomas de `413` y de scrubbing) | `docs/telemetry/troubleshooting.md` |
|
|
62
|
+
| `docs/troubleshooting.md` (el resto de los síntomas) | sigue en `docs/troubleshooting.md` |
|
|
63
|
+
| `docs/superficies.md` | sigue en `docs/superficies.md` |
|
|
64
|
+
| — | `docs/empezar.md` (nuevo) |
|
|
65
|
+
|
|
66
|
+
## [1.2.0] — 2026-08-05
|
|
67
|
+
|
|
68
|
+
`withTelemetry` ahora manda `context.work_unit` con el nombre del handler (`"fetch"`, `"queue"` o
|
|
69
|
+
`"scheduled"`) en la captura automática de lo que escapa de un handler envuelto. Antes ese campo
|
|
70
|
+
salía vacío; `withTool` ya lo mandaba con el nombre de la tool, y esto cierra la misma idea para el
|
|
71
|
+
otro wrapper.
|
|
72
|
+
|
|
73
|
+
### Agregado
|
|
74
|
+
|
|
75
|
+
- Un error que escapa de `fetch`, `queue` o `scheduled` —los tres handlers que envuelve
|
|
76
|
+
`withTelemetry`— ahora llega con `context.work_unit` igual al nombre del handler. En `queue`
|
|
77
|
+
convive con el bloque `retry` que ya se mandaba: los dos van en el mismo evento, ninguno pisa al
|
|
78
|
+
otro. Una captura manual hecha por el consumidor con su propio `workUnit` —con el cliente del
|
|
79
|
+
cuarto argumento, o dentro de un `catch` propio— sigue ganando: este default solo aplica a la
|
|
80
|
+
captura automática del wrapper.
|
|
81
|
+
|
|
82
|
+
### Hay que hacer algo
|
|
83
|
+
|
|
84
|
+
Si tenías una alerta o un dashboard armado sobre los eventos que reporta `withTelemetry` cuando
|
|
85
|
+
escapa un error de `fetch`, `queue` o `scheduled`, esos eventos van a **agrupar distinto** que
|
|
86
|
+
antes: la ingesta calcula el fingerprint a partir del evento completo, y sin `work_unit` todos los
|
|
87
|
+
escapes de un mismo worker caían en la misma bolsa. Con el campo puesto, cada entrypoint agrupa por
|
|
88
|
+
separado. Es una mejora, pero es un cambio observable — revisá esa alerta o ese dashboard después
|
|
89
|
+
de actualizar.
|
|
90
|
+
|
|
7
91
|
## [1.1.1] — 2026-08-04
|
|
8
92
|
|
|
9
93
|
Solo documentación. **El código no cambió**: si ya estás en `1.1.0`, actualizar es opcional.
|
package/README.md
CHANGED
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
# @laburen/delta-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Sirve para cualquier worker, MCP o workflow de Cloudflare.**
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
El paquete de Laburen para instrumentar workers de Cloudflare, sin dependencias de runtime. Está
|
|
6
|
+
organizado en **puertas**: cada una es un `import` distinto para un propósito distinto, todas
|
|
7
|
+
conviviendo en el mismo paquete.
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
npm i @laburen/delta-sdk
|
|
10
|
-
```
|
|
9
|
+
## Puertas
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
| Puerta | Para qué |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `@laburen/delta-sdk` | la raíz: solo los tipos compartidos entre puertas (`Envelope`, `Notify`, `Severity`, `Surface`, `TelemetryEvent`) — sin runtime |
|
|
14
|
+
| [`@laburen/delta-sdk/telemetry`](#telemetry) | le manda los errores y eventos de tu worker a la ingesta de telemetría (`telemetry.laburen.com`), que los guarda en D1 y avisa por Slack al canal del cliente |
|
|
15
|
+
| [`@laburen/delta-sdk/platform`](docs/platform/guide.md) | cliente tipado de la API de plataforma (`dashboard.laburen.com/api/platform/v1`): agentes, skills, conexiones MCP, tokens, modelos, `me` y proyectos de conocimiento, más el login por device code |
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
Instalar el paquete, la API key y el `ctx` son iguales para cualquier puerta: ver
|
|
18
|
+
[docs/empezar.md](docs/empezar.md).
|
|
19
|
+
|
|
20
|
+
## `telemetry`
|
|
21
|
+
|
|
22
|
+
Le manda los errores de tu worker a la ingesta de telemetría (`telemetry.laburen.com`), que los
|
|
23
|
+
guarda en D1 y avisa por Slack al canal del cliente.
|
|
17
24
|
|
|
18
|
-
|
|
25
|
+
### Lo que tenés que saber antes de empezar
|
|
19
26
|
|
|
20
27
|
- **`captureException` nunca lanza y no se puede `await`.** Un cliente de telemetría no puede
|
|
21
28
|
romper la app que observa.
|
|
22
29
|
- **No hay reintentos.** Si la ingesta está caída, el evento se descarta y se cuenta.
|
|
23
30
|
- **Los wrappers solo ven lo que ESCAPA de la función que envuelven.** Si tu `catch` loguea y
|
|
24
|
-
devuelve un valor, el wrapper no se entera. Ver [docs/
|
|
25
|
-
- **Pasale el `ctx` original del handler**, no una copia hecha con spread. Ver
|
|
26
|
-
[docs/troubleshooting.md](docs/troubleshooting.md).
|
|
31
|
+
devuelve un valor, el wrapper no se entera. Ver [docs/telemetry/guia.md](docs/telemetry/guia.md).
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
### Caso 1 — MCP en un Durable Object (el 80% del uso)
|
|
29
34
|
|
|
30
35
|
```ts
|
|
31
36
|
import { createTelemetry } from "@laburen/delta-sdk/telemetry";
|
|
@@ -73,9 +78,9 @@ export class MiAgenteMCP extends McpAgent<Env> {
|
|
|
73
78
|
> `fetch` que rutea hacia el Durable Object, el framework de MCP atrapa el error de la tool y lo
|
|
74
79
|
> convierte en un resultado con `isError: true` antes de que llegue ahí: envolver el `export default`
|
|
75
80
|
> no reportaría nada. Acá va `createTelemetry` + `withTool`, y nada más. Ver
|
|
76
|
-
> [docs/
|
|
81
|
+
> [docs/telemetry/guia.md](docs/telemetry/guia.md).
|
|
77
82
|
|
|
78
|
-
|
|
83
|
+
### Caso 2 — Worker plano, cola y cron
|
|
79
84
|
|
|
80
85
|
```ts
|
|
81
86
|
import { withTelemetry } from "@laburen/delta-sdk/telemetry";
|
|
@@ -101,12 +106,12 @@ La config **no lleva `surface`**: se deduce del nombre del handler, y pasarla no
|
|
|
101
106
|
|
|
102
107
|
**El cuarto argumento (`telemetry`) es el mismo cliente que usa el wrapper.** Un handler que
|
|
103
108
|
declara solo tres lo ignora y sigue andando igual; uno que lo declara puede usarlo en su propio
|
|
104
|
-
`catch` sin llamar a `createTelemetry` de nuevo. Ver [docs/
|
|
109
|
+
`catch` sin llamar a `createTelemetry` de nuevo. Ver [docs/telemetry/guia.md](docs/telemetry/guia.md).
|
|
105
110
|
|
|
106
111
|
> **Los nombres de las env var no están estandarizados entre proyectos.** Abrí tu `env.d.ts` antes
|
|
107
112
|
> de copiar los nombres: no asumas que son los mismos que en otro worker.
|
|
108
113
|
|
|
109
|
-
|
|
114
|
+
### Caso 3 — Un error que nunca fue una excepción
|
|
110
115
|
|
|
111
116
|
Es el caso más común en los repos que ya existen: `if (!res.ok) { log; return null }`. No hay nada
|
|
112
117
|
que pasarle a `captureException`, así que va `captureEvent`.
|
|
@@ -128,10 +133,14 @@ un grupo nuevo y el dedup de la ingesta no sirve.
|
|
|
128
133
|
|
|
129
134
|
| Archivo | Para qué |
|
|
130
135
|
|---|---|
|
|
131
|
-
| [docs/
|
|
132
|
-
| [docs/superficies.md](docs/superficies.md) | qué cambia entre worker, durable object, workflow, queue, alarm y cron |
|
|
133
|
-
| [docs/
|
|
134
|
-
| [docs/
|
|
136
|
+
| [docs/empezar.md](docs/empezar.md) | instalar, la API key, el `ctx`, y qué puerta usar — transversal a cualquier puerta |
|
|
137
|
+
| [docs/superficies.md](docs/superficies.md) | qué cambia entre worker, durable object, workflow, queue, alarm y cron — transversal a cualquier puerta |
|
|
138
|
+
| [docs/troubleshooting.md](docs/troubleshooting.md) | "no llega nada", error 1042, 401, "el worker no deploya" — síntomas compartidos por cualquier puerta |
|
|
139
|
+
| [docs/telemetry/guia.md](docs/telemetry/guia.md) | la guía larga de `/telemetry`: config campo por campo, `CaptureOptions`, scrubbing, `beforeSend` |
|
|
140
|
+
| [docs/telemetry/que-se-manda.md](docs/telemetry/que-se-manda.md) | el contrato de `/telemetry` en prosa, con un payload de ejemplo |
|
|
141
|
+
| [docs/telemetry/troubleshooting.md](docs/telemetry/troubleshooting.md) | síntomas propios de `/telemetry`: 413, los límites del scrubbing |
|
|
142
|
+
|
|
143
|
+
Para usar la API de plataforma desde la terminal, hay una CLI: `@laburen/delta-cli` (comando `laburen`).
|
|
135
144
|
|
|
136
145
|
El TypeScript real está en `node_modules/@laburen/delta-sdk/src/`: si algo no cierra, se lee.
|
|
137
146
|
|
package/dist/core/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Notify, type Surface, type TelemetryConfig, type TelemetryEvent } from "./
|
|
2
|
-
export interface
|
|
1
|
+
import { type Notify, type Surface, type TelemetryConfig, type TelemetryEvent } from "./types.js";
|
|
2
|
+
export interface ValidatedConfig {
|
|
3
3
|
service: {
|
|
4
4
|
name: string;
|
|
5
5
|
version?: string;
|
|
@@ -12,16 +12,16 @@ export interface ConfigValidada {
|
|
|
12
12
|
notify: Notify;
|
|
13
13
|
ingestUrl: string;
|
|
14
14
|
scrub: string[];
|
|
15
|
-
beforeSend?: (
|
|
15
|
+
beforeSend?: (event: TelemetryEvent) => TelemetryEvent | null;
|
|
16
16
|
debug: boolean;
|
|
17
17
|
queueMaxRetries?: number;
|
|
18
18
|
}
|
|
19
|
-
export type
|
|
19
|
+
export type ConfigResult = {
|
|
20
20
|
ok: true;
|
|
21
|
-
config:
|
|
21
|
+
config: ValidatedConfig;
|
|
22
22
|
} | {
|
|
23
23
|
ok: false;
|
|
24
|
-
|
|
24
|
+
missing: string[];
|
|
25
25
|
};
|
|
26
26
|
/** El motivo por el que `notify` no es usable, o `null` si lo es. Dos reglas, no una: (a) un canal
|
|
27
27
|
* DECLARADO (`enabled: true`) pero incompleto invalida TODA la config, aunque el otro canal esté
|
|
@@ -31,14 +31,14 @@ export type ResultadoConfig = {
|
|
|
31
31
|
* `notify` armado con un getter o un `Proxy` que lanza al leer sus propiedades cuenta como "no
|
|
32
32
|
* usable", no como una excepción que se escapa de `createTelemetry` — el SDK no lanza nunca, ni
|
|
33
33
|
* con el notify más raro. */
|
|
34
|
-
export declare function
|
|
35
|
-
/** Wrapper booleano de `
|
|
36
|
-
* `notify` sirve (el override por evento de `
|
|
37
|
-
export declare function
|
|
34
|
+
export declare function invalidNotifyReason(notify: unknown): string | null;
|
|
35
|
+
/** Wrapper booleano de `invalidNotifyReason`, para los callers que solo necesitan saber si el
|
|
36
|
+
* `notify` sirve (el override por evento de `capture.ts`) sin mostrar el motivo. */
|
|
37
|
+
export declare function usableNotify(notify: unknown): boolean;
|
|
38
38
|
/** Un `queueMaxRetries` usable es un entero ≥ 0: sale del `max_retries` del `wrangler.jsonc` vía
|
|
39
39
|
* una `var` del env, que siempre es `string` — `"2" + 1` da `"21"`, no `3`. */
|
|
40
|
-
export declare function queueMaxRetriesUsable(
|
|
40
|
+
export declare function queueMaxRetriesUsable(value: unknown): value is number;
|
|
41
41
|
/** Valida en runtime lo que el tipo no puede: un campo que llega vacío desde el env es un string
|
|
42
42
|
* válido para TypeScript, y significa que ese worker nunca va a reportar nada. */
|
|
43
|
-
export declare function
|
|
43
|
+
export declare function validate(input: TelemetryConfig): ConfigResult;
|
|
44
44
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,MAAM,EAEX,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,MAAM,EAEX,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,eAAe;IAC/B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAClE,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,cAAc,GAAG,IAAI,CAAC;IAC9D,KAAK,EAAE,OAAO,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAsEpG;;;;;;;8BAO8B;AAC9B,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAiBlE;AAED;qFACqF;AACrF,wBAAgB,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAErD;AAED;gFACgF;AAChF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAErE;AAED;mFACmF;AACnF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAyC7D"}
|
package/dist/core/config.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { INGEST_URL } from "./
|
|
2
|
-
import { SURFACES, } from "./
|
|
1
|
+
import { INGEST_URL } from "./constants.js";
|
|
2
|
+
import { SURFACES, } from "./types.js";
|
|
3
3
|
// Los `?.` no son paranoia: los valores salen del env del worker, y ahí TypeScript no manda.
|
|
4
|
-
function
|
|
5
|
-
return typeof
|
|
4
|
+
function empty(value) {
|
|
5
|
+
return typeof value !== "string" || value.trim() === "";
|
|
6
6
|
}
|
|
7
|
-
// Mismo criterio que `
|
|
7
|
+
// Mismo criterio que `textOf` en envelope.ts: un aviso no puede lanzar por describir el valor que
|
|
8
8
|
// está avisando. `JSON.stringify` no sabe serializar un `BigInt` (un `queueMaxRetries` armado con
|
|
9
9
|
// uno lo hace lanzar), así que cae a `String()` en vez de romper el aviso.
|
|
10
|
-
function
|
|
10
|
+
function describeValue(value) {
|
|
11
11
|
try {
|
|
12
|
-
return JSON.stringify(
|
|
12
|
+
return JSON.stringify(value) ?? String(value);
|
|
13
13
|
}
|
|
14
14
|
catch {
|
|
15
|
-
return String(
|
|
15
|
+
return String(value);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
// El mismo regex que aplica la ingesta: el contrato ya está duplicado a propósito, así que
|
|
@@ -20,56 +20,56 @@ function describirValor(valor) {
|
|
|
20
20
|
const SLACK_CHANNEL_ID = /^[CGD][A-Z0-9]{8,}$/;
|
|
21
21
|
// Objetos sueltos porque vienen de un `unknown` en runtime (env, fila de D1): no se puede confiar
|
|
22
22
|
// en que respeten el tipo `Notify` solo porque TypeScript los tipó así en el archivo del cliente.
|
|
23
|
-
// "
|
|
23
|
+
// "undeclared" es un canal AUSENTE (la clave `slack`/`email` no está, o `enabled` es `false`); un
|
|
24
24
|
// canal PRESENTE cuyo `enabled` es truthy pero no un booleano estricto (un `1` de una columna
|
|
25
25
|
// INTEGER de D1 usada como boolean, el mismo patrón que ya cita `emailPlausible` más abajo) es
|
|
26
|
-
// "
|
|
26
|
+
// "incomplete", no "undeclared": la ingesta valida `enabled` con un union discriminado entre los
|
|
27
27
|
// literales `true`/`false`, y cualquier otro valor le rompe el discriminante — `notify` sale crudo
|
|
28
28
|
// al sobre si el OTRO canal es válido, y la ingesta lo rechaza con "Invalid discriminator value"
|
|
29
29
|
// mientras el SDK cree que la config está sana.
|
|
30
|
-
function
|
|
30
|
+
function slackState(slack) {
|
|
31
31
|
if (typeof slack !== "object" || slack === null)
|
|
32
|
-
return "
|
|
33
|
-
const
|
|
34
|
-
if (typeof
|
|
35
|
-
return "
|
|
36
|
-
if (
|
|
37
|
-
return "
|
|
38
|
-
return typeof
|
|
39
|
-
? "
|
|
40
|
-
: "
|
|
32
|
+
return "undeclared";
|
|
33
|
+
const value = slack;
|
|
34
|
+
if (typeof value.enabled !== "boolean")
|
|
35
|
+
return "incomplete";
|
|
36
|
+
if (value.enabled === false)
|
|
37
|
+
return "undeclared";
|
|
38
|
+
return typeof value.channel === "string" && SLACK_CHANNEL_ID.test(value.channel)
|
|
39
|
+
? "complete"
|
|
40
|
+
: "incomplete";
|
|
41
41
|
}
|
|
42
42
|
/** Deliberadamente MÁS PERMISIVO que el `z.email()` de la ingesta (verificado con un fuzz test en
|
|
43
43
|
* `test/config.test.ts` que compara contra el Zod real): atrapa la basura obvia —sin `@`, con
|
|
44
44
|
* espacios o comas, sin un dominio con punto— y nada más. Quedar más estricto que la ingesta es
|
|
45
45
|
* peor que el 400 mudo que este archivo cierra: una dirección real rechazada acá manda TODO el
|
|
46
46
|
* worker a inerte, no solo ese evento. */
|
|
47
|
-
function emailPlausible(
|
|
48
|
-
if (typeof
|
|
47
|
+
function emailPlausible(value) {
|
|
48
|
+
if (typeof value !== "string" || value === "" || value.trim() !== value)
|
|
49
49
|
return false;
|
|
50
|
-
if (/\s/.test(
|
|
50
|
+
if (/\s/.test(value) || value.includes(","))
|
|
51
51
|
return false;
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
52
|
+
const atSign = value.indexOf("@");
|
|
53
|
+
if (atSign <= 0 || atSign !== value.lastIndexOf("@"))
|
|
54
54
|
return false;
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
55
|
+
const domain = value.slice(atSign + 1);
|
|
56
|
+
if (domain === "" || !domain.includes("."))
|
|
57
57
|
return false;
|
|
58
|
-
return !
|
|
58
|
+
return !domain.startsWith(".") && !domain.endsWith(".");
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function emailState(email) {
|
|
61
61
|
if (typeof email !== "object" || email === null)
|
|
62
|
-
return "
|
|
63
|
-
const
|
|
62
|
+
return "undeclared";
|
|
63
|
+
const value = email;
|
|
64
64
|
// Mismo criterio que `estadoSlack`: un `enabled` truthy pero no booleano estricto es
|
|
65
|
-
// "
|
|
66
|
-
if (typeof
|
|
67
|
-
return "
|
|
68
|
-
if (
|
|
69
|
-
return "
|
|
70
|
-
return Array.isArray(
|
|
71
|
-
? "
|
|
72
|
-
: "
|
|
65
|
+
// "incomplete", no "undeclared".
|
|
66
|
+
if (typeof value.enabled !== "boolean")
|
|
67
|
+
return "incomplete";
|
|
68
|
+
if (value.enabled === false)
|
|
69
|
+
return "undeclared";
|
|
70
|
+
return Array.isArray(value.to) && value.to.length > 0 && value.to.every(emailPlausible)
|
|
71
|
+
? "complete"
|
|
72
|
+
: "incomplete";
|
|
73
73
|
}
|
|
74
74
|
/** El motivo por el que `notify` no es usable, o `null` si lo es. Dos reglas, no una: (a) un canal
|
|
75
75
|
* DECLARADO (`enabled: true`) pero incompleto invalida TODA la config, aunque el otro canal esté
|
|
@@ -79,19 +79,19 @@ function estadoEmail(email) {
|
|
|
79
79
|
* `notify` armado con un getter o un `Proxy` que lanza al leer sus propiedades cuenta como "no
|
|
80
80
|
* usable", no como una excepción que se escapa de `createTelemetry` — el SDK no lanza nunca, ni
|
|
81
81
|
* con el notify más raro. */
|
|
82
|
-
export function
|
|
82
|
+
export function invalidNotifyReason(notify) {
|
|
83
83
|
try {
|
|
84
84
|
if (typeof notify !== "object" || notify === null) {
|
|
85
85
|
return "notify (revisá slack.channel / email.to)";
|
|
86
86
|
}
|
|
87
|
-
const
|
|
88
|
-
const slack =
|
|
89
|
-
const email =
|
|
90
|
-
if (slack === "
|
|
87
|
+
const value = notify;
|
|
88
|
+
const slack = slackState(value.slack);
|
|
89
|
+
const email = emailState(value.email);
|
|
90
|
+
if (slack === "incomplete")
|
|
91
91
|
return "notify: slack.channel declarado pero vacío o mal formado";
|
|
92
|
-
if (email === "
|
|
92
|
+
if (email === "incomplete")
|
|
93
93
|
return "notify: email.to declarado pero vacío o mal formado";
|
|
94
|
-
if (slack !== "
|
|
94
|
+
if (slack !== "complete" && email !== "complete") {
|
|
95
95
|
return "notify (revisá slack.channel / email.to)";
|
|
96
96
|
}
|
|
97
97
|
return null;
|
|
@@ -100,62 +100,62 @@ export function motivoNotifyInvalido(notify) {
|
|
|
100
100
|
return "notify (no se pudo leer: revisá slack.channel / email.to)";
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
/** Wrapper booleano de `
|
|
104
|
-
* `notify` sirve (el override por evento de `
|
|
105
|
-
export function
|
|
106
|
-
return
|
|
103
|
+
/** Wrapper booleano de `invalidNotifyReason`, para los callers que solo necesitan saber si el
|
|
104
|
+
* `notify` sirve (el override por evento de `capture.ts`) sin mostrar el motivo. */
|
|
105
|
+
export function usableNotify(notify) {
|
|
106
|
+
return invalidNotifyReason(notify) === null;
|
|
107
107
|
}
|
|
108
108
|
/** Un `queueMaxRetries` usable es un entero ≥ 0: sale del `max_retries` del `wrangler.jsonc` vía
|
|
109
109
|
* una `var` del env, que siempre es `string` — `"2" + 1` da `"21"`, no `3`. */
|
|
110
|
-
export function queueMaxRetriesUsable(
|
|
111
|
-
return typeof
|
|
110
|
+
export function queueMaxRetriesUsable(value) {
|
|
111
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
112
112
|
}
|
|
113
113
|
/** Valida en runtime lo que el tipo no puede: un campo que llega vacío desde el env es un string
|
|
114
114
|
* válido para TypeScript, y significa que ese worker nunca va a reportar nada. */
|
|
115
|
-
export function
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
if (!SURFACES.includes(
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
|
|
130
|
-
if (
|
|
131
|
-
return { ok: false,
|
|
132
|
-
const service = { name:
|
|
133
|
-
if (
|
|
134
|
-
service.version =
|
|
135
|
-
if (
|
|
136
|
-
service.environment =
|
|
115
|
+
export function validate(input) {
|
|
116
|
+
const missing = [];
|
|
117
|
+
if (empty(input.service?.name))
|
|
118
|
+
missing.push("service.name");
|
|
119
|
+
if (empty(input.organizationId))
|
|
120
|
+
missing.push("organizationId");
|
|
121
|
+
if (empty(input.agentId))
|
|
122
|
+
missing.push("agentId");
|
|
123
|
+
if (empty(input.apiKey))
|
|
124
|
+
missing.push("apiKey");
|
|
125
|
+
if (!SURFACES.includes(input.surface))
|
|
126
|
+
missing.push("surface");
|
|
127
|
+
const notifyReason = invalidNotifyReason(input.notify);
|
|
128
|
+
if (notifyReason !== null)
|
|
129
|
+
missing.push(notifyReason);
|
|
130
|
+
if (missing.length > 0)
|
|
131
|
+
return { ok: false, missing };
|
|
132
|
+
const service = { name: input.service.name.trim() };
|
|
133
|
+
if (input.service.version !== undefined)
|
|
134
|
+
service.version = input.service.version;
|
|
135
|
+
if (input.service.environment !== undefined)
|
|
136
|
+
service.environment = input.service.environment;
|
|
137
137
|
const config = {
|
|
138
138
|
service,
|
|
139
|
-
surface:
|
|
140
|
-
organizationId:
|
|
141
|
-
agentId:
|
|
142
|
-
apiKey:
|
|
143
|
-
notify:
|
|
139
|
+
surface: input.surface,
|
|
140
|
+
organizationId: input.organizationId.trim(),
|
|
141
|
+
agentId: input.agentId.trim(),
|
|
142
|
+
apiKey: input.apiKey.trim(),
|
|
143
|
+
notify: input.notify,
|
|
144
144
|
// La URL es constante del paquete; el override existe solo para desarrollo local.
|
|
145
|
-
ingestUrl:
|
|
146
|
-
scrub:
|
|
147
|
-
debug:
|
|
145
|
+
ingestUrl: input.ingestUrl?.trim() || INGEST_URL,
|
|
146
|
+
scrub: input.scrub ?? [],
|
|
147
|
+
debug: input.debug ?? false,
|
|
148
148
|
};
|
|
149
|
-
if (
|
|
150
|
-
config.beforeSend =
|
|
151
|
-
if (
|
|
152
|
-
if (queueMaxRetriesUsable(
|
|
153
|
-
config.queueMaxRetries =
|
|
149
|
+
if (input.beforeSend !== undefined)
|
|
150
|
+
config.beforeSend = input.beforeSend;
|
|
151
|
+
if (input.queueMaxRetries !== undefined) {
|
|
152
|
+
if (queueMaxRetriesUsable(input.queueMaxRetries)) {
|
|
153
|
+
config.queueMaxRetries = input.queueMaxRetries;
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
156
|
// Se descarta y no se suma a `faltan`: a diferencia de los seis obligatorios, sin este
|
|
157
157
|
// dato el cliente sigue reportando — solo se omite `retry.limit` en surface "queue".
|
|
158
|
-
console.error(`[delta-sdk] queueMaxRetries inválido (se esperaba un entero ≥ 0, llegó ${
|
|
158
|
+
console.error(`[delta-sdk] queueMaxRetries inválido (se esperaba un entero ≥ 0, llegó ${describeValue(input.queueMaxRetries)}): se ignora`);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
return { ok: true, config };
|
package/dist/core/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAEN,QAAQ,GAIR,MAAM,YAAY,CAAC;AAkBpB,6FAA6F;AAC7F,SAAS,KAAK,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;AACzD,CAAC;AAED,kGAAkG;AAClG,kGAAkG;AAClG,2EAA2E;AAC3E,SAAS,aAAa,CAAC,KAAc;IACpC,IAAI,CAAC;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC;AACF,CAAC;AAED,2FAA2F;AAC3F,6BAA6B;AAC7B,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AA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K,CAAC,eAAe,CAAC,cAAc,CAC5H,CAAC;QACH,CAAC;IACF,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
export declare const INGEST_URL = "https://telemetry.laburen.com/events";
|
|
4
4
|
export declare const SDK_NAME = "@laburen/delta-sdk";
|
|
5
5
|
/** Tiene que coincidir con `version` del package.json; lo verifica `npm run version:check`. */
|
|
6
|
-
export declare const SDK_VERSION = "1.
|
|
6
|
+
export declare const SDK_VERSION = "1.5.0-canary.10";
|
|
7
7
|
/** Los mismos topes que aplica la ingesta. El cliente los aplica para no perder el sobre entero;
|
|
8
8
|
* la ingesta, para no confiar en el cliente. */
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const LIMITS: {
|
|
10
10
|
readonly stacktraceChars: number;
|
|
11
11
|
readonly messageChars: number;
|
|
12
12
|
readonly attributeKeys: 64;
|
|
13
13
|
readonly bodyBytes: number;
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA;8DAC8D;AAC9D,eAAO,MAAM,UAAU,yCAAyC,CAAC;AAEjE,eAAO,MAAM,QAAQ,uBAAuB,CAAC;AAE7C,+FAA+F;AAC/F,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAE7C;iDACiD;AACjD,eAAO,MAAM,MAAM;;;;;CAKT,CAAC"}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
export const INGEST_URL = "https://telemetry.laburen.com/events";
|
|
4
4
|
export const SDK_NAME = "@laburen/delta-sdk";
|
|
5
5
|
/** Tiene que coincidir con `version` del package.json; lo verifica `npm run version:check`. */
|
|
6
|
-
export const SDK_VERSION = "1.
|
|
6
|
+
export const SDK_VERSION = "1.5.0-canary.10";
|
|
7
7
|
/** Los mismos topes que aplica la ingesta. El cliente los aplica para no perder el sobre entero;
|
|
8
8
|
* la ingesta, para no confiar en el cliente. */
|
|
9
|
-
export const
|
|
9
|
+
export const LIMITS = {
|
|
10
10
|
stacktraceChars: 8 * 1024,
|
|
11
11
|
messageChars: 2 * 1024,
|
|
12
12
|
attributeKeys: 64,
|
|
13
13
|
bodyBytes: 512 * 1024,
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA;8DAC8D;AAC9D,MAAM,CAAC,MAAM,UAAU,GAAG,sCAAsC,CAAC;AAEjE,MAAM,CAAC,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AAE7C,+FAA+F;AAC/F,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAC;AAE7C;iDACiD;AACjD,MAAM,CAAC,MAAM,MAAM,GAAG;IACrB,eAAe,EAAE,CAAC,GAAG,IAAI;IACzB,YAAY,EAAE,CAAC,GAAG,IAAI;IACtB,aAAa,EAAE,EAAE;IACjB,SAAS,EAAE,GAAG,GAAG,IAAI;CACZ,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/** Lo que viaja en el campo `drops` del sobre.
|
|
1
|
+
/** Lo que viaja en el campo `drops` del sobre. Estas claves SON el contrato de cable con la ingesta
|
|
2
|
+
* (se serializan tal cual) y quedan en español a propósito. La ingesta lo acepta como
|
|
2
3
|
* `z.record(z.string(), z.number())`, así que las claves son libres; `before_send` conserva la
|
|
3
4
|
* grafía canónica de Sentry para las razones de drop. */
|
|
4
5
|
export interface Drops {
|
|
@@ -9,20 +10,20 @@ export interface Drops {
|
|
|
9
10
|
internos: number;
|
|
10
11
|
}
|
|
11
12
|
/** Veces que el código pidió enviar. */
|
|
12
|
-
export declare function
|
|
13
|
+
export declare function countFired(): void;
|
|
13
14
|
/** Envíos que terminaron, con cualquier status: un 429 y un 503 salieron y los rechazaron. */
|
|
14
|
-
export declare function
|
|
15
|
+
export declare function countCompleted(): void;
|
|
15
16
|
/** Envíos que lanzaron: red, DNS. */
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
19
|
-
/** La quinta forma de perder un evento: algo entre `
|
|
20
|
-
* red del `catch` de `
|
|
17
|
+
export declare function countFailed(): void;
|
|
18
|
+
export declare function countBeforeSend(): void;
|
|
19
|
+
export declare function countTrimmed(): void;
|
|
20
|
+
/** La quinta forma de perder un evento: algo entre `buildEvent` y `serializeCapped` lanzó, y la
|
|
21
|
+
* red del `catch` de `capture` lo atrapó. Sin este contador, ese evento desaparecía sin dejar
|
|
21
22
|
* rastro en ningún `drops` del sobre siguiente. */
|
|
22
|
-
export declare function
|
|
23
|
+
export declare function countInternal(): void;
|
|
23
24
|
/** `incompletos` es la resta, y es el único contador que prueba pérdida por ciclo de vida: sin
|
|
24
25
|
* esta separación, un 429 por rate limit y "se perdió el evento" se ven idénticos. */
|
|
25
26
|
export declare function drops(): Drops;
|
|
26
27
|
/** Solo para los tests. No sale por ninguna puerta del `exports` map. */
|
|
27
|
-
export declare function
|
|
28
|
-
//# sourceMappingURL=
|
|
28
|
+
export declare function resetCounters(): void;
|
|
29
|
+
//# sourceMappingURL=counters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"counters.d.ts","sourceRoot":"","sources":["../../src/core/counters.ts"],"names":[],"mappings":"AAAA;;;0DAG0D;AAC1D,MAAM,WAAW,KAAK;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CACjB;AAWD,wCAAwC;AACxC,wBAAgB,UAAU,IAAI,IAAI,CAEjC;AAED,8FAA8F;AAC9F,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAED,qCAAqC;AACrC,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED;;oDAEoD;AACpD,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED;uFACuF;AACvF,wBAAgB,KAAK,IAAI,KAAK,CAQ7B;AAED,yEAAyE;AACzE,wBAAgB,aAAa,IAAI,IAAI,CAOpC"}
|