genosdb 0.9.3 → 0.9.4

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 CHANGED
@@ -23,7 +23,8 @@ A lightweight, decentralized graph database designed for modern web applications
23
23
 
24
24
  [![Liberapay receiving](https://img.shields.io/liberapay/receives/estebanrfp.svg?logo=liberapay)](https://liberapay.com/estebanrfp/donate)
25
25
 
26
- > ✅ GenosDB uses network access by design for real-time P2P synchronization (Socket.dev notice)
26
+
27
+ > ✅ GenosDB uses network access by design for real-time P2P synchronization 👉 { rtc: true }
27
28
 
28
29
  > ⚠️ Migration Guide: The class-based API `new GDB()` has been removed. Please migrate to the async factory function. See the guide: [MIGRATION.md](./MIGRATION.md)
29
30
 
@@ -82,7 +83,7 @@ GenosDB is in active beta and soon will deliver its first stable release, v1.0.0
82
83
  - Digital signature of critical operations
83
84
  - Real-time permission validation
84
85
  - Secure storage of roles in internal graph
85
- - [Security Implementation](https://github.com/estebanrfp/gdb/wiki/RBAC-Security)
86
+ - [Security Manager (SM Architecture)](https://github.com/estebanrfp/gdb/blob/main/docs/sm-architecture.md)
86
87
 
87
88
  > **Important Notice**: This project has progressed from its active development phase and is now in the beta stage. While it is functional and stable in controlled environments, it is recommended to evaluate its suitability for production based on the specific needs of your environment. For more details, please refer to the [Project Status](#project-status)
88
89
 
@@ -135,7 +136,7 @@ For interactive, AI-assisted GenosDB documentation:
135
136
 
136
137
  We’ve created a collection of interactive examples to help you understand how GDB works in real-world scenarios. These examples cover everything from basic setup to advanced features like RBAC and P2P synchronization.
137
138
 
138
- 👉 [Explore /docs/Examples.md](https://github.com/estebanrfp/gdb/blob/main/docs/EXAMPLES.md)
139
+ 👉 [Explore /docs/Examples](https://github.com/estebanrfp/gdb/blob/main/docs/genosdb-examples.md)
139
140
 
140
141
  ## Roadmap & Whitepaper
141
142
 
@@ -189,6 +190,14 @@ The project includes an interactive visualization of the repository's history an
189
190
 
190
191
  This graphical view is especially useful for new contributors or anyone looking to gain deeper insight into the project’s evolution and structure, providing a clear and visual understanding of the workflow.
191
192
 
193
+ ## Presentation Video
194
+
195
+ <div align="center">
196
+ <a href="https://www.youtube.com/watch?v=Lkw4hQpgt50">
197
+ <img src="https://img.youtube.com/vi/Lkw4hQpgt50/0.jpg" alt="GenosDB Presentation" width="100%" />
198
+ </a>
199
+ </div>
200
+
192
201
  ## Contributing
193
202
 
194
203
  We welcome contributions to improve this project! Please read our [Contribution Guidelines](CONTRIBUTING.md) for details on how to get started.
package/dist/audit.min.js CHANGED
@@ -1,18 +1,21 @@
1
- async function E(v){try{const x=await fetch("https://text.pollinations.ai/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"system",content:"You are an assistant specialized in analyzing Oplog data."},{role:"user",content:v}],model:"openai",seed:Math.floor(Math.random()*1000),jsonMode:!0})});if(!x.ok)throw new Error(`Pollinations API error: ${x.statusText}`);const h=await x.json();try{return typeof h==="string"?JSON.parse(h):h}catch{return h}}catch(j){throw console.error("Error processing prompt with API:",j.message),j}}function J(v,j,x={}){console.log("\uD83E\uDDE0 AI Audit module loaded."),console.log(`\uD83E\uDDE0 AI Audit Prompt: \x1B[32m${x.prompt}\x1B[0m`);let h=null;function B(w){if(h)h();h=((v.map?.(({id:S,value:H,action:z})=>{if(console.log(z),z==="added"||z==="updated"||z==="initial")G(v,w)}))??{unsubscribe:()=>{}}).unsubscribe}return B(x.prompt),{stop:()=>h?.()}}var C=(v,j=500)=>{let x;return(...h)=>{clearTimeout(x),x=setTimeout(()=>v(...h),j)}},F=async(v,j="detect offensive or inappropriate language, spam [find closely spaced timestamps] or prohibited content")=>{console.log("\uD83D\uDEE1\uFE0F Audit: analizing Oplog data");const x=v.oplog.getDelta(null),h=[];for(let k of x)try{const{result:S}=await v.get(k.id);if(S&&S.value)h.push({id:k.id,timestamp:k.timestamp,type:k.type,value:S.value})}catch(S){}const B=`
2
- Rules:
3
- - Generate ONLY a valid JSON object whose identifiers have been proposed.
1
+ async function F($){try{const j=await fetch("https://text.pollinations.ai/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:[{role:"system",content:"You are an assistant specialized in analyzing Oplog data."},{role:"user",content:$}],model:"openai",seed:Math.floor(Math.random()*1000),jsonMode:!0})});if(!j.ok)throw new Error(`Pollinations API error: ${j.statusText}`);const v=await j.json();try{return typeof v==="string"?JSON.parse(v):v}catch{return v}}catch(w){throw console.error("Error processing prompt with API:",w.message),w}}function J($,w,j={}){console.log("\uD83E\uDDE0 AI Audit module loaded."),console.log(`\uD83E\uDDE0 AI Audit Prompt: \x1B[32m${j.prompt}\x1B[0m`);let v=null;function B(z){if(v)v();v=(($.map?.(({id:k,value:I,action:C})=>{if(C==="added"||C==="updated"||C==="initial")H($,z)}))??{unsubscribe:()=>{}}).unsubscribe}return B(j.prompt),{stop:()=>v?.()}}var E=($,w=500)=>{let j;return(...v)=>{clearTimeout(j),j=setTimeout(()=>$(...v),w)}},G=async($,w="Flag offensive/prohibited content and consecutive entries with timestamps <150ms apart.")=>{console.log("\uD83D\uDEE1\uFE0F Audit: analizing Oplog data");const j=$.oplog.getDelta(null),v=[];for(let x of j)try{const{result:k}=await $.get(x.id);if(k&&k.value)v.push({id:x.id,timestamp:x.timestamp,type:x.type,value:k.value})}catch(k){}const B=`
2
+ You are an assistant specialized in analyzing Oplog data.
4
3
 
5
- Prompt: "${j}"
6
- Elements to analyze: "${JSON.stringify(h)}" (only upserted nodes)
7
-
8
- Evaluate each task.
9
- For each object:
10
- - Include the object's ID in the output list **only if it meets the conditions of the audit prompt**.
11
- - Do not modify the objects.
4
+ Analyze the following array of JSON objects called "elements":
5
+ ${JSON.stringify(v,null,2)}
12
6
 
13
- Strict JSON output format:
14
- list: [
15
- { "id": "<id>" },
16
- ...
7
+ Use the following criteria:
8
+ "${w}"
9
+
10
+ Rules:
11
+ - Return ONLY a JSON object with a property "list", which is an array of objects containing the IDs of the elements that meet the criteria.
12
+ - If an element does NOT meet the criteria, do NOT include its ID.
13
+ - Do NOT modify the original objects.
14
+
15
+ Example output format:
16
+ {
17
+ "list": [
18
+ { "id": "<id>" }
17
19
  ]
18
- `,w=await E(B);if(w.list&&Array.isArray(w.list))for(let k of w.list){const S=k.id??k;v.remove?.(S),v.oplog?.remove?.(S),console.log(`\uD83D\uDEE1\uFE0F Audit: Node deleted by audit \u2192 ${S}`)}},G=C(F,500);export{J as init,C as debounce};
20
+ }
21
+ `,z=await F(B);if(z.list&&Array.isArray(z.list))for(let x of z.list){const k=x.id??x;$.remove?.(k),$.oplog?.remove?.(k),console.log(`\uD83D\uDEE1\uFE0F Audit: Node deleted by audit \u2192 ${k}`)}},H=E(G,500);export{J as init,E as debounce};
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "genosdb",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
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",
@@ -1 +0,0 @@
1
- function H(w){const A={$near:(b,f)=>{console.log("Ejecutando operador $near");const{latitude:p,longitude:h,radius:s}=f;if(typeof p!=="number"||typeof h!=="number"||typeof s!=="number")return console.error("Consulta inv\xE1lida para $near:",f),!1;const k=b?.latitude||b?.location?.latitude,c=b?.longitude||b?.location?.longitude;if(typeof k!=="number"||typeof c!=="number")return!1;return C(k,c,p,h)<=s},$bbox:(b,f)=>{console.log("Ejecutando operador $bbox");const{minLat:p,maxLat:h,minLng:s,maxLng:k}=f;if(typeof p!=="number"||typeof h!=="number"||typeof s!=="number"||typeof k!=="number")return console.error("Consulta inv\xE1lida para $bbox:",f),!1;const c=b?.latitude||b?.location?.latitude,j=b?.longitude||b?.location?.longitude;if(typeof c!=="number"||typeof j!=="number")return!1;return c>=p&&c<=h&&j>=s&&j<=k}};function C(b,f,p,h){const s=(E)=>E*Math.PI/180,c=s(p-b),j=s(h-f),z=Math.sin(c/2)*Math.sin(c/2)+Math.cos(s(b))*Math.cos(s(p))*Math.sin(j/2)*Math.sin(j/2);return 6371*(2*Math.atan2(Math.sqrt(z),Math.sqrt(1-z)))}return w.operators={...w.operators,...A},w}export{H as withModule};
Binary file