@neetru/sdk 3.3.0 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/dist/ai.d.cts +1 -1
- package/dist/ai.d.ts +1 -1
- package/dist/auth.cjs +365 -25
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.mjs +365 -25
- package/dist/auth.mjs.map +1 -1
- package/dist/catalog.d.cts +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/db-react.d.cts +1 -1
- package/dist/db-react.d.ts +1 -1
- package/dist/db.cjs +202 -22
- package/dist/db.cjs.map +1 -1
- package/dist/db.d.cts +1 -1
- package/dist/db.d.ts +1 -1
- package/dist/db.mjs +202 -23
- package/dist/db.mjs.map +1 -1
- package/dist/entitlements.d.cts +1 -1
- package/dist/entitlements.d.ts +1 -1
- package/dist/firestore-compat.d.cts +1 -1
- package/dist/firestore-compat.d.ts +1 -1
- package/dist/index.cjs +366 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +366 -26
- package/dist/index.mjs.map +1 -1
- package/dist/mocks.cjs +68 -1
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +17 -1
- package/dist/mocks.d.ts +17 -1
- package/dist/mocks.mjs +68 -1
- package/dist/mocks.mjs.map +1 -1
- package/dist/notifications.d.cts +1 -1
- package/dist/notifications.d.ts +1 -1
- package/dist/react.d.cts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/support.cjs +98 -1
- package/dist/support.cjs.map +1 -1
- package/dist/support.d.cts +1 -1
- package/dist/support.d.ts +1 -1
- package/dist/support.mjs +98 -1
- package/dist/support.mjs.map +1 -1
- package/dist/telemetry.d.cts +1 -1
- package/dist/telemetry.d.ts +1 -1
- package/dist/{types-DslphKIM.d.ts → types-BlOLDMR0.d.ts} +192 -4
- package/dist/{types-DQplLXIk.d.cts → types-D-QdG502.d.cts} +192 -4
- package/dist/usage.d.cts +1 -1
- package/dist/usage.d.ts +1 -1
- package/dist/webhooks.d.cts +1 -1
- package/dist/webhooks.d.ts +1 -1
- package/package.json +1 -1
package/dist/telemetry.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ag as ResolvedConfig,
|
|
1
|
+
import { ag as ResolvedConfig, as as TelemetryEventInput, ar as TelemetryEventAck, au as TelemetryLogInput, at as TelemetryLogAck } from './types-BlOLDMR0.js';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.js';
|
|
4
4
|
|
|
@@ -531,6 +531,12 @@ interface Mutation {
|
|
|
531
531
|
attempts: number;
|
|
532
532
|
/** Último erro de replay (string). `null` se nenhuma tentativa ainda. */
|
|
533
533
|
lastError: string | null;
|
|
534
|
+
/**
|
|
535
|
+
* Epoch ms da ÚLTIMA tentativa real de envio (falha transiente).
|
|
536
|
+
* `undefined` se nunca foi tentada. Base do backoff exponencial keyed em
|
|
537
|
+
* `attempts` do SyncEngine — evita marretar o Core com uma mutação-veneno.
|
|
538
|
+
*/
|
|
539
|
+
lastAttemptAt?: number;
|
|
534
540
|
/** Estado de envio desta mutação. */
|
|
535
541
|
status: 'queued' | 'inflight' | 'failed';
|
|
536
542
|
/** Agrupa mutações de um `batch()` atômico. `null` se mutação individual. */
|
|
@@ -546,7 +552,14 @@ interface Mutation {
|
|
|
546
552
|
/**
|
|
547
553
|
* Razão pela qual uma escrita foi descartada no LWW (I3 §3.3 `conflict_log`).
|
|
548
554
|
*/
|
|
549
|
-
type ConflictReason = 'lww_server_newer' | 'rejected_permission' | 'rejected_validation'
|
|
555
|
+
type ConflictReason = 'lww_server_newer' | 'rejected_permission' | 'rejected_validation'
|
|
556
|
+
/**
|
|
557
|
+
* Dead-letter: a mutação esgotou o teto de tentativas de replay (5xx/timeout
|
|
558
|
+
* persistente) e foi descartada da fila para não travar o FIFO de todas as
|
|
559
|
+
* coleções (head-of-line block). `winningData` fica vazio — o servidor nunca
|
|
560
|
+
* aceitou a escrita. A escrita LOCAL otimista pode ter sido revertida.
|
|
561
|
+
*/
|
|
562
|
+
| 'failed_max_attempts';
|
|
550
563
|
/**
|
|
551
564
|
* Registro de uma escrita perdedora — gravado no `conflict_log` (I3 §3.3).
|
|
552
565
|
* Entregue ao produto via `onWriteResult` (status: `'superseded'`).
|
|
@@ -577,6 +590,13 @@ interface SyncState {
|
|
|
577
590
|
pendingWrites: number;
|
|
578
591
|
lastSyncedAt: number | null;
|
|
579
592
|
isLeaderTab: boolean;
|
|
593
|
+
/**
|
|
594
|
+
* Diagnóstico do ÚLTIMO ciclo de sync que falhou (push/pull/resync ou
|
|
595
|
+
* dead-letter de uma mutação-veneno). `null`/`undefined` = último ciclo OK.
|
|
596
|
+
* Reset a cada ciclo bem-sucedido. Antes disso a falha era engolida em
|
|
597
|
+
* silêncio — agora o produto pode reagir via `onSyncStateChanged`/`onError`.
|
|
598
|
+
*/
|
|
599
|
+
lastError?: string | null;
|
|
580
600
|
}
|
|
581
601
|
/** Função para cancelar uma subscrição (onSnapshot, onDoc, onSyncStateChanged). */
|
|
582
602
|
type Unsubscribe = () => void;
|
|
@@ -616,6 +636,15 @@ type Unsubscribe = () => void;
|
|
|
616
636
|
* de adaptação, não aqui. Isso torna o SyncEngine 100% testável com fake.
|
|
617
637
|
*/
|
|
618
638
|
|
|
639
|
+
/** Diagnóstico entregue ao hook `onError` do SyncEngine. */
|
|
640
|
+
interface SyncErrorEvent {
|
|
641
|
+
/** Fase onde o ciclo falhou. */
|
|
642
|
+
phase: 'push' | 'pull' | 'resync' | 'cycle';
|
|
643
|
+
/** Mensagem legível. */
|
|
644
|
+
message: string;
|
|
645
|
+
/** Epoch ms. */
|
|
646
|
+
at: number;
|
|
647
|
+
}
|
|
619
648
|
/**
|
|
620
649
|
* Documento retornado pelo servidor em push/pull/resync.
|
|
621
650
|
*/
|
|
@@ -664,6 +693,15 @@ interface PullChangesResult {
|
|
|
664
693
|
interface FullResyncResult {
|
|
665
694
|
docs: ServerDoc[];
|
|
666
695
|
newWatermark: number | null;
|
|
696
|
+
/**
|
|
697
|
+
* Coleções cujo resultado bateu no teto de paginação do transporte (o REST
|
|
698
|
+
* Documentos devolve no MÁXIMO 200 docs/coleção — paginação por cursor é
|
|
699
|
+
* tarefa Core, gated). Para essas coleções o conjunto veio TRUNCADO: o
|
|
700
|
+
* SyncEngine (a) NÃO roda detecção-de-deleção-por-ausência (senão docs além
|
|
701
|
+
* do teto virariam tombstone por engano) e (b) persiste o sinal para
|
|
702
|
+
* `DbListResult.truncated`. Transportes sem teto (realtime) omitem o campo.
|
|
703
|
+
*/
|
|
704
|
+
truncatedCollections?: string[];
|
|
667
705
|
}
|
|
668
706
|
/**
|
|
669
707
|
* Contrato do transporte de sync — injetado no SyncEngine.
|
|
@@ -949,6 +987,15 @@ interface DbListResult<T = Record<string, unknown>> {
|
|
|
949
987
|
type: 'added' | 'modified' | 'removed';
|
|
950
988
|
doc: DbDoc<T>;
|
|
951
989
|
}>;
|
|
990
|
+
/**
|
|
991
|
+
* `true` quando o último full-resync desta coleção bateu no TETO de 200 docs
|
|
992
|
+
* do transporte REST Documentos (ver `list()`): o cache local pode estar
|
|
993
|
+
* INCOMPLETO — existem mais docs no servidor além dos 200 baixados. Também
|
|
994
|
+
* força `stale: true`. Paginação por cursor > 200 exige mudança no Core
|
|
995
|
+
* (gated), então por ora o SDK apenas SINALIZA. `undefined`/`false` = sem
|
|
996
|
+
* truncamento conhecido (ou transporte sem teto, ex.: realtime).
|
|
997
|
+
*/
|
|
998
|
+
truncated?: boolean;
|
|
952
999
|
}
|
|
953
1000
|
interface DbGetResult<T = Record<string, unknown>> {
|
|
954
1001
|
docs: Array<DbDoc<T>>;
|
|
@@ -1053,7 +1100,18 @@ interface DbDocRef<T = Record<string, unknown>> {
|
|
|
1053
1100
|
interface DbCollectionRef$1<T = Record<string, unknown>> {
|
|
1054
1101
|
/** Retorna snapshot de um documento. `null` se não existir (nem no cache). */
|
|
1055
1102
|
get(id: string): Promise<DbGetResult<T> | null>;
|
|
1056
|
-
/**
|
|
1103
|
+
/**
|
|
1104
|
+
* Lista documentos com query opcional.
|
|
1105
|
+
*
|
|
1106
|
+
* **TETO DE 200 DOCS (transporte REST Documentos).** O reconciliador offline
|
|
1107
|
+
* baixa NO MÁXIMO 200 docs por coleção do Core em cada full-resync — o
|
|
1108
|
+
* endpoint REST não expõe paginação por cursor server-side (é tarefa Core,
|
|
1109
|
+
* gated). Se a coleção tem mais de 200 docs no servidor, o cache local fica
|
|
1110
|
+
* INCOMPLETO e `DbListResult.truncated === true` (+ `stale: true`). O
|
|
1111
|
+
* `q.limit`/`nextCursor` paginam apenas sobre o que já está no CACHE LOCAL,
|
|
1112
|
+
* não sobre o servidor. Para coleções grandes, filtre por `where` no Core ou
|
|
1113
|
+
* modele os dados para caber sob o teto até a paginação server-side existir.
|
|
1114
|
+
*/
|
|
1057
1115
|
list(q?: DbQuery$1): Promise<DbListResult<T>>;
|
|
1058
1116
|
/** Adiciona doc com id gerado pelo cliente (UUID v4). Durável localmente. */
|
|
1059
1117
|
add(data: WithFieldSentinels<Omit<T, 'id'>>): Promise<{
|
|
@@ -1112,6 +1170,13 @@ interface NeetruDbDocuments {
|
|
|
1112
1170
|
* já avançou a versão do documento (Last-Write-Wins).
|
|
1113
1171
|
*/
|
|
1114
1172
|
getConflicts(): Promise<ConflictRecord[]>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Subscreve a erros de ciclo de sync (P2-C) — falha inesperada nas fases ou
|
|
1175
|
+
* dead-letter de uma mutação-veneno que antes eram engolidos em silêncio. O
|
|
1176
|
+
* mesmo diagnóstico também aparece em `syncState.lastError`. Retorna
|
|
1177
|
+
* uma função de unsubscribe.
|
|
1178
|
+
*/
|
|
1179
|
+
onError(cb: (err: SyncErrorEvent) => void): Unsubscribe;
|
|
1115
1180
|
}
|
|
1116
1181
|
interface CreateOfflineDocumentsOptions {
|
|
1117
1182
|
/**
|
|
@@ -1626,7 +1691,32 @@ type NeetruDbEngine = NeetruDbTransport;
|
|
|
1626
1691
|
interface NeetruDbOptions {
|
|
1627
1692
|
/**
|
|
1628
1693
|
* ID opaco do banco lógico — emitido pelo Core em `POST /api/sdk/v1/db`.
|
|
1629
|
-
*
|
|
1694
|
+
*
|
|
1695
|
+
* **O que `dbId` REALMENTE faz** (bug_58811a43 — o texto antigo deste
|
|
1696
|
+
* JSDoc afirmava, incorretamente, que ele era "necessário para scoping
|
|
1697
|
+
* das coleções"):
|
|
1698
|
+
* - Nomeia o cache offline LOCAL (IndexedDB) e o canal de coordenação
|
|
1699
|
+
* entre abas (Web Locks): `neetru-db__{productId}__{dbId}__{env}`.
|
|
1700
|
+
* - Quando `transport === 'nosql-vm'`, é embutido como `_dbId` nos frames
|
|
1701
|
+
* de subscribe/validate enviados ao gateway realtime (filtra a
|
|
1702
|
+
* subscription no servidor — ver `NeetruRealtimeClient`).
|
|
1703
|
+
*
|
|
1704
|
+
* **O que `dbId` NÃO faz:**
|
|
1705
|
+
* - NÃO escopa as escritas/leituras REST do mundo Documentos
|
|
1706
|
+
* (`add`/`set`/`update`/`remove`/`list`, via
|
|
1707
|
+
* `/api/sdk/v1/datastore/*`) — elas são escopadas SOMENTE por
|
|
1708
|
+
* `x-neetru-tenant` (`tenantId` ?? `productId`), em QUALQUER
|
|
1709
|
+
* transport (inclusive `nosql-vm`: writes sempre saem pelo REST por
|
|
1710
|
+
* baixo — ver `createRestSyncTransport`).
|
|
1711
|
+
* - NÃO é usado pelo lease SQL. `client.db.sql(schema, { database })`
|
|
1712
|
+
* desambigua entre N bancos SQL via `SqlOptions.database`, um
|
|
1713
|
+
* parâmetro totalmente separado — `dbId` nunca chega lá.
|
|
1714
|
+
*
|
|
1715
|
+
* Se o produto precisa de bancos logicamente separados no **servidor**,
|
|
1716
|
+
* isso é uma decisão server-side (tenant/produto ou schema do Core), não
|
|
1717
|
+
* `dbId`. PASSAR `dbId` em contexto browser dispara um aviso único no
|
|
1718
|
+
* console (dev-only): usar dbIds distintos no mesmo tenant/produto NÃO isola
|
|
1719
|
+
* os dados no servidor (co-mingling) — a falsa sensação de isolamento é a mina.
|
|
1630
1720
|
*/
|
|
1631
1721
|
dbId?: string;
|
|
1632
1722
|
/**
|
|
@@ -1766,6 +1856,13 @@ interface NeetruDb {
|
|
|
1766
1856
|
* Permite ao produto inspecionar escritas perdidas.
|
|
1767
1857
|
*/
|
|
1768
1858
|
getConflicts(): Promise<ConflictRecord[]>;
|
|
1859
|
+
/**
|
|
1860
|
+
* (Opcional) Subscreve a erros de ciclo de sync (P2-C) — falha inesperada nas
|
|
1861
|
+
* fases ou dead-letter de uma mutação-veneno que antes eram engolidos em
|
|
1862
|
+
* silêncio. O mesmo diagnóstico também aparece em `syncState.lastError`.
|
|
1863
|
+
* Retorna uma função de unsubscribe. Ausente em implementações mock.
|
|
1864
|
+
*/
|
|
1865
|
+
onError?(cb: (err: SyncErrorEvent) => void): Unsubscribe;
|
|
1769
1866
|
}
|
|
1770
1867
|
/**
|
|
1771
1868
|
* Transporte REST puro — usa os endpoints `/api/sdk/v1/datastore/*` do Core.
|
|
@@ -1794,6 +1891,8 @@ declare function createRestSyncTransport(config?: ResolvedConfig): RealtimeTrans
|
|
|
1794
1891
|
* @param wsFactory Factory de WebSocket injetável (testes).
|
|
1795
1892
|
*/
|
|
1796
1893
|
declare function getWebSocketRealtimeClient(gatewayUrl: string, ticketProvider: TicketProvider, dbId?: string, wsFactory?: WebSocketFactory): NeetruRealtimeClient;
|
|
1894
|
+
/** @internal Reseta o guard one-time do aviso de `dbId` — uso exclusivo de testes. */
|
|
1895
|
+
declare function __resetDbIdWarningForTests(): void;
|
|
1797
1896
|
/**
|
|
1798
1897
|
* Cria o namespace `client.db` completo.
|
|
1799
1898
|
*
|
|
@@ -2400,6 +2499,43 @@ interface SupportTicket {
|
|
|
2400
2499
|
updatedAt?: string;
|
|
2401
2500
|
/** Slug do produto referenciado. */
|
|
2402
2501
|
productSlug?: string;
|
|
2502
|
+
/**
|
|
2503
|
+
* 3.4: URL da página onde o feedback/problema foi originado (input de
|
|
2504
|
+
* `createTicket`). `null` quando não informado.
|
|
2505
|
+
*/
|
|
2506
|
+
pageUrl: string | null;
|
|
2507
|
+
/**
|
|
2508
|
+
* 3.4: URL do primeiro anexo (screenshot) do ticket, quando enviado via
|
|
2509
|
+
* `createTicket({ screenshotBase64 })`. `null` se nenhum anexo.
|
|
2510
|
+
*/
|
|
2511
|
+
screenshotUrl: string | null;
|
|
2512
|
+
/**
|
|
2513
|
+
* 3.4: ISO — setado pelo Core na transição do ticket pra `resolved`.
|
|
2514
|
+
* `null` enquanto não resolvido.
|
|
2515
|
+
*/
|
|
2516
|
+
resolvedAt: string | null;
|
|
2517
|
+
/**
|
|
2518
|
+
* 3.4: ISO — setado por `markResolvedSeen` (idempotente, só na 1ª vez que
|
|
2519
|
+
* o cliente vê a notificação de resolução). `null` até então.
|
|
2520
|
+
*/
|
|
2521
|
+
resolvedNotifiedAt: string | null;
|
|
2522
|
+
/**
|
|
2523
|
+
* 3.4: quantas vezes o modal de satisfação foi exibido
|
|
2524
|
+
* (`recordSatisfactionAttempt`). Default `0`.
|
|
2525
|
+
*/
|
|
2526
|
+
satisfactionAttempts: number;
|
|
2527
|
+
/** 3.4: ISO da última tentativa de exibição do modal de satisfação. */
|
|
2528
|
+
lastSatisfactionAttemptAt: string | null;
|
|
2529
|
+
/**
|
|
2530
|
+
* 3.4: ISO — setado por `submitSatisfaction` (avaliação OU skip). Marca o
|
|
2531
|
+
* ciclo de satisfação como concluído (terminal, até uma eventual
|
|
2532
|
+
* `contestTicket`).
|
|
2533
|
+
*/
|
|
2534
|
+
satisfiedAt: string | null;
|
|
2535
|
+
/** 3.4: nota CSAT 1-5, ou `null` se ainda não avaliado / pulado. */
|
|
2536
|
+
rating: number | null;
|
|
2537
|
+
/** 3.4: comentário opcional da avaliação de satisfação. */
|
|
2538
|
+
satisfactionComment: string | null;
|
|
2403
2539
|
}
|
|
2404
2540
|
interface CreateTicketInput {
|
|
2405
2541
|
subject: string;
|
|
@@ -2414,6 +2550,19 @@ interface CreateTicketInput {
|
|
|
2414
2550
|
* Chaves limitadas a 64 chars; valores primitive (string/number/boolean/null).
|
|
2415
2551
|
*/
|
|
2416
2552
|
metadata?: Record<string, string | number | boolean | null>;
|
|
2553
|
+
/**
|
|
2554
|
+
* 3.4: URL da página onde o problema/feedback ocorreu. Propagado como
|
|
2555
|
+
* `pageUrl` no ticket.
|
|
2556
|
+
*/
|
|
2557
|
+
pageUrl?: string;
|
|
2558
|
+
/**
|
|
2559
|
+
* 3.4: screenshot em data URL base64 (cap ~700KB — mesmo limite do
|
|
2560
|
+
* `report-problem.ts` do Core). O Core converte em `attachments`/
|
|
2561
|
+
* `screenshotAttached`.
|
|
2562
|
+
*/
|
|
2563
|
+
screenshotBase64?: string;
|
|
2564
|
+
/** 3.4: logs de console relevantes capturados no momento do report. */
|
|
2565
|
+
consoleLogs?: string;
|
|
2417
2566
|
}
|
|
2418
2567
|
interface SupportNamespace {
|
|
2419
2568
|
/**
|
|
@@ -2429,6 +2578,45 @@ interface SupportNamespace {
|
|
|
2429
2578
|
listMyTickets(options?: {
|
|
2430
2579
|
productSlug?: string;
|
|
2431
2580
|
}): Promise<SupportTicket[]>;
|
|
2581
|
+
/**
|
|
2582
|
+
* 3.4: marca que o usuário viu a notificação de resolução do ticket
|
|
2583
|
+
* (`resolvedNotifiedAt`, idempotente — só seta se ainda `null` no Core).
|
|
2584
|
+
* POST `/api/sdk/v1/support/tickets/{id}/resolved-seen`. Requer Bearer +
|
|
2585
|
+
* ownership + ticket em `resolved`.
|
|
2586
|
+
*/
|
|
2587
|
+
markResolvedSeen(ticketId: string): Promise<void>;
|
|
2588
|
+
/**
|
|
2589
|
+
* 3.4: registra uma tentativa de exibição do modal de satisfação
|
|
2590
|
+
* (`satisfactionAttempts += 1`, `lastSatisfactionAttemptAt = now`).
|
|
2591
|
+
* **Chamar no SHOW do modal, não na resposta** — exibir já conta como
|
|
2592
|
+
* tentativa, evita reprompt infinito. POST
|
|
2593
|
+
* `/api/sdk/v1/support/tickets/{id}/satisfaction-attempt`. Requer Bearer +
|
|
2594
|
+
* ownership + ticket em `resolved`.
|
|
2595
|
+
*/
|
|
2596
|
+
recordSatisfactionAttempt(ticketId: string): Promise<void>;
|
|
2597
|
+
/**
|
|
2598
|
+
* 3.4: envia (ou pula) a avaliação de satisfação. `rating` é CSAT 1-5 ou
|
|
2599
|
+
* `null` (junto de `skipped: true`). Terminal — seta `satisfiedAt`. POST
|
|
2600
|
+
* `/api/sdk/v1/support/tickets/{id}/satisfaction`. Requer Bearer +
|
|
2601
|
+
* ownership.
|
|
2602
|
+
*/
|
|
2603
|
+
submitSatisfaction(input: {
|
|
2604
|
+
ticketId: string;
|
|
2605
|
+
rating: number | null;
|
|
2606
|
+
comment?: string | null;
|
|
2607
|
+
skipped: boolean;
|
|
2608
|
+
}): Promise<void>;
|
|
2609
|
+
/**
|
|
2610
|
+
* 3.4: contesta um ticket resolvido — reabre (`status='open'`) e zera o
|
|
2611
|
+
* ciclo de satisfação/notificação (`resolvedAt`, `resolvedNotifiedAt`,
|
|
2612
|
+
* `satisfactionAttempts`, `lastSatisfactionAttemptAt`, `satisfiedAt`,
|
|
2613
|
+
* `rating`, `satisfactionComment`). POST
|
|
2614
|
+
* `/api/sdk/v1/support/tickets/{id}/contest`. Requer Bearer + ownership +
|
|
2615
|
+
* ticket em `resolved`.
|
|
2616
|
+
*/
|
|
2617
|
+
contestTicket(ticketId: string, opts?: {
|
|
2618
|
+
comment?: string;
|
|
2619
|
+
}): Promise<void>;
|
|
2432
2620
|
}
|
|
2433
2621
|
/**
|
|
2434
2622
|
* Modo do SDK. `dev` ativa mocks automáticos (úteis pra testes e
|
|
@@ -2458,4 +2646,4 @@ interface CatalogListOptions {
|
|
|
2458
2646
|
includeDrafts?: boolean;
|
|
2459
2647
|
}
|
|
2460
2648
|
|
|
2461
|
-
export { NeetruDbError as $, type AiChatChoice as A, type DbChangeType as B, type CatalogListOptions as C, DEFAULT_BASE_URL as D, type DbCollectionRef$1 as E, type DbDoc as F, type DbDocRef as G, type DbGetResult as H, type DbListResult as I, type DbNamespace as J, type DbQuery$1 as K, type DbSqlLease as L, type DbWhereFilter as M, type DbWhereFilter$1 as N, type EntitlementCheck as O, type FieldSentinel as P, type IncrementSentinel as Q, type ListNotificationsOptions as R, MockCheckout as S, MockNotifications as T, MockWebhooks as U, NEETRU_SENTINEL_KEY as V, type NeetruClient as W, type NeetruClientConfig as X, type NeetruDb as Y, type NeetruDbDocuments as Z, type NeetruDbEngine as _, type AiChatMessage as a, type NeetruDbErrorCode as a0, type NeetruDbOptions as a1, type NeetruDbTransport as a2, type NeetruEnv as a3, type NeetruSqlClient as a4, type NeetruUser as a5, type NotificationScopeOptions as a6, type NotificationsNamespace as a7, type Product as a8, type ProductNotification as a9, type
|
|
2649
|
+
export { NeetruDbError as $, type AiChatChoice as A, type DbChangeType as B, type CatalogListOptions as C, DEFAULT_BASE_URL as D, type DbCollectionRef$1 as E, type DbDoc as F, type DbDocRef as G, type DbGetResult as H, type DbListResult as I, type DbNamespace as J, type DbQuery$1 as K, type DbSqlLease as L, type DbWhereFilter as M, type DbWhereFilter$1 as N, type EntitlementCheck as O, type FieldSentinel as P, type IncrementSentinel as Q, type ListNotificationsOptions as R, MockCheckout as S, MockNotifications as T, MockWebhooks as U, NEETRU_SENTINEL_KEY as V, type NeetruClient as W, type NeetruClientConfig as X, type NeetruDb as Y, type NeetruDbDocuments as Z, type NeetruDbEngine as _, type AiChatMessage as a, type NeetruDbErrorCode as a0, type NeetruDbOptions as a1, type NeetruDbTransport as a2, type NeetruEnv as a3, type NeetruSqlClient as a4, type NeetruUser as a5, type NotificationScopeOptions as a6, type NotificationsNamespace as a7, type Product as a8, type ProductNotification as a9, type VerifyWebhookRequestOptions as aA, type VerifyWebhookRequestResult as aB, type WebhookEndpoint as aC, type WebhookEvent as aD, type WebhookScopeOptions as aE, type WebhookTestResult as aF, type WebhooksNamespace as aG, type WithFieldSentinels as aH, __resetDbIdWarningForTests as aI, createAiNamespace as aJ, createCheckoutNamespace as aK, createNeetruDb as aL, createNotificationsNamespace as aM, createRestSyncTransport as aN, createWebhooksNamespace as aO, getWebSocketRealtimeClient as aP, increment as aQ, isFieldSentinel as aR, isIncrementSentinel as aS, isServerTimestampSentinel as aT, serverTimestamp as aU, verifyWebhookRequest as aV, verifyWebhookSignature as aW, type ProductNotificationSeverity as aa, type ProductPlan as ab, type ProductStatus as ac, type RealtimeTransport as ad, type RedirectCallbackResult as ae, type RegisterWebhookInput as af, type ResolvedConfig as ag, type SendNotificationInput as ah, type ServerTimestampSentinel as ai, type SignInOptions as aj, type SqlOptions as ak, type SupportNamespace as al, type SupportSeverity as am, type SupportStatus as an, type SupportTicket as ao, type SyncErrorEvent as ap, type SyncState as aq, type TelemetryEventAck as ar, type TelemetryEventInput as as, type TelemetryLogAck as at, type TelemetryLogInput as au, type Unsubscribe as av, type UsageEventInput as aw, type UsageNamespace as ax, type UsageQuota as ay, type VerifyTokenOptions as az, type AiChatOptions as b, type AiChatResult as c, type AiChatUsage as d, type AiContentPart as e, type AiImageUrlPart as f, type AiNamespace as g, type AiResponseFormat as h, type AiStreamHandle as i, type AiStreamMeta as j, type AiTextPart as k, type AuthNamespace as l, type AuthStateListener as m, type CatalogListResponse as n, type CheckoutAuthOpts as o, type CheckoutIntentInfo as p, type CheckoutIntentStatus as q, type CheckoutNamespace as r, type CheckoutStartInput as s, type CheckoutStartResult as t, type CheckoutTenantType as u, type CompleteSignInResult as v, type ConflictRecord as w, type CreateOfflineDocumentsOptions as x, type CreateTicketInput as y, type DbBatchOp as z };
|
|
@@ -531,6 +531,12 @@ interface Mutation {
|
|
|
531
531
|
attempts: number;
|
|
532
532
|
/** Último erro de replay (string). `null` se nenhuma tentativa ainda. */
|
|
533
533
|
lastError: string | null;
|
|
534
|
+
/**
|
|
535
|
+
* Epoch ms da ÚLTIMA tentativa real de envio (falha transiente).
|
|
536
|
+
* `undefined` se nunca foi tentada. Base do backoff exponencial keyed em
|
|
537
|
+
* `attempts` do SyncEngine — evita marretar o Core com uma mutação-veneno.
|
|
538
|
+
*/
|
|
539
|
+
lastAttemptAt?: number;
|
|
534
540
|
/** Estado de envio desta mutação. */
|
|
535
541
|
status: 'queued' | 'inflight' | 'failed';
|
|
536
542
|
/** Agrupa mutações de um `batch()` atômico. `null` se mutação individual. */
|
|
@@ -546,7 +552,14 @@ interface Mutation {
|
|
|
546
552
|
/**
|
|
547
553
|
* Razão pela qual uma escrita foi descartada no LWW (I3 §3.3 `conflict_log`).
|
|
548
554
|
*/
|
|
549
|
-
type ConflictReason = 'lww_server_newer' | 'rejected_permission' | 'rejected_validation'
|
|
555
|
+
type ConflictReason = 'lww_server_newer' | 'rejected_permission' | 'rejected_validation'
|
|
556
|
+
/**
|
|
557
|
+
* Dead-letter: a mutação esgotou o teto de tentativas de replay (5xx/timeout
|
|
558
|
+
* persistente) e foi descartada da fila para não travar o FIFO de todas as
|
|
559
|
+
* coleções (head-of-line block). `winningData` fica vazio — o servidor nunca
|
|
560
|
+
* aceitou a escrita. A escrita LOCAL otimista pode ter sido revertida.
|
|
561
|
+
*/
|
|
562
|
+
| 'failed_max_attempts';
|
|
550
563
|
/**
|
|
551
564
|
* Registro de uma escrita perdedora — gravado no `conflict_log` (I3 §3.3).
|
|
552
565
|
* Entregue ao produto via `onWriteResult` (status: `'superseded'`).
|
|
@@ -577,6 +590,13 @@ interface SyncState {
|
|
|
577
590
|
pendingWrites: number;
|
|
578
591
|
lastSyncedAt: number | null;
|
|
579
592
|
isLeaderTab: boolean;
|
|
593
|
+
/**
|
|
594
|
+
* Diagnóstico do ÚLTIMO ciclo de sync que falhou (push/pull/resync ou
|
|
595
|
+
* dead-letter de uma mutação-veneno). `null`/`undefined` = último ciclo OK.
|
|
596
|
+
* Reset a cada ciclo bem-sucedido. Antes disso a falha era engolida em
|
|
597
|
+
* silêncio — agora o produto pode reagir via `onSyncStateChanged`/`onError`.
|
|
598
|
+
*/
|
|
599
|
+
lastError?: string | null;
|
|
580
600
|
}
|
|
581
601
|
/** Função para cancelar uma subscrição (onSnapshot, onDoc, onSyncStateChanged). */
|
|
582
602
|
type Unsubscribe = () => void;
|
|
@@ -616,6 +636,15 @@ type Unsubscribe = () => void;
|
|
|
616
636
|
* de adaptação, não aqui. Isso torna o SyncEngine 100% testável com fake.
|
|
617
637
|
*/
|
|
618
638
|
|
|
639
|
+
/** Diagnóstico entregue ao hook `onError` do SyncEngine. */
|
|
640
|
+
interface SyncErrorEvent {
|
|
641
|
+
/** Fase onde o ciclo falhou. */
|
|
642
|
+
phase: 'push' | 'pull' | 'resync' | 'cycle';
|
|
643
|
+
/** Mensagem legível. */
|
|
644
|
+
message: string;
|
|
645
|
+
/** Epoch ms. */
|
|
646
|
+
at: number;
|
|
647
|
+
}
|
|
619
648
|
/**
|
|
620
649
|
* Documento retornado pelo servidor em push/pull/resync.
|
|
621
650
|
*/
|
|
@@ -664,6 +693,15 @@ interface PullChangesResult {
|
|
|
664
693
|
interface FullResyncResult {
|
|
665
694
|
docs: ServerDoc[];
|
|
666
695
|
newWatermark: number | null;
|
|
696
|
+
/**
|
|
697
|
+
* Coleções cujo resultado bateu no teto de paginação do transporte (o REST
|
|
698
|
+
* Documentos devolve no MÁXIMO 200 docs/coleção — paginação por cursor é
|
|
699
|
+
* tarefa Core, gated). Para essas coleções o conjunto veio TRUNCADO: o
|
|
700
|
+
* SyncEngine (a) NÃO roda detecção-de-deleção-por-ausência (senão docs além
|
|
701
|
+
* do teto virariam tombstone por engano) e (b) persiste o sinal para
|
|
702
|
+
* `DbListResult.truncated`. Transportes sem teto (realtime) omitem o campo.
|
|
703
|
+
*/
|
|
704
|
+
truncatedCollections?: string[];
|
|
667
705
|
}
|
|
668
706
|
/**
|
|
669
707
|
* Contrato do transporte de sync — injetado no SyncEngine.
|
|
@@ -949,6 +987,15 @@ interface DbListResult<T = Record<string, unknown>> {
|
|
|
949
987
|
type: 'added' | 'modified' | 'removed';
|
|
950
988
|
doc: DbDoc<T>;
|
|
951
989
|
}>;
|
|
990
|
+
/**
|
|
991
|
+
* `true` quando o último full-resync desta coleção bateu no TETO de 200 docs
|
|
992
|
+
* do transporte REST Documentos (ver `list()`): o cache local pode estar
|
|
993
|
+
* INCOMPLETO — existem mais docs no servidor além dos 200 baixados. Também
|
|
994
|
+
* força `stale: true`. Paginação por cursor > 200 exige mudança no Core
|
|
995
|
+
* (gated), então por ora o SDK apenas SINALIZA. `undefined`/`false` = sem
|
|
996
|
+
* truncamento conhecido (ou transporte sem teto, ex.: realtime).
|
|
997
|
+
*/
|
|
998
|
+
truncated?: boolean;
|
|
952
999
|
}
|
|
953
1000
|
interface DbGetResult<T = Record<string, unknown>> {
|
|
954
1001
|
docs: Array<DbDoc<T>>;
|
|
@@ -1053,7 +1100,18 @@ interface DbDocRef<T = Record<string, unknown>> {
|
|
|
1053
1100
|
interface DbCollectionRef$1<T = Record<string, unknown>> {
|
|
1054
1101
|
/** Retorna snapshot de um documento. `null` se não existir (nem no cache). */
|
|
1055
1102
|
get(id: string): Promise<DbGetResult<T> | null>;
|
|
1056
|
-
/**
|
|
1103
|
+
/**
|
|
1104
|
+
* Lista documentos com query opcional.
|
|
1105
|
+
*
|
|
1106
|
+
* **TETO DE 200 DOCS (transporte REST Documentos).** O reconciliador offline
|
|
1107
|
+
* baixa NO MÁXIMO 200 docs por coleção do Core em cada full-resync — o
|
|
1108
|
+
* endpoint REST não expõe paginação por cursor server-side (é tarefa Core,
|
|
1109
|
+
* gated). Se a coleção tem mais de 200 docs no servidor, o cache local fica
|
|
1110
|
+
* INCOMPLETO e `DbListResult.truncated === true` (+ `stale: true`). O
|
|
1111
|
+
* `q.limit`/`nextCursor` paginam apenas sobre o que já está no CACHE LOCAL,
|
|
1112
|
+
* não sobre o servidor. Para coleções grandes, filtre por `where` no Core ou
|
|
1113
|
+
* modele os dados para caber sob o teto até a paginação server-side existir.
|
|
1114
|
+
*/
|
|
1057
1115
|
list(q?: DbQuery$1): Promise<DbListResult<T>>;
|
|
1058
1116
|
/** Adiciona doc com id gerado pelo cliente (UUID v4). Durável localmente. */
|
|
1059
1117
|
add(data: WithFieldSentinels<Omit<T, 'id'>>): Promise<{
|
|
@@ -1112,6 +1170,13 @@ interface NeetruDbDocuments {
|
|
|
1112
1170
|
* já avançou a versão do documento (Last-Write-Wins).
|
|
1113
1171
|
*/
|
|
1114
1172
|
getConflicts(): Promise<ConflictRecord[]>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Subscreve a erros de ciclo de sync (P2-C) — falha inesperada nas fases ou
|
|
1175
|
+
* dead-letter de uma mutação-veneno que antes eram engolidos em silêncio. O
|
|
1176
|
+
* mesmo diagnóstico também aparece em `syncState.lastError`. Retorna
|
|
1177
|
+
* uma função de unsubscribe.
|
|
1178
|
+
*/
|
|
1179
|
+
onError(cb: (err: SyncErrorEvent) => void): Unsubscribe;
|
|
1115
1180
|
}
|
|
1116
1181
|
interface CreateOfflineDocumentsOptions {
|
|
1117
1182
|
/**
|
|
@@ -1626,7 +1691,32 @@ type NeetruDbEngine = NeetruDbTransport;
|
|
|
1626
1691
|
interface NeetruDbOptions {
|
|
1627
1692
|
/**
|
|
1628
1693
|
* ID opaco do banco lógico — emitido pelo Core em `POST /api/sdk/v1/db`.
|
|
1629
|
-
*
|
|
1694
|
+
*
|
|
1695
|
+
* **O que `dbId` REALMENTE faz** (bug_58811a43 — o texto antigo deste
|
|
1696
|
+
* JSDoc afirmava, incorretamente, que ele era "necessário para scoping
|
|
1697
|
+
* das coleções"):
|
|
1698
|
+
* - Nomeia o cache offline LOCAL (IndexedDB) e o canal de coordenação
|
|
1699
|
+
* entre abas (Web Locks): `neetru-db__{productId}__{dbId}__{env}`.
|
|
1700
|
+
* - Quando `transport === 'nosql-vm'`, é embutido como `_dbId` nos frames
|
|
1701
|
+
* de subscribe/validate enviados ao gateway realtime (filtra a
|
|
1702
|
+
* subscription no servidor — ver `NeetruRealtimeClient`).
|
|
1703
|
+
*
|
|
1704
|
+
* **O que `dbId` NÃO faz:**
|
|
1705
|
+
* - NÃO escopa as escritas/leituras REST do mundo Documentos
|
|
1706
|
+
* (`add`/`set`/`update`/`remove`/`list`, via
|
|
1707
|
+
* `/api/sdk/v1/datastore/*`) — elas são escopadas SOMENTE por
|
|
1708
|
+
* `x-neetru-tenant` (`tenantId` ?? `productId`), em QUALQUER
|
|
1709
|
+
* transport (inclusive `nosql-vm`: writes sempre saem pelo REST por
|
|
1710
|
+
* baixo — ver `createRestSyncTransport`).
|
|
1711
|
+
* - NÃO é usado pelo lease SQL. `client.db.sql(schema, { database })`
|
|
1712
|
+
* desambigua entre N bancos SQL via `SqlOptions.database`, um
|
|
1713
|
+
* parâmetro totalmente separado — `dbId` nunca chega lá.
|
|
1714
|
+
*
|
|
1715
|
+
* Se o produto precisa de bancos logicamente separados no **servidor**,
|
|
1716
|
+
* isso é uma decisão server-side (tenant/produto ou schema do Core), não
|
|
1717
|
+
* `dbId`. PASSAR `dbId` em contexto browser dispara um aviso único no
|
|
1718
|
+
* console (dev-only): usar dbIds distintos no mesmo tenant/produto NÃO isola
|
|
1719
|
+
* os dados no servidor (co-mingling) — a falsa sensação de isolamento é a mina.
|
|
1630
1720
|
*/
|
|
1631
1721
|
dbId?: string;
|
|
1632
1722
|
/**
|
|
@@ -1766,6 +1856,13 @@ interface NeetruDb {
|
|
|
1766
1856
|
* Permite ao produto inspecionar escritas perdidas.
|
|
1767
1857
|
*/
|
|
1768
1858
|
getConflicts(): Promise<ConflictRecord[]>;
|
|
1859
|
+
/**
|
|
1860
|
+
* (Opcional) Subscreve a erros de ciclo de sync (P2-C) — falha inesperada nas
|
|
1861
|
+
* fases ou dead-letter de uma mutação-veneno que antes eram engolidos em
|
|
1862
|
+
* silêncio. O mesmo diagnóstico também aparece em `syncState.lastError`.
|
|
1863
|
+
* Retorna uma função de unsubscribe. Ausente em implementações mock.
|
|
1864
|
+
*/
|
|
1865
|
+
onError?(cb: (err: SyncErrorEvent) => void): Unsubscribe;
|
|
1769
1866
|
}
|
|
1770
1867
|
/**
|
|
1771
1868
|
* Transporte REST puro — usa os endpoints `/api/sdk/v1/datastore/*` do Core.
|
|
@@ -1794,6 +1891,8 @@ declare function createRestSyncTransport(config?: ResolvedConfig): RealtimeTrans
|
|
|
1794
1891
|
* @param wsFactory Factory de WebSocket injetável (testes).
|
|
1795
1892
|
*/
|
|
1796
1893
|
declare function getWebSocketRealtimeClient(gatewayUrl: string, ticketProvider: TicketProvider, dbId?: string, wsFactory?: WebSocketFactory): NeetruRealtimeClient;
|
|
1894
|
+
/** @internal Reseta o guard one-time do aviso de `dbId` — uso exclusivo de testes. */
|
|
1895
|
+
declare function __resetDbIdWarningForTests(): void;
|
|
1797
1896
|
/**
|
|
1798
1897
|
* Cria o namespace `client.db` completo.
|
|
1799
1898
|
*
|
|
@@ -2400,6 +2499,43 @@ interface SupportTicket {
|
|
|
2400
2499
|
updatedAt?: string;
|
|
2401
2500
|
/** Slug do produto referenciado. */
|
|
2402
2501
|
productSlug?: string;
|
|
2502
|
+
/**
|
|
2503
|
+
* 3.4: URL da página onde o feedback/problema foi originado (input de
|
|
2504
|
+
* `createTicket`). `null` quando não informado.
|
|
2505
|
+
*/
|
|
2506
|
+
pageUrl: string | null;
|
|
2507
|
+
/**
|
|
2508
|
+
* 3.4: URL do primeiro anexo (screenshot) do ticket, quando enviado via
|
|
2509
|
+
* `createTicket({ screenshotBase64 })`. `null` se nenhum anexo.
|
|
2510
|
+
*/
|
|
2511
|
+
screenshotUrl: string | null;
|
|
2512
|
+
/**
|
|
2513
|
+
* 3.4: ISO — setado pelo Core na transição do ticket pra `resolved`.
|
|
2514
|
+
* `null` enquanto não resolvido.
|
|
2515
|
+
*/
|
|
2516
|
+
resolvedAt: string | null;
|
|
2517
|
+
/**
|
|
2518
|
+
* 3.4: ISO — setado por `markResolvedSeen` (idempotente, só na 1ª vez que
|
|
2519
|
+
* o cliente vê a notificação de resolução). `null` até então.
|
|
2520
|
+
*/
|
|
2521
|
+
resolvedNotifiedAt: string | null;
|
|
2522
|
+
/**
|
|
2523
|
+
* 3.4: quantas vezes o modal de satisfação foi exibido
|
|
2524
|
+
* (`recordSatisfactionAttempt`). Default `0`.
|
|
2525
|
+
*/
|
|
2526
|
+
satisfactionAttempts: number;
|
|
2527
|
+
/** 3.4: ISO da última tentativa de exibição do modal de satisfação. */
|
|
2528
|
+
lastSatisfactionAttemptAt: string | null;
|
|
2529
|
+
/**
|
|
2530
|
+
* 3.4: ISO — setado por `submitSatisfaction` (avaliação OU skip). Marca o
|
|
2531
|
+
* ciclo de satisfação como concluído (terminal, até uma eventual
|
|
2532
|
+
* `contestTicket`).
|
|
2533
|
+
*/
|
|
2534
|
+
satisfiedAt: string | null;
|
|
2535
|
+
/** 3.4: nota CSAT 1-5, ou `null` se ainda não avaliado / pulado. */
|
|
2536
|
+
rating: number | null;
|
|
2537
|
+
/** 3.4: comentário opcional da avaliação de satisfação. */
|
|
2538
|
+
satisfactionComment: string | null;
|
|
2403
2539
|
}
|
|
2404
2540
|
interface CreateTicketInput {
|
|
2405
2541
|
subject: string;
|
|
@@ -2414,6 +2550,19 @@ interface CreateTicketInput {
|
|
|
2414
2550
|
* Chaves limitadas a 64 chars; valores primitive (string/number/boolean/null).
|
|
2415
2551
|
*/
|
|
2416
2552
|
metadata?: Record<string, string | number | boolean | null>;
|
|
2553
|
+
/**
|
|
2554
|
+
* 3.4: URL da página onde o problema/feedback ocorreu. Propagado como
|
|
2555
|
+
* `pageUrl` no ticket.
|
|
2556
|
+
*/
|
|
2557
|
+
pageUrl?: string;
|
|
2558
|
+
/**
|
|
2559
|
+
* 3.4: screenshot em data URL base64 (cap ~700KB — mesmo limite do
|
|
2560
|
+
* `report-problem.ts` do Core). O Core converte em `attachments`/
|
|
2561
|
+
* `screenshotAttached`.
|
|
2562
|
+
*/
|
|
2563
|
+
screenshotBase64?: string;
|
|
2564
|
+
/** 3.4: logs de console relevantes capturados no momento do report. */
|
|
2565
|
+
consoleLogs?: string;
|
|
2417
2566
|
}
|
|
2418
2567
|
interface SupportNamespace {
|
|
2419
2568
|
/**
|
|
@@ -2429,6 +2578,45 @@ interface SupportNamespace {
|
|
|
2429
2578
|
listMyTickets(options?: {
|
|
2430
2579
|
productSlug?: string;
|
|
2431
2580
|
}): Promise<SupportTicket[]>;
|
|
2581
|
+
/**
|
|
2582
|
+
* 3.4: marca que o usuário viu a notificação de resolução do ticket
|
|
2583
|
+
* (`resolvedNotifiedAt`, idempotente — só seta se ainda `null` no Core).
|
|
2584
|
+
* POST `/api/sdk/v1/support/tickets/{id}/resolved-seen`. Requer Bearer +
|
|
2585
|
+
* ownership + ticket em `resolved`.
|
|
2586
|
+
*/
|
|
2587
|
+
markResolvedSeen(ticketId: string): Promise<void>;
|
|
2588
|
+
/**
|
|
2589
|
+
* 3.4: registra uma tentativa de exibição do modal de satisfação
|
|
2590
|
+
* (`satisfactionAttempts += 1`, `lastSatisfactionAttemptAt = now`).
|
|
2591
|
+
* **Chamar no SHOW do modal, não na resposta** — exibir já conta como
|
|
2592
|
+
* tentativa, evita reprompt infinito. POST
|
|
2593
|
+
* `/api/sdk/v1/support/tickets/{id}/satisfaction-attempt`. Requer Bearer +
|
|
2594
|
+
* ownership + ticket em `resolved`.
|
|
2595
|
+
*/
|
|
2596
|
+
recordSatisfactionAttempt(ticketId: string): Promise<void>;
|
|
2597
|
+
/**
|
|
2598
|
+
* 3.4: envia (ou pula) a avaliação de satisfação. `rating` é CSAT 1-5 ou
|
|
2599
|
+
* `null` (junto de `skipped: true`). Terminal — seta `satisfiedAt`. POST
|
|
2600
|
+
* `/api/sdk/v1/support/tickets/{id}/satisfaction`. Requer Bearer +
|
|
2601
|
+
* ownership.
|
|
2602
|
+
*/
|
|
2603
|
+
submitSatisfaction(input: {
|
|
2604
|
+
ticketId: string;
|
|
2605
|
+
rating: number | null;
|
|
2606
|
+
comment?: string | null;
|
|
2607
|
+
skipped: boolean;
|
|
2608
|
+
}): Promise<void>;
|
|
2609
|
+
/**
|
|
2610
|
+
* 3.4: contesta um ticket resolvido — reabre (`status='open'`) e zera o
|
|
2611
|
+
* ciclo de satisfação/notificação (`resolvedAt`, `resolvedNotifiedAt`,
|
|
2612
|
+
* `satisfactionAttempts`, `lastSatisfactionAttemptAt`, `satisfiedAt`,
|
|
2613
|
+
* `rating`, `satisfactionComment`). POST
|
|
2614
|
+
* `/api/sdk/v1/support/tickets/{id}/contest`. Requer Bearer + ownership +
|
|
2615
|
+
* ticket em `resolved`.
|
|
2616
|
+
*/
|
|
2617
|
+
contestTicket(ticketId: string, opts?: {
|
|
2618
|
+
comment?: string;
|
|
2619
|
+
}): Promise<void>;
|
|
2432
2620
|
}
|
|
2433
2621
|
/**
|
|
2434
2622
|
* Modo do SDK. `dev` ativa mocks automáticos (úteis pra testes e
|
|
@@ -2458,4 +2646,4 @@ interface CatalogListOptions {
|
|
|
2458
2646
|
includeDrafts?: boolean;
|
|
2459
2647
|
}
|
|
2460
2648
|
|
|
2461
|
-
export { NeetruDbError as $, type AiChatChoice as A, type DbChangeType as B, type CatalogListOptions as C, DEFAULT_BASE_URL as D, type DbCollectionRef$1 as E, type DbDoc as F, type DbDocRef as G, type DbGetResult as H, type DbListResult as I, type DbNamespace as J, type DbQuery$1 as K, type DbSqlLease as L, type DbWhereFilter as M, type DbWhereFilter$1 as N, type EntitlementCheck as O, type FieldSentinel as P, type IncrementSentinel as Q, type ListNotificationsOptions as R, MockCheckout as S, MockNotifications as T, MockWebhooks as U, NEETRU_SENTINEL_KEY as V, type NeetruClient as W, type NeetruClientConfig as X, type NeetruDb as Y, type NeetruDbDocuments as Z, type NeetruDbEngine as _, type AiChatMessage as a, type NeetruDbErrorCode as a0, type NeetruDbOptions as a1, type NeetruDbTransport as a2, type NeetruEnv as a3, type NeetruSqlClient as a4, type NeetruUser as a5, type NotificationScopeOptions as a6, type NotificationsNamespace as a7, type Product as a8, type ProductNotification as a9, type
|
|
2649
|
+
export { NeetruDbError as $, type AiChatChoice as A, type DbChangeType as B, type CatalogListOptions as C, DEFAULT_BASE_URL as D, type DbCollectionRef$1 as E, type DbDoc as F, type DbDocRef as G, type DbGetResult as H, type DbListResult as I, type DbNamespace as J, type DbQuery$1 as K, type DbSqlLease as L, type DbWhereFilter as M, type DbWhereFilter$1 as N, type EntitlementCheck as O, type FieldSentinel as P, type IncrementSentinel as Q, type ListNotificationsOptions as R, MockCheckout as S, MockNotifications as T, MockWebhooks as U, NEETRU_SENTINEL_KEY as V, type NeetruClient as W, type NeetruClientConfig as X, type NeetruDb as Y, type NeetruDbDocuments as Z, type NeetruDbEngine as _, type AiChatMessage as a, type NeetruDbErrorCode as a0, type NeetruDbOptions as a1, type NeetruDbTransport as a2, type NeetruEnv as a3, type NeetruSqlClient as a4, type NeetruUser as a5, type NotificationScopeOptions as a6, type NotificationsNamespace as a7, type Product as a8, type ProductNotification as a9, type VerifyWebhookRequestOptions as aA, type VerifyWebhookRequestResult as aB, type WebhookEndpoint as aC, type WebhookEvent as aD, type WebhookScopeOptions as aE, type WebhookTestResult as aF, type WebhooksNamespace as aG, type WithFieldSentinels as aH, __resetDbIdWarningForTests as aI, createAiNamespace as aJ, createCheckoutNamespace as aK, createNeetruDb as aL, createNotificationsNamespace as aM, createRestSyncTransport as aN, createWebhooksNamespace as aO, getWebSocketRealtimeClient as aP, increment as aQ, isFieldSentinel as aR, isIncrementSentinel as aS, isServerTimestampSentinel as aT, serverTimestamp as aU, verifyWebhookRequest as aV, verifyWebhookSignature as aW, type ProductNotificationSeverity as aa, type ProductPlan as ab, type ProductStatus as ac, type RealtimeTransport as ad, type RedirectCallbackResult as ae, type RegisterWebhookInput as af, type ResolvedConfig as ag, type SendNotificationInput as ah, type ServerTimestampSentinel as ai, type SignInOptions as aj, type SqlOptions as ak, type SupportNamespace as al, type SupportSeverity as am, type SupportStatus as an, type SupportTicket as ao, type SyncErrorEvent as ap, type SyncState as aq, type TelemetryEventAck as ar, type TelemetryEventInput as as, type TelemetryLogAck as at, type TelemetryLogInput as au, type Unsubscribe as av, type UsageEventInput as aw, type UsageNamespace as ax, type UsageQuota as ay, type VerifyTokenOptions as az, type AiChatOptions as b, type AiChatResult as c, type AiChatUsage as d, type AiContentPart as e, type AiImageUrlPart as f, type AiNamespace as g, type AiResponseFormat as h, type AiStreamHandle as i, type AiStreamMeta as j, type AiTextPart as k, type AuthNamespace as l, type AuthStateListener as m, type CatalogListResponse as n, type CheckoutAuthOpts as o, type CheckoutIntentInfo as p, type CheckoutIntentStatus as q, type CheckoutNamespace as r, type CheckoutStartInput as s, type CheckoutStartResult as t, type CheckoutTenantType as u, type CompleteSignInResult as v, type ConflictRecord as w, type CreateOfflineDocumentsOptions as x, type CreateTicketInput as y, type DbBatchOp as z };
|
package/dist/usage.d.cts
CHANGED
package/dist/usage.d.ts
CHANGED
package/dist/webhooks.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { U as MockWebhooks, af as RegisterWebhookInput,
|
|
1
|
+
export { U as MockWebhooks, af as RegisterWebhookInput, aA as VerifyWebhookRequestOptions, aB as VerifyWebhookRequestResult, aC as WebhookEndpoint, aD as WebhookEvent, aE as WebhookScopeOptions, aF as WebhookTestResult, aG as WebhooksNamespace, aO as createWebhooksNamespace, aV as verifyWebhookRequest, aW as verifyWebhookSignature } from './types-D-QdG502.cjs';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.cjs';
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { U as MockWebhooks, af as RegisterWebhookInput,
|
|
1
|
+
export { U as MockWebhooks, af as RegisterWebhookInput, aA as VerifyWebhookRequestOptions, aB as VerifyWebhookRequestResult, aC as WebhookEndpoint, aD as WebhookEvent, aE as WebhookScopeOptions, aF as WebhookTestResult, aG as WebhooksNamespace, aO as createWebhooksNamespace, aV as verifyWebhookRequest, aW as verifyWebhookSignature } from './types-BlOLDMR0.js';
|
|
2
2
|
import 'drizzle-orm/node-postgres';
|
|
3
3
|
import './errors.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neetru/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.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",
|