genosdb 0.23.1 → 0.23.2

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 (2) hide show
  1. package/dist/index.d.ts +36 -10
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -52,10 +52,10 @@ declare module "genosdb" {
52
52
  $or?: Query[]
53
53
  /** Recursive graph traversal: sub-query applied to every descendant. */
54
54
  $edge?: Query
55
- /** Geo module: proximity search (requires `geo: true`). */
56
- $near?: { center: [number, number]; radius: number }
55
+ /** Geo module: proximity search, radius in km (requires `geo: true`). */
56
+ $near?: { latitude: number; longitude: number; radius: number }
57
57
  /** Geo module: bounding-box search (requires `geo: true`). */
58
- $bbox?: [number, number, number, number]
58
+ $bbox?: { minLat: number; maxLat: number; minLng: number; maxLng: number }
59
59
  }
60
60
 
61
61
  /** MongoDB-style filter: field names to literals or operator objects. */
@@ -172,12 +172,29 @@ declare module "genosdb" {
172
172
  }
173
173
 
174
174
  export interface ACLs {
175
- set(nodeId: string, acl: any): Promise<any>
176
- grant(nodeId: string, ethAddress: string, permissions?: any): Promise<any>
175
+ /** Create (value only) or update (value + id). `owner` and `collaborators` are engine-managed: they are stripped from the value and re-based on the stored node. */
176
+ set(value: any, id?: string): Promise<string>
177
+ /** Owner-only. One level per address; granting again replaces the previous level. */
178
+ grant(nodeId: string, ethAddress: string, permission: "read" | "write" | "delete"): Promise<any>
177
179
  revoke(nodeId: string, ethAddress: string): Promise<any>
178
180
  delete(nodeId: string): Promise<any>
179
181
  }
180
182
 
183
+ /** State pushed to `setSecurityStateChangeCallback` on every session change. */
184
+ export interface SecurityState {
185
+ /** A local signer is active: writes can be signed. */
186
+ isActive: boolean
187
+ activeAddress: string | null
188
+ /** Abbreviated address (`0x1234...abcd`) for display. */
189
+ abbrAddr: string
190
+ /** The active session was opened via WebAuthn. */
191
+ isWebAuthnProtected: boolean
192
+ /** A freshly generated identity is held in memory, not yet secured. */
193
+ hasVolatileIdentity: boolean
194
+ /** This device has a WebAuthn registration to log in with. */
195
+ hasWebAuthnHardwareRegistration: boolean
196
+ }
197
+
181
198
  export interface SecurityManager {
182
199
  startNewUserRegistration(): Promise<any>
183
200
  loginCurrentUserWithWebAuthn(): Promise<any>
@@ -190,9 +207,7 @@ declare module "genosdb" {
190
207
  /** Mnemonic held in memory right after registration or recovery, for one-time display. */
191
208
  getMnemonicForDisplayAfterRegistrationOrRecovery(): string | null
192
209
  clearSecurity(): Promise<void>
193
- setSecurityStateChangeCallback(
194
- callback: (state: { isActive: boolean; activeAddress: string | null }) => void
195
- ): void
210
+ setSecurityStateChangeCallback(callback: (state: SecurityState) => void): void
196
211
  setGovernanceStateChangeCallback(callback: (state: any) => void): void
197
212
  assignRole(targetUserEthAddress: string, role: string, expiresAt?: number | string): Promise<any>
198
213
  executeWithPermission(operationName: string): Promise<any>
@@ -208,6 +223,8 @@ declare module "genosdb" {
208
223
  map(options?: QueryOptions): Promise<MapResult>
209
224
  /** Delete an encrypted node by id; the internal SM prefix is handled for you. */
210
225
  remove(id: string): Promise<void>
226
+ /** Abbreviate an address (`0x1234...abcd`) for display. */
227
+ abbrAddr(address: string): string
211
228
  encryptDataForCurrentUser(data: any): Promise<any>
212
229
  decryptDataForCurrentUser(encrypted: any): Promise<any>
213
230
  /** Node-level access control lists. */
@@ -277,8 +294,17 @@ declare module "genosdb" {
277
294
  remove(id: string): Promise<void>
278
295
  /** Delete every node and index. */
279
296
  clear(): Promise<void>
280
- /** Middleware over incoming P2P operation batches. */
281
- use(middleware: (operations: any[]) => Promise<any[]> | any[]): void
297
+ /**
298
+ * Middleware over incoming P2P operation batches. Receives the batch and a
299
+ * Map of each node's previous state; return the (filtered) batch, or
300
+ * nothing to discard the whole message.
301
+ */
302
+ use(
303
+ middleware: (
304
+ operations: any[],
305
+ previousStates: Map<string, any>
306
+ ) => Promise<any[] | void> | any[] | void
307
+ ): void
282
308
  /** P2P room (present when `rtc` is enabled). */
283
309
  room?: Room
284
310
  /** This peer's id (present when `rtc` is enabled). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genosdb",
3
- "version": "0.23.1",
3
+ "version": "0.23.2",
4
4
  "description": "GenosDB (GDB): distributed graph database in real-time, peer-to-peer, scalable storage - efficient querying of complex relationships.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",