@abraca/dabra 2.96.0 → 2.97.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/dist/index.d.ts CHANGED
@@ -1,125 +1,13 @@
1
1
  import { Event, MessageEvent } from "ws";
2
+ import * as y_protocols_awareness0 from "y-protocols/awareness";
3
+ import { Awareness } from "y-protocols/awareness";
2
4
  import * as Y from "yjs";
5
+ import * as lib0_encoding0 from "lib0/encoding";
6
+ import { Encoder } from "lib0/encoding";
7
+ import * as decoding from "lib0/decoding";
8
+ import { Decoder } from "lib0/decoding";
9
+ import { wordlist } from "@scure/bip39/wordlists/english.js";
3
10
 
4
- //#region node_modules/lib0/observable.d.ts
5
- /**
6
- * Handles named events.
7
- *
8
- * @deprecated
9
- * @template N
10
- */
11
- declare class Observable<N> {
12
- /**
13
- * Some desc.
14
- * @type {Map<N, any>}
15
- */
16
- _observers: Map<N, any>;
17
- /**
18
- * @param {N} name
19
- * @param {function} f
20
- */
21
- on(name: N, f: Function): void;
22
- /**
23
- * @param {N} name
24
- * @param {function} f
25
- */
26
- once(name: N, f: Function): void;
27
- /**
28
- * @param {N} name
29
- * @param {function} f
30
- */
31
- off(name: N, f: Function): void;
32
- /**
33
- * Emit a named event. All registered event listeners that listen to the
34
- * specified name will receive the event.
35
- *
36
- * @todo This should catch exceptions
37
- *
38
- * @param {N} name The event name.
39
- * @param {Array<any>} args The arguments that are applied to the event listener.
40
- */
41
- emit(name: N, args: Array<any>): void;
42
- destroy(): void;
43
- }
44
- //#endregion
45
- //#region node_modules/y-protocols/awareness.d.ts
46
- /**
47
- * @typedef {Object} MetaClientState
48
- * @property {number} MetaClientState.clock
49
- * @property {number} MetaClientState.lastUpdated unix timestamp
50
- */
51
- /**
52
- * The Awareness class implements a simple shared state protocol that can be used for non-persistent data like awareness information
53
- * (cursor, username, status, ..). Each client can update its own local state and listen to state changes of
54
- * remote clients. Every client may set a state of a remote peer to `null` to mark the client as offline.
55
- *
56
- * Each client is identified by a unique client id (something we borrow from `doc.clientID`). A client can override
57
- * its own state by propagating a message with an increasing timestamp (`clock`). If such a message is received, it is
58
- * applied if the known state of that client is older than the new state (`clock < newClock`). If a client thinks that
59
- * a remote client is offline, it may propagate a message with
60
- * `{ clock: currentClientClock, state: null, client: remoteClient }`. If such a
61
- * message is received, and the known clock of that client equals the received clock, it will override the state with `null`.
62
- *
63
- * Before a client disconnects, it should propagate a `null` state with an updated clock.
64
- *
65
- * Awareness states must be updated every 30 seconds. Otherwise the Awareness instance will delete the client state.
66
- *
67
- * @extends {Observable<string>}
68
- */
69
- declare class Awareness extends Observable<string> {
70
- /**
71
- * @param {Y.Doc} doc
72
- */
73
- constructor(doc: Y.Doc);
74
- doc: Y.Doc;
75
- /**
76
- * @type {number}
77
- */
78
- clientID: number;
79
- /**
80
- * Maps from client id to client state
81
- * @type {Map<number, Object<string, any>>}
82
- */
83
- states: Map<number, {
84
- [x: string]: any;
85
- }>;
86
- /**
87
- * @type {Map<number, MetaClientState>}
88
- */
89
- meta: Map<number, MetaClientState>;
90
- _checkInterval: any;
91
- /**
92
- * @return {Object<string,any>|null}
93
- */
94
- getLocalState(): {
95
- [x: string]: any;
96
- } | null;
97
- /**
98
- * @param {Object<string,any>|null} state
99
- */
100
- setLocalState(state: {
101
- [x: string]: any;
102
- } | null): void;
103
- /**
104
- * @param {string} field
105
- * @param {any} value
106
- */
107
- setLocalStateField(field: string, value: any): void;
108
- /**
109
- * @return {Map<number,Object<string,any>>}
110
- */
111
- getStates(): Map<number, {
112
- [x: string]: any;
113
- }>;
114
- }
115
- type MetaClientState = {
116
- clock: number;
117
- /**
118
- * unix timestamp
119
- */
120
- lastUpdated: number;
121
- };
122
- //#endregion
123
11
  //#region packages/provider/src/EventEmitter.d.ts
