@neetru/sdk 3.8.0 → 3.8.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/ai.cjs +1 -1
  3. package/dist/ai.d.cts +1 -1
  4. package/dist/ai.d.ts +1 -1
  5. package/dist/ai.mjs +1 -1
  6. package/dist/auth.cjs +708 -688
  7. package/dist/auth.d.cts +1 -1
  8. package/dist/auth.d.ts +1 -1
  9. package/dist/auth.mjs +705 -685
  10. package/dist/catalog.cjs +1 -1
  11. package/dist/catalog.d.cts +1 -1
  12. package/dist/catalog.d.ts +1 -1
  13. package/dist/catalog.mjs +1 -1
  14. package/dist/checkout.cjs +1 -1
  15. package/dist/checkout.d.cts +1 -1
  16. package/dist/checkout.d.ts +1 -1
  17. package/dist/checkout.mjs +1 -1
  18. package/dist/db-react.d.cts +1 -1
  19. package/dist/db-react.d.ts +1 -1
  20. package/dist/db.cjs +242 -222
  21. package/dist/db.d.cts +1 -1
  22. package/dist/db.d.ts +1 -1
  23. package/dist/db.mjs +263 -243
  24. package/dist/entitlements.d.cts +1 -1
  25. package/dist/entitlements.d.ts +1 -1
  26. package/dist/firestore-compat.d.cts +1 -1
  27. package/dist/firestore-compat.d.ts +1 -1
  28. package/dist/index.cjs +730 -710
  29. package/dist/index.d.cts +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.mjs +874 -854
  32. package/dist/mobile.d.cts +1 -1
  33. package/dist/mobile.d.ts +1 -1
  34. package/dist/mocks.d.cts +1 -1
  35. package/dist/mocks.d.ts +1 -1
  36. package/dist/notifications.cjs +1 -1
  37. package/dist/notifications.d.cts +1 -1
  38. package/dist/notifications.d.ts +1 -1
  39. package/dist/notifications.mjs +1 -1
  40. package/dist/react.d.cts +1 -1
  41. package/dist/react.d.ts +1 -1
  42. package/dist/support.cjs +1 -1
  43. package/dist/support.d.cts +1 -1
  44. package/dist/support.d.ts +1 -1
  45. package/dist/support.mjs +1 -1
  46. package/dist/telemetry.cjs +1 -1
  47. package/dist/telemetry.d.cts +1 -1
  48. package/dist/telemetry.d.ts +1 -1
  49. package/dist/telemetry.mjs +1 -1
  50. package/dist/{types-bVztFQTI.d.ts → types-BYPk_3HR.d.ts} +56 -16
  51. package/dist/{types-D-9bjlM0.d.cts → types-yv3EDKg2.d.cts} +56 -16
  52. package/dist/usage.cjs +1 -1
  53. package/dist/usage.d.cts +1 -1
  54. package/dist/usage.d.ts +1 -1
  55. package/dist/usage.mjs +1 -1
  56. package/dist/webhooks.cjs +1 -1
  57. package/dist/webhooks.d.cts +1 -1
  58. package/dist/webhooks.d.ts +1 -1
  59. package/dist/webhooks.mjs +1 -1
  60. package/package.json +1 -1
package/dist/mobile.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Y as NeetruClientConfig, v as CompleteSignInResult, a6 as NeetruUser, m as AuthStateListener } from './types-D-9bjlM0.cjs';
1
+ import { Y as NeetruClientConfig, v as CompleteSignInResult, a6 as NeetruUser, m as AuthStateListener } from './types-yv3EDKg2.cjs';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.cjs';
4
4
 
package/dist/mobile.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Y as NeetruClientConfig, v as CompleteSignInResult, a6 as NeetruUser, m as AuthStateListener } from './types-bVztFQTI.js';
1
+ import { Y as NeetruClientConfig, v as CompleteSignInResult, a6 as NeetruUser, m as AuthStateListener } from './types-BYPk_3HR.js';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.js';
4
4
 
