genosdb 0.15.0 → 0.15.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/README.md +16 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.min.js.gz +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -27,6 +27,7 @@ A lightweight, decentralized graph database designed for modern web applications
|
|
|
27
27
|
 -->
|
|
28
28
|
|
|
29
29
|
## Table of Contents
|
|
30
|
+
- [How it works](#how-it-works)
|
|
30
31
|
- [Main Features](#main-features)
|
|
31
32
|
- [Project Status](#project-status)
|
|
32
33
|
- [Installation](#installation)
|
|
@@ -36,6 +37,21 @@ A lightweight, decentralized graph database designed for modern web applications
|
|
|
36
37
|
- [Business Inquiries Collaboration](#business-inquiries--collaboration)
|
|
37
38
|
|
|
38
39
|
|
|
40
|
+
## How it works
|
|
41
|
+
|
|
42
|
+
GenosDB runs **entirely in your browser** — there is no central database server. The Security Manager signs every operation with your key, nodes are stored locally in OPFS, and changes replicate **peer-to-peer over WebRTC**. Nostr relays only help peers discover each other — they never see your data.
|
|
43
|
+
|
|
44
|
+
```mermaid
|
|
45
|
+
%%{init: {'theme':'base', 'themeVariables': {'primaryColor':'transparent','primaryBorderColor':'#3b82f6','primaryTextColor':'#64748b','lineColor':'#3b82f6','edgeLabelBackground':'#22222200','fontFamily':'Inter, ui-sans-serif, sans-serif'}}}%%
|
|
46
|
+
graph TD
|
|
47
|
+
A["Your Browser + GenosDB"] -->|signs every action| B["Security Manager — your key"]
|
|
48
|
+
A -->|stores nodes| C["Graph store · OPFS"]
|
|
49
|
+
A -->|reactive queries| D["db.map subscriptions"]
|
|
50
|
+
C -->|P2P delta sync over WebRTC| E["Other Participants"]
|
|
51
|
+
C -->|cross-tab| F["BroadcastChannel"]
|
|
52
|
+
G["Nostr relays"] -.->|signaling / peer discovery only| A
|
|
53
|
+
```
|
|
54
|
+
|
|
39
55
|
## Main Features
|
|
40
56
|
|
|
41
57
|
### ✅ **GenosDB Core**
|
package/dist/geo.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function $(U){let O={$near:(z,J)=>{let{latitude:A,longitude:E,radius:I}=J;if(typeof A!=="number"||typeof E!=="number"||typeof I!=="number")return!1;let S=z?.latitude||z?.location?.latitude,F=z?.longitude||z?.location?.longitude;if(typeof S!=="number"||typeof F!=="number")return!1;return q(S,F,A,E)<=I},$bbox:(z,J)=>{let{minLat:A,maxLat:E,minLng:I,maxLng:S}=J;if(typeof A!=="number"||typeof E!=="number"||typeof I!=="number"||typeof S!=="number")return!1;let F=z?.latitude||z?.location?.latitude,H=z?.longitude||z?.location?.longitude;if(typeof F!=="number"||typeof H!=="number")return!1;return F>=A&&F<=E&&H>=I&&H<=S}};function q(z,J,A,E){let I=(W)=>W*Math.PI/180,S=6371,F=I(A-z),H=I(E-J),T=Math.sin(F/2)*Math.sin(F/2)+Math.cos(I(z))*Math.cos(I(A))*Math.sin(H/2)*Math.sin(H/2);return 6371*(2*Math.atan2(Math.sqrt(T),Math.sqrt(1-T)))}U.operators={...U.operators,...O};let k=(z)=>{let J=[];if(!z||typeof z!=="object")return{geoConditions:J,restQuery:z};let A={};for(let[E,I]of Object.entries(z)){if(E==="$near"||E==="$bbox"){J.push({op:E,params:I});continue}if(I&&typeof I==="object"&&!Array.isArray(I)){let S={},F=!1;for(let[H,T]of Object.entries(I))if(H==="$near"||H==="$bbox")J.push({op:H,params:T}),F=!0;else S[H]=T;if(F){if(Object.keys(S).length)A[E]=S;continue}}A[E]=I}return{geoConditions:J,restQuery:A}},j=(z,J)=>z!=null&&J.every(({op:A,params:E})=>O[A](z,E)),Q=(z,J)=>J.split(".").reduce((A,E)=>A&&typeof A==="object"&&(E in A)?A[E]:void 0,z),R=(z,{field:J,order:A,$after:E,$before:I,$limit:S})=>{let F=[...z];if(J){let H=A==="asc"?1:-1;F.sort((T,_)=>{let W=Q(T.value,J),Y=Q(_.value,J);if(typeof W==="string"&&typeof Y==="string")return W.localeCompare(Y)*H;return((W??0)-(Y??0))*H})}if(E){let H=F.findIndex((T)=>T.id===E);F=H>=0?F.slice(H+1):[]}if(I){let H=F.findIndex((T)=>T.id===I);F=H>=0?F.slice(0,H):[]}if(S)F=F.slice(0,S);return F},N=U.map;return U.map=async(...z)=>{let J=z.find((K)=>K&&typeof K==="object")??{},A=z.find((K)=>typeof K==="function"),{geoConditions:E,restQuery:I}=k(J.query);if(!E.length)return N(...z);let{query:S,field:F,order:H,$limit:T,$after:_,$before:W,...Y}=J,x={...Y,query:I},M={field:F,order:H,$limit:T,$after:_,$before:W};if(!A){let{results:K=[]}=await N(x);return{results:R(K.filter((X)=>j(X.value,E)),M)}}let Z=new Set,B=await N(x,(K)=>{let{id:X,value:G,action:D}=K;if(D==="removed"){if(Z.delete(X))A(K);return}let P=j(G,E),w=Z.has(X);if(P&&!w)Z.add(X),A(D==="updated"?{...K,action:"added"}:K);else if(P&&w)A(K);else if(!P&&w)Z.delete(X),A({...K,value:null,action:"removed"})}),C=R((B.results??[]).filter((K)=>j(K.value,E)),M);return C.forEach((K)=>Z.add(K.id)),{...B,results:C}},U}var b=(U)=>{return $(U)};export{$ as withModule,b as init};
|
package/dist/geo.min.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genosdb",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.1",
|
|
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",
|