genosdb 0.8.5 → 0.9.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/README.md CHANGED
@@ -23,6 +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)
27
+
26
28
  > ⚠️ 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)
27
29
 
28
30
  <!-- ### Nostr.band Followers
@@ -118,9 +120,12 @@ import { gdb } from "genosdb"
118
120
 
119
121
  ## Documentation
120
122
 
121
- Our formal API reference and technical guides are located in the [`/docs`](https://github.com/estebanrfp/gdb/tree/main/docs) folder of this repository.
123
+ - **Technical Docs**: Find API references and guides in [/docs](https://github.com/estebanrfp/gdb/blob/main/docs/index.md).
124
+
125
+ - **Introduction & Concepts**: Visit our [GitHub Wiki](https://github.com/estebanrfp/gdb/wiki) for an overview.
126
+
127
+ - **Tutorials**: Explore use cases on [Medium](https://medium.com/genosdb).
122
128
 
123
- For community-driven content, detailed documentation, tutorials, and live examples, please visit our [GitHub Wiki](https://github.com/estebanrfp/gdb/wiki).
124
129
 
125
130
  For interactive, AI-assisted GenosDB documentation:
126
131
 
@@ -130,7 +135,14 @@ For interactive, AI-assisted GenosDB documentation:
130
135
 
131
136
  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.
132
137
 
133
- 👉 [Explore Examples](https://github.com/estebanrfp/gdb/wiki/EXAMPLES.md)
138
+ 👉 [Explore /docs/Examples.md](https://github.com/estebanrfp/gdb/blob/main/docs/EXAMPLES.md)
139
+
140
+ ## Roadmap & Whitepaper
141
+
142
+ - [View Roadmap](./ROADMAP.md)
143
+ - [View Whitepaper](./WHITEPAPER.md)
144
+
145
+ ---
134
146
 
135
147
  ### **Internal Dependencies**
136
148
 
package/dist/audit.min.js CHANGED
@@ -1,10 +1,18 @@
1
- async function B($){try{const w=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(!w.ok)throw new Error(`Pollinations API error: ${w.statusText}`);const x=await w.json();try{return typeof x==="string"?JSON.parse(x):x}catch{return x}}catch(S){throw console.error("Error processing prompt with API:",S.message),S}}function F($,S,w={}){console.log("\uD83E\uDDE0 AI Audit module loaded."),console.log(`\uD83E\uDDE0 AI Audit Prompt: \x1B[32m${w.prompt}\x1B[0m`);const{unsubscribe:x}=$.map?.(()=>{E($,w.prompt)})??{unsubscribe:()=>{}};return{stop:()=>x?.()}}var z=($,S=500)=>{let w;return(...x)=>{clearTimeout(w),w=setTimeout(()=>$(...x),S)}},C=async($,S="detect offensive or inappropriate language, spam [find closely spaced timestamps] or prohibited content")=>{const w=$.oplog.getDelta(null),x=[];for(let j of w)try{const{result:h}=await $.get(j.id);if(h&&h.value)x.push({id:j.id,timestamp:j.timestamp,type:j.type,value:h.value})}catch(h){}const v=`
2
- You are an assistant specialized in analyzing and auditing data records. Your role is to help the user identify patterns and act on prompts:
3
-
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=`
4
2
  Rules:
5
3
  - Generate ONLY a valid JSON object whose identifiers have been proposed.
6
4
 
7
- Prompt: "${S}"
8
- Elements to analyze: "${JSON.stringify(x)}" (only upserted nodes)
9
- Output found list example: list:{["id": xx], ["id": xx]} or list:{}
10
- `,k=await B(v);if(k.list&&Array.isArray(k.list))for(let j of k.list){const h=j.id??j;$.remove?.(h),$.oplog?.remove?.(h),console.log(`\uD83D\uDEE1\uFE0F Audit: Node deleted by audit \u2192 ${h}`)}},E=z(C,500);export{F as init,z as debounce};
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.
12
+
13
+ Strict JSON output format:
14
+ list: [
15
+ { "id": "<id>" },
16
+ ...
17
+ ]
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};
Binary file