package/dist/mocks.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a6 as NeetruUser, g as AiNamespace, b as AiChatOptions, c as AiChatResult, i as AiStreamHandle, l as AuthNamespace, ak as SignInOptions, m as AuthStateListener, af as RedirectCallbackResult, v as CompleteSignInResult, Z as NeetruDb, E as DbCollectionRef, a5 as NeetruSqlClient, ar as SyncState, aw as Unsubscribe, w as ConflictRecord, P as EntitlementCheck, am as SupportNamespace, y as CreateTicketInput, ap as SupportTicket, ay as UsageNamespace, az as UsageQuota } from './types-D-9bjlM0.cjs';
1
+ import { a6 as NeetruUser, g as AiNamespace, b as AiChatOptions, c as AiChatResult, i as AiStreamHandle, l as AuthNamespace, ak as SignInOptions, m as AuthStateListener, af as RedirectCallbackResult, v as CompleteSignInResult, Z as NeetruDb, E as DbCollectionRef, a5 as NeetruSqlClient, ar as SyncState, aw as Unsubscribe, w as ConflictRecord, P as EntitlementCheck, am as SupportNamespace, y as CreateTicketInput, ap as SupportTicket, ay as UsageNamespace, az as UsageQuota } from './types-yv3EDKg2.cjs';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.cjs';
4
4
 
package/dist/mocks.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a6 as NeetruUser, g as AiNamespace, b as AiChatOptions, c as AiChatResult, i as AiStreamHandle, l as AuthNamespace, ak as SignInOptions, m as AuthStateListener, af as RedirectCallbackResult, v as CompleteSignInResult, Z as NeetruDb, E as DbCollectionRef, a5 as NeetruSqlClient, ar as SyncState, aw as Unsubscribe, w as ConflictRecord, P as EntitlementCheck, am as SupportNamespace, y as CreateTicketInput, ap as SupportTicket, ay as UsageNamespace, az as UsageQuota } from './types-bVztFQTI.js';
1
+ import { a6 as NeetruUser, g as AiNamespace, b as AiChatOptions, c as AiChatResult, i as AiStreamHandle, l as AuthNamespace, ak as SignInOptions, m as AuthStateListener, af as RedirectCallbackResult, v as CompleteSignInResult, Z as NeetruDb, E as DbCollectionRef, a5 as NeetruSqlClient, ar as SyncState, aw as Unsubscribe, w as ConflictRecord, P as EntitlementCheck, am as SupportNamespace, y as CreateTicketInput, ap as SupportTicket, ay as UsageNamespace, az as UsageQuota } from './types-BYPk_3HR.js';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.js';
4
4
 
@@ -108,7 +108,7 @@ function Y(t, e) {
108
108
  }
