genosdb 0.6.8 → 0.7.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 +8 -2
- package/dist/AIQuery.min.js +3 -3
- package/dist/AIQuery.min.js.gz +0 -0
- package/dist/Geo.min.js +1 -0
- package/dist/Geo.min.js.gz +0 -0
- package/dist/GeolocationOperators.min.js +1 -1
- package/dist/GeolocationOperators.min.js.gz +0 -0
- package/dist/gdb.min.js +1 -1
- package/dist/gdb.min.js.gz +0 -0
- package/dist/index.js +1 -1
- package/dist/index.js.gz +0 -0
- package/dist/radixIndex.min.js +1 -1
- package/dist/radixIndex.min.js.gz +0 -0
- package/dist/{rbac.min.js → sm.min.js} +2 -2
- package/dist/sm.min.js.gz +0 -0
- package/package.json +1 -1
- package/dist/rbac.min.js.gz +0 -0
package/README.md
CHANGED
|
@@ -23,6 +23,8 @@ A lightweight, decentralized graph database designed for modern web applications
|
|
|
23
23
|
|
|
24
24
|
[](https://liberapay.com/estebanrfp/donate)
|
|
25
25
|
|
|
26
|
+
> ⚠️ 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
|
+
|
|
26
28
|
<!-- ### Nostr.band Followers
|
|
27
29
|
|
|
28
30
|
 -->
|
|
@@ -102,19 +104,23 @@ npm install genosdb
|
|
|
102
104
|
```
|
|
103
105
|
|
|
104
106
|
```javascript
|
|
105
|
-
import {
|
|
107
|
+
import { gdb } from "genosdb"
|
|
106
108
|
```
|
|
107
109
|
|
|
108
110
|
### 2. Direct use in browser from a CDN
|
|
109
111
|
|
|
110
112
|
```html
|
|
111
113
|
<script type="module">
|
|
112
|
-
import {
|
|
114
|
+
import { gdb } from "https://cdn.jsdelivr.net/npm/genosdb@latest/dist/index.min.js"
|
|
113
115
|
</script>
|
|
114
116
|
```
|
|
115
117
|
|
|
116
118
|
## Documentation
|
|
117
119
|
|
|
120
|
+
Our formal API reference and technical guides are located in the [`/docs` folder](https://github.com/estebanrfp/gdb/tree/main/docs) of this repository.
|
|
121
|
+
|
|
122
|
+
For community-driven content, tutorials, and live examples, please visit our [GitHub Wiki](https://github.com/estebanrfp/gdb/wiki).
|
|
123
|
+
|
|
118
124
|
For detailed documentation, visit our [GitHub Wiki](https://github.com/estebanrfp/gdb/wiki).
|
|
119
125
|
|
|
120
126
|
For interactive, AI-assisted GenosDB documentation:
|
package/dist/AIQuery.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function j(u){const $=u.map;return u.map=async function(...f){let h={},b=null;if(f.forEach((Y)=>{if(typeof Y==="object")h={...h,...Y};if(typeof Y==="function")b=Y}),h.prompt)try{const Y=await v(h.prompt);console.log("Query generated from AI:",Y),h={...h,...Y},delete h.prompt}catch(Y){console.error("Error generating query from AI:",Y.message),h.query={}}return $.call(this,h,b)},u}async function v(u){const $=`
|
|
2
2
|
You are an assistant that converts natural language instructions into a structured MongoDB query object.
|
|
3
3
|
|
|
4
4
|
Rules:
|
|
@@ -17,5 +17,5 @@ function q(v){const E=v.map;return v.map=async function(...j){let I={},N=null;if
|
|
|
17
17
|
Output: {"query": {"type":"Company", "\$edge": {"role":"Developer", "\$edge": {"name":"Bob"}}}}
|
|
18
18
|
|
|
19
19
|
Instruction:
|
|
20
|
-
"${
|
|
21
|
-
`;try{const
|
|
20
|
+
"${u}"
|
|
21
|
+
`;try{const f=await w($);if(f&&typeof f==="object"&&f.query)return{query:f.query,order:f.order||"asc",field:f.field||Object.keys(f.query)[0]};throw new Error("Invalid AI response format")}catch(f){return console.warn("Using empty query due to AI error:",f.message),{query:{}}}}async function w(u){try{const f=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 converting natural language to structured queries."},{role:"user",content:u}],model:"openai",seed:Math.floor(Math.random()*1000),jsonMode:!0})});if(!f.ok)throw new Error(`Pollinations API error: ${f.statusText}`);const h=await f.json();try{return typeof h==="string"?JSON.parse(h):h}catch{return h}}catch($){throw console.error("Error processing prompt with API:",$.message),$}}var x=(u)=>{return console.log("\uD83E\uDDE0 AI: AIQuery module loaded."),j(u)};export{j as withModule,x as init};
|
package/dist/AIQuery.min.js.gz
CHANGED
|
Binary file
|
package/dist/Geo.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function I(A){console.log("\uD83D\uDCCD Extending GDB with geolocation operators...");const E={$near:(c,f)=>{console.log("Ejecutando operador $near");const{latitude:s,longitude:j,radius:b}=f;if(typeof s!=="number"||typeof j!=="number"||typeof b!=="number")return console.error("Consulta inv\xE1lida para $near:",f),!1;const z=c?.latitude||c?.location?.latitude,p=c?.longitude||c?.location?.longitude;if(typeof z!=="number"||typeof p!=="number")return!1;return F(z,p,s,j)<=b},$bbox:(c,f)=>{console.log("Ejecutando operador $bbox");const{minLat:s,maxLat:j,minLng:b,maxLng:z}=f;if(typeof s!=="number"||typeof j!=="number"||typeof b!=="number"||typeof z!=="number")return console.error("Consulta inv\xE1lida para $bbox:",f),!1;const p=c?.latitude||c?.location?.latitude,k=c?.longitude||c?.location?.longitude;if(typeof p!=="number"||typeof k!=="number")return!1;return p>=s&&p<=j&&k>=b&&k<=z}};function F(c,f,s,j){const b=(H)=>H*Math.PI/180,p=b(s-c),k=b(j-f),C=Math.sin(p/2)*Math.sin(p/2)+Math.cos(b(c))*Math.cos(b(s))*Math.sin(k/2)*Math.sin(k/2);return 6371*(2*Math.atan2(Math.sqrt(C),Math.sqrt(1-C)))}return A.operators={...A.operators,...E},A}var K=(A)=>{return console.log("\uD83D\uDCCD + Geolocation operators."),I(A)};export{I as withModule,K as init};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
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
|