genosdb 0.10.6 → 0.11.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/LICENSE +7 -1
- package/README.md +8 -7
- package/dist/audit.min.js +1 -21
- package/dist/audit.min.js.gz +0 -0
- package/dist/gdb.min.js +1 -1
- package/dist/gdb.min.js.gz +0 -0
- package/dist/ii.min.js +1 -0
- package/dist/ii.min.js.gz +0 -0
- package/dist/index.js +1 -1
- package/dist/index.js.gz +0 -0
- package/dist/nlq.min.js +1 -0
- package/dist/nlq.min.js.gz +0 -0
- package/dist/rx.min.js +1 -0
- package/dist/rx.min.js.gz +0 -0
- package/dist/sm-gov.min.js +1 -1
- package/dist/sm-gov.min.js.gz +0 -0
- package/dist/sm.min.js +2 -2
- package/dist/sm.min.js.gz +0 -0
- package/package.json +1 -1
- package/dist/AIQuery.min.js +0 -21
- package/dist/AIQuery.min.js.gz +0 -0
- /package/dist/{AIModule.min.js → ai.min.js} +0 -0
- /package/dist/{AIModule.min.js.gz → ai.min.js.gz} +0 -0
- /package/dist/{Geo.min.js → geo.min.js} +0 -0
- /package/dist/{Geo.min.js.gz → geo.min.js.gz} +0 -0
package/dist/sm.min.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "genosdb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
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",
|
package/dist/AIQuery.min.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
You are an assistant that converts natural language instructions into a structured MongoDB query object.
|
|
3
|
-
|
|
4
|
-
Rules:
|
|
5
|
-
- Output ONLY a valid JSON object with the fields: "query", "order", and "field".
|
|
6
|
-
- Use MongoDB operators such as "\$between", "\$gt", "\$lt".
|
|
7
|
-
- For ranges, use "\$between": [min, max].
|
|
8
|
-
- For sorting, use "order": "asc" or "desc" and specify the "field".
|
|
9
|
-
- "\$edge" operator: allows chaining queries to related/descendant entities.
|
|
10
|
-
- No extra text, no explanations, no formatting besides the JSON.
|
|
11
|
-
|
|
12
|
-
Examples:
|
|
13
|
-
Input: "Find people aged 10 to 20 and sort them by age descending"
|
|
14
|
-
Output: {"query": {"age": {"\$between": [10, 20]}}, "order": "desc", "field": "age"}
|
|
15
|
-
|
|
16
|
-
Input: "Find a Company, then find a Developer descendant, then find that Developer's descendant named Bob."
|
|
17
|
-
Output: {"query": {"type":"Company", "\$edge": {"role":"Developer", "\$edge": {"name":"Bob"}}}}
|
|
18
|
-
|
|
19
|
-
Instruction:
|
|
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
DELETED
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|