@indra.ai/deva.data 0.1.4 → 0.1.6

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.
@@ -10,7 +10,30 @@ export default {
10
10
  describe: The global wall feature that installs with every agent
11
11
  ***************/
12
12
  async data(packet) {
13
- const data = await this.methods.sign('data', 'default', packet);
14
- return data;
15
- },
13
+ const info = this.info();
14
+ const agent = this.agent();
15
+ const {id, q} = packet;
16
+ const {meta, text, data} = q;
17
+ const {params} = meta;
18
+ const method = params[1] ? params[1] : 'insert';
19
+ const collection = params[2] ? params[2] : 'PersonalVault';
20
+ const database = params[3] ? params[3] : `${agent.id}-${agent.profile.name.replace(/\s/g, '')}`;
21
+ const answer = await this.question(`${this.askChr}data ${method}:${collection}:${database} ${text}`, {id:q.id, content:q.text});
22
+
23
+ console.log('ANSWER', JSON.stringify(answer, null, 2));
24
+
25
+ this.prompt(`database: ${database}`);
26
+ this.prompt(`collection: ${collection}`);
27
+ this.prompt(`method: ${method}`);
28
+ this.prompt(`text: ${text}`);
29
+
30
+ this.action('resolve', `data:${packet.id.uid}`); // set action reject
31
+ this.state('valid', `data:${packet.id.uid}`); // set action reject
32
+ this.intent('good', `data:${packet.id.uid}`);
33
+ return {
34
+ text: answer.a.text,
35
+ html: answer.a.html,
36
+ data: answer.a.data,
37
+ }
38
+ },
16
39
  };
package/index.js CHANGED
@@ -91,7 +91,7 @@ const DATA = new Deva({
91
91
  this.state('insert', `${opts.collection}:${opts.data.id.uid}`);
92
92
  this.state('connect', `${opts.collection}:${opts.data.id.uid}`);
93
93
  await this.modules.client.connect(); // connect to the database client.
94
- const db = this.modules.client.db(this.vars.database); // set the database to use
94
+ const db = this.modules.client.db(opts.database); // set the database to use
95
95
 
96
96
  result = await db.collection(opts.collection).insertOne(opts.data); // insert the data
97
97
  } finally {
@@ -320,11 +320,12 @@ const DATA = new Deva({
320
320
  return new Promise((resolve, reject) => {
321
321
  const {data, meta} = packet.q;
322
322
  const collection = meta.params[1];
323
- this.func.insert({collection,data}).then(ins => {
324
- this.action('resolve', `insert:${collection}:${insinsertedId}`)
323
+ const database = meta.params[2] || this.vars.database;
324
+ this.func.insert({database, collection,data}).then(ins => {
325
+ this.action('resolve', `insert:${collection}:${ins.insertedId}`)
325
326
  return resolve({
326
- text: `id:${insinsertedId}`,
327
- html: `id:${insinsertedId}`,
327
+ text: `id:${ins.insertedId}`,
328
+ html: `id:${ins.insertedId}`,
328
329
  data: ins,
329
330
  });
330
331
  }).catch(err => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "65859204002504361305",
3
3
  "name": "@indra.ai/deva.data",
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "license": "VLA:65859204002504361305 LICENSE.md",
6
6
  "VLA": {
7
7
  "uid": "65859204002504361305",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "homepage": "https://indra.ai",
61
61
  "dependencies": {
62
- "@indra.ai/deva": "^1.18.0",
62
+ "@indra.ai/deva": "^1.20.2",
63
63
  "mongodb": "^6.13.0"
64
64
  },
65
65
  "data": {
@@ -105,7 +105,7 @@
105
105
  "background": "/devas/data/background.png",
106
106
  "owner": "Quinn Michaels",
107
107
  "creator": "Quinn Michaels",
108
- "copyright": "©2025 Quinn A Michaels; All rights reserved.",
108
+ "copyright": "Copyright ©2025 Quinn A Michaels; All rights reserved.",
109
109
  "created": "Sunday, September 17, 2023 - 5:02:05 PM",
110
110
  "modified": " Saturday, September 6, 2025 - 9:18:59 AM"
111
111
  }