@abraca/dabra 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.ts CHANGED
@@ -1,8 +1,15 @@
1
- export * from "./HocuspocusProvider.ts";
2
- export * from "./HocuspocusProviderWebsocket.ts";
1
+ export * from "./AbracadabraBaseProvider.ts";
2
+ export * from "./AbracadabraWS.ts";
3
3
  export * from "./types.ts";
4
4
  export * from "./AbracadabraProvider.ts";
5
5
  export * from "./AbracadabraClient.ts";
6
6
  export * from "./OfflineStore.ts";
7
+ export * from "./auth.ts";
8
+ export * from "./CloseEvents.ts";
9
+ export * from "./awarenessStatesToArray.ts";
7
10
  export { SubdocMessage } from "./OutgoingMessages/SubdocMessage.ts";
8
11
  export { CryptoIdentityKeystore } from "./CryptoIdentityKeystore.ts";
12
+ export { DocumentCache } from "./DocumentCache.ts";
13
+ export type { DocumentCacheOptions } from "./DocumentCache.ts";
14
+ export { SearchIndex } from "./SearchIndex.ts";
15
+ export { FileBlobStore } from "./FileBlobStore.ts";
package/src/types.ts CHANGED
@@ -2,7 +2,7 @@ import type { Encoder } from "lib0/encoding";
2
2
  import type { Event, MessageEvent } from "ws";
3
3
  import type { Awareness } from "y-protocols/awareness";
4
4
  import type * as Y from "yjs";
5
- import type { CloseEvent } from "@abraca/dabra-common";
5
+ import type { CloseEvent } from "./CloseEvents.ts";
6
6
  import type { IncomingMessage } from "./IncomingMessage.ts";
7
7
  import type { OutgoingMessage } from "./OutgoingMessage.ts";
8
8
  import type { AuthenticationMessage } from "./OutgoingMessages/AuthenticationMessage.ts";
@@ -12,6 +12,17 @@ import type { SyncStepOneMessage } from "./OutgoingMessages/SyncStepOneMessage.t
12
12
  import type { SyncStepTwoMessage } from "./OutgoingMessages/SyncStepTwoMessage.ts";
13
13
  import type { UpdateMessage } from "./OutgoingMessages/UpdateMessage.ts";
14
14
 
15
+ /**
16
+ * State of the WebSocket connection.
17
+ * https://developer.mozilla.org/de/docs/Web/API/WebSocket/readyState
18
+ */
19
+ export enum WsReadyStates {
20
+ Connecting = 0,
21
+ Open = 1,
22
+ Closing = 2,
23
+ Closed = 3,
24
+ }
25
+
15
26
  export enum MessageType {
16
27
  Sync = 0,
17
28
  Awareness = 1,
@@ -193,3 +204,37 @@ export interface HealthStatus {
193
204
  version: string;
194
205
  active_documents: number;
195
206
  }
207
+
208
+ export interface ServerInfo {
209
+ /** Human-readable server name set by the operator. */
210
+ name?: string;
211
+ /** Server version string. */
212
+ version?: string;
213
+ /** Entry-point document ID advertised by the server, if configured. */
214
+ index_doc_id?: string;
215
+ }
216
+
217
+ // ── Search ───────────────────────────────────────────────────────────────────
218
+
219
+ export interface SearchResult {
220
+ docId: string;
221
+ /** Number of matching trigrams — higher is better. */
222
+ score: number;
223
+ }
224
+
225
+ // ── Upload queue ─────────────────────────────────────────────────────────────
226
+
227
+ export type UploadQueueStatus = "pending" | "uploading" | "done" | "error";
228
+
229
+ export interface UploadQueueEntry {
230
+ /** Client-generated UUID. */
231
+ id: string;
232
+ docId: string;
233
+ /** File or Blob to upload. File extends Blob and survives IDB as Blob. */
234
+ file: Blob;
235
+ /** Eagerly captured filename (from File.name or explicit arg). */
236
+ filename: string;
237
+ status: UploadQueueStatus;
238
+ createdAt: number;
239
+ error?: string;
240
+ }