109
109
  function q() {
110
110
  try {
111
- return "3.8.0";
111
+ return "3.8.1";
112
112
  } catch {
113
113
  return;
114
114
  }
@@ -1,3 +1,3 @@
1
- export { S as ListNotificationsOptions, U as MockNotifications, a7 as NotificationScopeOptions, a8 as NotificationsNamespace, aa as ProductNotification, ab as ProductNotificationSeverity, ai as SendNotificationInput, aN as createNotificationsNamespace } from './types-D-9bjlM0.cjs';
1
+ export { S as ListNotificationsOptions, U as MockNotifications, a7 as NotificationScopeOptions, a8 as NotificationsNamespace, aa as ProductNotification, ab as ProductNotificationSeverity, ai as SendNotificationInput, aN as createNotificationsNamespace } from './types-yv3EDKg2.cjs';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.cjs';
@@ -1,3 +1,3 @@
1
- export { S as ListNotificationsOptions, U as MockNotifications, a7 as NotificationScopeOptions, a8 as NotificationsNamespace, aa as ProductNotification, ab as ProductNotificationSeverity, ai as SendNotificationInput, aN as createNotificationsNamespace } from './types-bVztFQTI.js';
1
+ export { S as ListNotificationsOptions, U as MockNotifications, a7 as NotificationScopeOptions, a8 as NotificationsNamespace, aa as ProductNotification, ab as ProductNotificationSeverity, ai as SendNotificationInput, aN as createNotificationsNamespace } from './types-BYPk_3HR.js';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.js';
@@ -106,7 +106,7 @@ function Y(t, e) {
106
106
  }
107
107
  function q() {
108
108
  try {
109
- return "3.8.0";
109
+ return "3.8.1";
110
110
  } catch {
111
111
  return;
112
112
  }
package/dist/react.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { X as NeetruClient, t as CheckoutStartResult, l as AuthNamespace, a6 as NeetruUser } from './types-D-9bjlM0.cjs';
2
+ import { X as NeetruClient, t as CheckoutStartResult, l as AuthNamespace, a6 as NeetruUser } from './types-yv3EDKg2.cjs';
3
3
  import { CollectionReference, Query, DocumentReference } from './firestore-compat.cjs';
4
4
  import 'drizzle-orm/node-postgres';
5
5
  import './errors.cjs';
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { X as NeetruClient, t as CheckoutStartResult, l as AuthNamespace, a6 as NeetruUser } from './types-bVztFQTI.js';
2
+ import { X as NeetruClient, t as CheckoutStartResult, l as AuthNamespace, a6 as NeetruUser } from './types-BYPk_3HR.js';
3
3
  import { CollectionReference, Query, DocumentReference } from './firestore-compat.js';
4
4
  import 'drizzle-orm/node-postgres';
5
5
  import './errors.js';
package/dist/support.cjs CHANGED
@@ -112,7 +112,7 @@ function Q(e, t) {
112
112
  }
113
113
  function $() {
114
114
  try {
115
- return "3.8.0";
115
+ return "3.8.1";
116
116
  } catch {
117
117
  return;
118
118
  }
@@ -1,4 +1,4 @@
1
- import { ah as ResolvedConfig, am as SupportNamespace } from './types-D-9bjlM0.cjs';
1
+ import { ah as ResolvedConfig, am as SupportNamespace } from './types-yv3EDKg2.cjs';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.cjs';
4
4
 
package/dist/support.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ah as ResolvedConfig, am as SupportNamespace } from './types-bVztFQTI.js';
1
+ import { ah as ResolvedConfig, am as SupportNamespace } from './types-BYPk_3HR.js';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.js';
4
4
 
package/dist/support.mjs CHANGED
@@ -110,7 +110,7 @@ function Q(e, t) {
110
110
  }
111
111
  function $() {
112
112
  try {
113
- return "3.8.0";
113
+ return "3.8.1";
114
114
  } catch {
115
115
  return;
116
116
  }
@@ -108,7 +108,7 @@ function V(e, t) {
108
108
  }
109
109
  function L() {
110
110
  try {
111
- return "3.8.0";
111
+ return "3.8.1";
112
112
  } catch {
113
113
  return;
114
114
  }
@@ -1,4 +1,4 @@
1
- import { ah as ResolvedConfig, at as TelemetryEventInput, as as TelemetryEventAck, av as TelemetryLogInput, au as TelemetryLogAck } from './types-D-9bjlM0.cjs';
1
+ import { ah as ResolvedConfig, at as TelemetryEventInput, as as TelemetryEventAck, av as TelemetryLogInput, au as TelemetryLogAck } from './types-yv3EDKg2.cjs';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.cjs';
4
4
 
@@ -1,4 +1,4 @@
1
- import { ah as ResolvedConfig, at as TelemetryEventInput, as as TelemetryEventAck, av as TelemetryLogInput, au as TelemetryLogAck } from './types-bVztFQTI.js';
1
+ import { ah as ResolvedConfig, at as TelemetryEventInput, as as TelemetryEventAck, av as TelemetryLogInput, au as TelemetryLogAck } from './types-BYPk_3HR.js';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.js';
4
4
 
@@ -106,7 +106,7 @@ function V(e, t) {
106
106
  }
107
107
  function L() {
108
108
  try {
109
- return "3.8.0";
109
+ return "3.8.1";
110
110
  } catch {
111
111
  return;
112
112
  }
@@ -1412,9 +1412,42 @@ interface RealtimeClientOptions {
1412
1412
  * Alinhado com `DbSqlLease` do Core (`src/lib/db/lease/types.ts`).
1413
1413
  *
1414
1414
  * - `port` sempre 5433 — o lease aponta pro PgBouncer, nunca à porta crua.
1415
- * - `credentialVersion` — bump indica rotação; o `SqlLeaseManager` reabre
1416
- * o pool ao detectar versão diferente.
1415
+ * - `credentialVersion` — hoje é um placeholder fixo do Core (ver o campo).
1417
1416
  * - `expiresAt` — ISO string; o SDK renova aos ~80% do TTL (12 min em TTL=15 min).
1417
+ *
1418
+ * ── TLS / mTLS (estado real) ───────────────────────────────────────────────
1419
+ *
1420
+ * **O mTLS de cliente ESTÁ ativo.** O Core emite os três materiais em TODO
1421
+ * lease SQL (emissão e renovação — `buildLease`, ramo `sql`, em
1422
+ * `src/lib/db/lease/issuer-core.ts` do Core):
1423
+ * - `sslca` — a CA interna do Core (secret `coredb_ca_cert`). A MESMA CA
1424
+ * assina o cert do servidor PgBouncer (365 dias) e os certs de cliente.
1425
+ * - `clientCert` — X.509 de cliente emitido por lease: CN = `leaseId`, EKU
1426
+ * `clientAuth`, validade = TTL do lease (15 min).
1427
+ * - `clientKey` — chave EC P-256 efêmera, nova a cada emissão/renovação.
1428
+ * Não há flag que desligue isso: sem a CA no Secret Manager a emissão FALHA
1429
+ * (HTTP 500), em vez de devolver esses campos `null`.
1430
+ *
1431
+ * O SDK usa os três ao abrir o `pg.Pool` (`createPgPool` e o `createPool` de
1432
+ * `createSqlClientFromConfig`): com `sslca` presente, `ssl = { ca: sslca,
1433
+ * cert: clientCert, key: clientKey, rejectUnauthorized: true }` — verifica o
1434
+ * servidor (CA + hostname) E apresenta o cert de cliente.
1435
+ *
1436
+ * Do lado da VM, o PgBouncer roda com `client_tls_sslmode = verify-full` e
1437
+ * `client_tls_ca_file` = CA do Core (agente, `src/handlers/db-pgbouncer.ts`):
1438
+ * EXIGE cert de cliente válido. E `auth_type = scram-sha-256` — a conexão
1439
+ * precisa do cert E da senha do lease (o CN não é comparado ao usuário).
1440
+ *
1441
+ * Consequências práticas:
1442
+ * - o cert de cliente expira junto com o lease (~15 min). Pool que não troca
1443
+ * de lease passa a levar `certificate expired` (alerta TLS 45 enviado pelo
1444
+ * PgBouncer) — é o que a renovação proativa (`lease.ts`) e o re-lease
1445
+ * reativo (`resilient-pool.ts`) curam;
1446
+ * - se o install da VM não obteve a CA/assinatura, o Core configura o
1447
+ * PgBouncer SEM TLS (fail-open, com aviso no log). Como o SDK sempre liga
1448
+ * TLS quando o lease traz `sslca`, a conexão falha com "The server does
1449
+ * not support SSL connections" — o conserto é reconfigurar o PgBouncer com
1450
+ * TLS, não desligar TLS no SDK.
1418
1451
  */
1419
1452
  interface DbSqlLease {
1420
1453
  leaseId: string;
@@ -1425,31 +1458,38 @@ interface DbSqlLease {
1425
1458
  /** Plaintext — trafega só sobre HTTPS, NUNCA logado/persistido. */
1426
1459
  password: string;
1427
1460
  /**
1428
- * CA do servidor PgBouncer, para **TLS de servidor** (verify-full). Quando
1429
- * presente, o pool valida o certificado do servidor contra esta CA
1430
- * (`rejectUnauthorized: true`). `null` quando o lease não traz TLS.
1461
+ * CA interna do Core (PEM) — a mesma que assina o cert do servidor PgBouncer
1462
+ * e o `clientCert`. O pool valida o servidor contra ela
1463
+ * (`rejectUnauthorized: true`). O Core sempre manda em lease SQL; `null` só
1464
+ * se o campo vier ausente, e aí o SDK conecta SEM TLS (`ssl: false`), mesmo
1465
+ * que `clientCert` exista.
1431
1466
  */
1432
1467
  sslca: string | null;
1433
1468
  /**
1434
- * Certificado de **cliente** para mTLS (o SDK apresentar identidade ao
1435
- * servidor). **mTLS-cliente NÃO está implementado no Core (TODO P0-3):** hoje
1436
- * este campo é SEMPRE `null`, portanto **não há mTLS ativo** — a conexão usa,
1437
- * no máximo, TLS de servidor (verify-full via `sslca`). O SDK já envia este
1438
- * cert ao pool quando/se o lease passar a trazê-lo.
1469
+ * Certificado X.509 de **cliente** (PEM) para mTLS, emitido por lease
1470
+ * (CN = `leaseId`, EKU `clientAuth`, expira com o lease — 15 min). O SDK o
1471
+ * apresenta ao PgBouncer em `ssl.cert`; o PgBouncer o exige
1472
+ * (`client_tls_sslmode = verify-full`). O Core sempre manda em lease SQL —
1473
+ * o `| null` é só tolerância a resposta sem o campo (o pool fica com TLS
1474
+ * só de servidor).
1439
1475
  */
1440
1476
  clientCert: string | null;
1441
1477
  /**
1442
- * Chave privada de **cliente** para mTLS — par de `clientCert`. Mesma
1443
- * condição: `null` até o Core emitir material de cliente (mTLS-cliente
1444
- * pendente, P0-3).
1478
+ * Chave privada de **cliente** (PEM, EC P-256 efêmera, nova a cada
1479
+ * emissão/renovação) — par de `clientCert`, vai em `ssl.key`. Trafega só
1480
+ * sobre HTTPS, NUNCA logada/persistida. Mesma regra de `null` do
1481
+ * `clientCert`.
1445
1482
  */
1446
1483
  clientKey: string | null;
1447
1484
  /**
1448
- * Versão da credencial no Secret Manager. Bump = rotação de senha.
1449
- * O manager fecha o pool antigo e abre um novo quando esta versão muda.
1485
+ * Versão da credencial. HOJE o Core manda sempre o placeholder `1` (TODO de
1486
+ * versionamento no `issuer-core.ts` do Core), então ela NÃO sinaliza
1487
+ * rotação. A troca de pool numa rotação é disparada pela mudança de
1488
+ * `password` (ou de qualquer campo de conexão) — ver `hasConnectionChanged`
1489
+ * em `lease.ts`.
1450
1490
  */
1451
1491
  credentialVersion: number;
1452
- /** Expiração ISO — SDK renova ~2 min antes. */
1492
+ /** Expiração ISO — o SDK renova aos ~80% do TTL (~3 min antes, em 15 min). */
1453
1493
  expiresAt: string;
1454
1494
  }
1455
1495
  /**
@@ -1412,9 +1412,42 @@ interface RealtimeClientOptions {
1412
1412
  * Alinhado com `DbSqlLease` do Core (`src/lib/db/lease/types.ts`).
1413
1413
  *
1414
1414
  * - `port` sempre 5433 — o lease aponta pro PgBouncer, nunca à porta crua.
1415
- * - `credentialVersion` — bump indica rotação; o `SqlLeaseManager` reabre
1416
- * o pool ao detectar versão diferente.
1415
+ * - `credentialVersion` — hoje é um placeholder fixo do Core (ver o campo).
1417
1416
  * - `expiresAt` — ISO string; o SDK renova aos ~80% do TTL (12 min em TTL=15 min).
1417
+ *
1418
+ * ── TLS / mTLS (estado real) ───────────────────────────────────────────────
1419
+ *
1420
+ * **O mTLS de cliente ESTÁ ativo.** O Core emite os três materiais em TODO
1421
+ * lease SQL (emissão e renovação — `buildLease`, ramo `sql`, em
1422
+ * `src/lib/db/lease/issuer-core.ts` do Core):
1423
+ * - `sslca` — a CA interna do Core (secret `coredb_ca_cert`). A MESMA CA
1424
+ * assina o cert do servidor PgBouncer (365 dias) e os certs de cliente.
1425
+ * - `clientCert` — X.509 de cliente emitido por lease: CN = `leaseId`, EKU
1426
+ * `clientAuth`, validade = TTL do lease (15 min).
1427
+ * - `clientKey` — chave EC P-256 efêmera, nova a cada emissão/renovação.
1428
+ * Não há flag que desligue isso: sem a CA no Secret Manager a emissão FALHA
1429
+ * (HTTP 500), em vez de devolver esses campos `null`.
1430
+ *
1431
+ * O SDK usa os três ao abrir o `pg.Pool` (`createPgPool` e o `createPool` de
1432
+ * `createSqlClientFromConfig`): com `sslca` presente, `ssl = { ca: sslca,
1433
+ * cert: clientCert, key: clientKey, rejectUnauthorized: true }` — verifica o
1434
+ * servidor (CA + hostname) E apresenta o cert de cliente.
1435
+ *
1436
+ * Do lado da VM, o PgBouncer roda com `client_tls_sslmode = verify-full` e
1437
+ * `client_tls_ca_file` = CA do Core (agente, `src/handlers/db-pgbouncer.ts`):
1438
+ * EXIGE cert de cliente válido. E `auth_type = scram-sha-256` — a conexão
1439
+ * precisa do cert E da senha do lease (o CN não é comparado ao usuário).
1440
+ *
1441
+ * Consequências práticas:
1442
+ * - o cert de cliente expira junto com o lease (~15 min). Pool que não troca
1443
+ * de lease passa a levar `certificate expired` (alerta TLS 45 enviado pelo
1444
+ * PgBouncer) — é o que a renovação proativa (`lease.ts`) e o re-lease
1445
+ * reativo (`resilient-pool.ts`) curam;
1446
+ * - se o install da VM não obteve a CA/assinatura, o Core configura o
1447
+ * PgBouncer SEM TLS (fail-open, com aviso no log). Como o SDK sempre liga
1448
+ * TLS quando o lease traz `sslca`, a conexão falha com "The server does
1449
+ * not support SSL connections" — o conserto é reconfigurar o PgBouncer com
1450
+ * TLS, não desligar TLS no SDK.
1418
1451
  */
1419
1452
  interface DbSqlLease {
1420
1453
  leaseId: string;
@@ -1425,31 +1458,38 @@ interface DbSqlLease {
1425
1458
  /** Plaintext — trafega só sobre HTTPS, NUNCA logado/persistido. */
1426
1459
  password: string;
1427
1460
  /**
1428
- * CA do servidor PgBouncer, para **TLS de servidor** (verify-full). Quando
1429
- * presente, o pool valida o certificado do servidor contra esta CA
1430
- * (`rejectUnauthorized: true`). `null` quando o lease não traz TLS.
1461
+ * CA interna do Core (PEM) — a mesma que assina o cert do servidor PgBouncer
1462
+ * e o `clientCert`. O pool valida o servidor contra ela
1463
+ * (`rejectUnauthorized: true`). O Core sempre manda em lease SQL; `null` só
1464
+ * se o campo vier ausente, e aí o SDK conecta SEM TLS (`ssl: false`), mesmo
1465
+ * que `clientCert` exista.
1431
1466
  */
1432
1467
  sslca: string | null;
1433
1468
  /**
1434
- * Certificado de **cliente** para mTLS (o SDK apresentar identidade ao
1435
- * servidor). **mTLS-cliente NÃO está implementado no Core (TODO P0-3):** hoje
1436
- * este campo é SEMPRE `null`, portanto **não há mTLS ativo** — a conexão usa,
1437
- * no máximo, TLS de servidor (verify-full via `sslca`). O SDK já envia este
1438
- * cert ao pool quando/se o lease passar a trazê-lo.
1469
+ * Certificado X.509 de **cliente** (PEM) para mTLS, emitido por lease
1470
+ * (CN = `leaseId`, EKU `clientAuth`, expira com o lease — 15 min). O SDK o
1471
+ * apresenta ao PgBouncer em `ssl.cert`; o PgBouncer o exige
1472
+ * (`client_tls_sslmode = verify-full`). O Core sempre manda em lease SQL —
1473
+ * o `| null` é só tolerância a resposta sem o campo (o pool fica com TLS
1474
+ * só de servidor).
1439
1475
  */
1440
1476
  clientCert: string | null;
1441
1477
  /**
1442
- * Chave privada de **cliente** para mTLS — par de `clientCert`. Mesma
1443
- * condição: `null` até o Core emitir material de cliente (mTLS-cliente
1444
- * pendente, P0-3).
1478
+ * Chave privada de **cliente** (PEM, EC P-256 efêmera, nova a cada
1479
+ * emissão/renovação) — par de `clientCert`, vai em `ssl.key`. Trafega só
1480
+ * sobre HTTPS, NUNCA logada/persistida. Mesma regra de `null` do
1481
+ * `clientCert`.
1445
1482
  */
1446
1483
  clientKey: string | null;
1447
1484
  /**
1448
- * Versão da credencial no Secret Manager. Bump = rotação de senha.
1449
- * O manager fecha o pool antigo e abre um novo quando esta versão muda.
1485
+ * Versão da credencial. HOJE o Core manda sempre o placeholder `1` (TODO de
1486
+ * versionamento no `issuer-core.ts` do Core), então ela NÃO sinaliza
1487
+ * rotação. A troca de pool numa rotação é disparada pela mudança de
1488
+ * `password` (ou de qualquer campo de conexão) — ver `hasConnectionChanged`
1489
+ * em `lease.ts`.
1450
1490
  */
1451
1491
  credentialVersion: number;
1452
- /** Expiração ISO — SDK renova ~2 min antes. */
1492
+ /** Expiração ISO — o SDK renova aos ~80% do TTL (~3 min antes, em 15 min). */
1453
1493
  expiresAt: string;
1454
1494
  }
1455
1495
  /**
package/dist/usage.cjs CHANGED
@@ -108,7 +108,7 @@ function V(e, t) {
108
108
  }
109
109
  function q() {
110
110
  try {
111
- return "3.8.0";
111
+ return "3.8.1";
112
112
  } catch {
113
113
  return;
114
114
  }
package/dist/usage.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { ah as ResolvedConfig, ay as UsageNamespace } from './types-D-9bjlM0.cjs';
1
+ import { ah as ResolvedConfig, ay as UsageNamespace } from './types-yv3EDKg2.cjs';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.cjs';
4
4
 
package/dist/usage.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ah as ResolvedConfig, ay as UsageNamespace } from './types-bVztFQTI.js';
1
+ import { ah as ResolvedConfig, ay as UsageNamespace } from './types-BYPk_3HR.js';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.js';
4
4
 
package/dist/usage.mjs CHANGED
@@ -106,7 +106,7 @@ function V(e, t) {
106
106
  }
107
107
  function q() {
108
108
  try {
109
- return "3.8.0";
109
+ return "3.8.1";
110
110
  } catch {
111
111
  return;
112
112
  }
package/dist/webhooks.cjs CHANGED
@@ -108,7 +108,7 @@ function X(t, e) {
108
108
  }
109
109
  function $() {
110
110
  try {
111
- return "3.8.0";
111
+ return "3.8.1";
112
112
  } catch {
113
113
  return;
114
114
  }
@@ -1,3 +1,3 @@
1
- export { V as MockWebhooks, ag as RegisterWebhookInput, aB as VerifyWebhookRequestOptions, aC as VerifyWebhookRequestResult, aD as WebhookEndpoint, aE as WebhookEvent, aF as WebhookScopeOptions, aG as WebhookTestResult, aH as WebhooksNamespace, aP as createWebhooksNamespace, aW as verifyWebhookRequest, aX as verifyWebhookSignature } from './types-D-9bjlM0.cjs';
1
+ export { V as MockWebhooks, ag as RegisterWebhookInput, aB as VerifyWebhookRequestOptions, aC as VerifyWebhookRequestResult, aD as WebhookEndpoint, aE as WebhookEvent, aF as WebhookScopeOptions, aG as WebhookTestResult, aH as WebhooksNamespace, aP as createWebhooksNamespace, aW as verifyWebhookRequest, aX as verifyWebhookSignature } from './types-yv3EDKg2.cjs';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.cjs';
@@ -1,3 +1,3 @@
1
- export { V as MockWebhooks, ag as RegisterWebhookInput, aB as VerifyWebhookRequestOptions, aC as VerifyWebhookRequestResult, aD as WebhookEndpoint, aE as WebhookEvent, aF as WebhookScopeOptions, aG as WebhookTestResult, aH as WebhooksNamespace, aP as createWebhooksNamespace, aW as verifyWebhookRequest, aX as verifyWebhookSignature } from './types-bVztFQTI.js';
1
+ export { V as MockWebhooks, ag as RegisterWebhookInput, aB as VerifyWebhookRequestOptions, aC as VerifyWebhookRequestResult, aD as WebhookEndpoint, aE as WebhookEvent, aF as WebhookScopeOptions, aG as WebhookTestResult, aH as WebhooksNamespace, aP as createWebhooksNamespace, aW as verifyWebhookRequest, aX as verifyWebhookSignature } from './types-BYPk_3HR.js';
2
2
  import 'drizzle-orm/node-postgres';
3
3
  import './errors.js';
package/dist/webhooks.mjs CHANGED
@@ -106,7 +106,7 @@ function X(t, e) {
106
106
  }
107
107
  function $() {
108
108
  try {
109
- return "3.8.0";
109
+ return "3.8.1";
110
110
  } catch {
111
111
  return;
112
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neetru/sdk",
3
- "version": "3.8.0",
3
+ "version": "3.8.1",
4
4
  "description": "Neetru SDK 3.0 — biblioteca runtime universal (browser/Node/Edge) para consumir o ecossistema Neetru. Paths canonical /api/sdk/v1/*, productId obrigatório, Idempotency-Key em mutations, WebCrypto signatures, baseUrl allowlist fail-closed.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",