124
12
  declare class EventEmitter {
125
13
  callbacks: {
@@ -1826,19 +1714,6 @@ declare class AbracadabraProvider extends AbracadabraBaseProvider {
1826
1714
  destroy(): void;
1827
1715
  }
1828
1716
  //#endregion
1829
- //#region node_modules/lib0/encoding.d.ts
1830
- /**
1831
- * A BinaryEncoder handles the encoding to an Uint8Array.
1832
- */
1833
- declare class Encoder {
1834
- cpos: number;
1835
- cbuf: Uint8Array<ArrayBuffer>;
1836
- /**
1837
- * @type {Array<Uint8Array>}
1838
- */
1839
- bufs: Array<Uint8Array>;
1840
- }
1841
- //#endregion
1842
1717
  //#region packages/provider/src/CloseEvents.d.ts
1843
1718
  interface CloseEvent {
1844
1719
  code: number;
@@ -1870,30 +1745,6 @@ declare const Forbidden: CloseEvent;
1870
1745
  */
1871
1746
  declare const ConnectionTimeout: CloseEvent;
1872
1747
  //#endregion
1873
- //#region node_modules/lib0/decoding.d.ts
1874
- /**
1875
- * A Decoder handles the decoding of an Uint8Array.
1876
- * @template {ArrayBufferLike} [Buf=ArrayBufferLike]
1877
- */
1878
- declare class Decoder<Buf extends ArrayBufferLike = ArrayBufferLike> {
1879
- /**
1880
- * @param {Uint8Array<Buf>} uint8Array Binary data to decode
1881
- */
1882
- constructor(uint8Array: Uint8Array<Buf>);
1883
- /**
1884
- * Decoding target.
1885
- *
1886
- * @type {Uint8Array<Buf>}
1887
- */
1888
- arr: Uint8Array<Buf>;
1889
- /**
1890
- * Current decoding position.
1891
- *
1892
- * @type {number}
1893
- */
1894
- pos: number;
1895
- }
1896
- //#endregion
1897
1748
  //#region packages/provider/src/IncomingMessage.d.ts
1898
1749
  declare class IncomingMessage {
1899
1750
  data: any;
@@ -1923,42 +1774,42 @@ declare class OutgoingMessage implements OutgoingMessageInterface {
1923
1774
  declare class AuthenticationMessage extends OutgoingMessage {
1924
1775
  type: MessageType;
1925
1776
  description: string;
1926
- get(args: Partial<OutgoingMessageArguments>): Encoder;
1777
+ get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
1927
1778
  }
1928
1779
  //#endregion
1929
1780
  //#region packages/provider/src/OutgoingMessages/AwarenessMessage.d.ts
1930
1781
  declare class AwarenessMessage extends OutgoingMessage {
1931
1782
  type: MessageType;
1932
1783
  description: string;
1933
- get(args: Partial<OutgoingMessageArguments>): Encoder;
1784
+ get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
1934
1785
  }
1935
1786
  //#endregion
1936
1787
  //#region packages/provider/src/OutgoingMessages/QueryAwarenessMessage.d.ts
1937
1788
  declare class QueryAwarenessMessage extends OutgoingMessage {
1938
1789
  type: MessageType;
1939
1790
  description: string;
1940
- get(args: Partial<OutgoingMessageArguments>): Encoder;
1791
+ get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
1941
1792
  }
1942
1793
  //#endregion
1943
1794
  //#region packages/provider/src/OutgoingMessages/SyncStepOneMessage.d.ts
1944
1795
  declare class SyncStepOneMessage extends OutgoingMessage {
1945
1796
  type: MessageType;
1946
1797
  description: string;
1947
- get(args: Partial<OutgoingMessageArguments>): Encoder;
1798
+ get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
1948
1799
  }
1949
1800
  //#endregion
1950
1801
  //#region packages/provider/src/OutgoingMessages/SyncStepTwoMessage.d.ts
1951
1802
  declare class SyncStepTwoMessage extends OutgoingMessage {
1952
1803
  type: MessageType;
1953
1804
  description: string;
1954
- get(args: Partial<OutgoingMessageArguments>): Encoder;
1805
+ get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
1955
1806
  }
1956
1807
  //#endregion
1957
1808
  //#region packages/provider/src/OutgoingMessages/UpdateMessage.d.ts
1958
1809
  declare class UpdateMessage extends OutgoingMessage {
1959
1810
  type: MessageType;
1960
1811
  description: string;
1961
- get(args: Partial<OutgoingMessageArguments>): Encoder;
1812
+ get(args: Partial<OutgoingMessageArguments>): lib0_encoding0.Encoder;
1962
1813
  }
1963
1814
  //#endregion
1964
1815
  //#region packages/provider/src/types.d.ts
@@ -3268,6 +3119,10 @@ declare class AbracadabraBaseProvider extends EventEmitter {
3268
3119
  */
3269
3120
  subscribeQuery(spec: QuerySpec, handlers?: QuerySubscriptionHandlers): QuerySubscriptionHandle;
3270
3121
  constructor(configuration: AbracadabraBaseProviderConfiguration);
3122
+ /** A periodic re-sync tick that was skipped because the app was hidden. */
3123
+ missedForceSync: boolean;
3124
+ /** Detaches the force-sync lifecycle subscription, when one was installed. */
3125
+ unsubscribeForceSyncLifecycle: (() => void) | null;
3271
3126
  boundDocumentUpdateHandler: (update: Uint8Array, origin: any) => void;
3272
3127
  boundAwarenessUpdateHandler: ({
3273
3128
  added,
@@ -3543,11 +3398,11 @@ declare enum AuthMessageType {
3543
3398
  PermissionDenied = 1,
3544
3399
  Authenticated = 2
3545
3400
  }
3546
- declare const writeAuthentication: (encoder: Encoder, auth: string) => void;
3547
- declare const writePermissionDenied: (encoder: Encoder, reason: string) => void;
3548
- declare const writeAuthenticated: (encoder: Encoder, scope: AuthorizedScope) => void;
3549
- declare const writeTokenSyncRequest: (encoder: Encoder) => void;
3550
- declare const readAuthMessage: (decoder: Decoder, sendToken: () => void, permissionDeniedHandler: (reason: string) => void, authenticatedHandler: (scope: string) => void) => void;
3401
+ declare const writeAuthentication: (encoder: lib0_encoding0.Encoder, auth: string) => void;
3402
+ declare const writePermissionDenied: (encoder: lib0_encoding0.Encoder, reason: string) => void;
3403
+ declare const writeAuthenticated: (encoder: lib0_encoding0.Encoder, scope: AuthorizedScope) => void;
3404
+ declare const writeTokenSyncRequest: (encoder: lib0_encoding0.Encoder) => void;
3405
+ declare const readAuthMessage: (decoder: decoding.Decoder, sendToken: () => void, permissionDeniedHandler: (reason: string) => void, authenticatedHandler: (scope: string) => void) => void;
3551
3406
  //#endregion
3552
3407
  //#region packages/provider/src/awarenessStatesToArray.d.ts
3553
3408
  declare const awarenessStatesToArray: (states: Map<number, Record<string, any>>) => {
@@ -3568,7 +3423,7 @@ declare const awarenessStatesToArray: (states: Map<number, Record<string, any>>)
3568
3423
  declare class SubdocMessage extends OutgoingMessage {
3569
3424
  type: MessageType;
3570
3425
  description: string;
3571
- get(args: Partial<AbracadabraOutgoingMessageArguments>): Encoder;
3426
+ get(args: Partial<AbracadabraOutgoingMessageArguments>): lib0_encoding0.Encoder;
3572
3427
  }
3573
3428
  //#endregion
3574
3429
  //#region packages/provider/src/NodeIdentity.d.ts
@@ -4564,7 +4419,7 @@ interface AbracadabraWebRTCConfiguration {
4564
4419
  /** Optional Y.Doc to sync over data channels (hybrid mode). */
4565
4420
  document?: InstanceType<typeof Y.Doc> | null;
4566
4421
  /** Optional Awareness instance for presence sync over data channels. */
4567
- awareness?: InstanceType<typeof Awareness> | null;
4422
+ awareness?: InstanceType<typeof y_protocols_awareness0.Awareness> | null;
4568
4423
  /** ICE server configuration. Defaults to Google STUN. */
4569
4424
  iceServers?: RTCIceServer[];
4570
4425
  /** Display name for this peer. */
@@ -5546,10 +5401,6 @@ declare class NotificationsClient extends EventEmitter {
5546
5401
  private handleServerError;
5547
5402
  }
5548
5403
  //#endregion
5549
- //#region node_modules/@scure/bip39/wordlists/english.d.ts
5550
- /** English BIP39 wordlist. */
5551
- declare const wordlist: string[];
5552
- //#endregion
5553
5404
  //#region packages/provider/src/MnemonicKeyDerivation.d.ts
5554
5405
  /**
5555
5406
  * Generate a new BIP-39 mnemonic phrase.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/dabra",
3
- "version": "2.96.0",
3
+ "version": "2.97.0",
4
4
  "description": "abracadabra provider",
5
5
  "keywords": [
6
6
  "abracadabra",
@@ -35,7 +35,7 @@
35
35
  "yjs": "^13.6.8"
36
36
  },
37
37
  "devDependencies": {
38
- "@abraca/schema": "2.96.0"
38
+ "@abraca/schema": "2.97.0"
39
39
  },
40
40
  "scripts": {
41
41
  "test": "node --no-warnings --conditions=source --experimental-transform-types --test 'tests/*.test.ts'"