@avakado.ai/schemas 1.1.7 → 1.1.9
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avakado.ai/schemas",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "Canonical Mongo schemas, models, enums and index declarations shared by the Avakado services.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"mongoose": "^8.19.2"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
-
"test": "node
|
|
29
|
+
"test": "node ../../scripts/check-imports.mjs ."
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Schema } from "mongoose";
|
|
2
2
|
import { defineModel, requireDep } from "../runtime.js";
|
|
3
3
|
import { CONVERSATION_PRIORITY, CONVERSATION_STATUS } from "../enums/index.js";
|
|
4
|
-
import { Trigger } from "./Triggers.js";
|
|
5
|
-
|
|
6
4
|
const ConversationSchema = new Schema({
|
|
7
5
|
agent: { type: Schema.Types.ObjectId, ref: 'Agent' }, // the AI agent
|
|
8
6
|
business: { type: Schema.Types.ObjectId, ref: 'Businesses' },
|
|
@@ -79,16 +77,16 @@ ConversationSchema.methods.updateStatus = async function (status) {
|
|
|
79
77
|
});
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
if (businessId) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
80
|
+
// if (businessId) {
|
|
81
|
+
// const trigger = await Trigger.findOne({ business: businessId, name: "conversationStatusUpdated", type: status });
|
|
82
|
+
// for (const workflow of trigger?.workflows ?? []) {
|
|
83
|
+
// await sendKafkaMessage({
|
|
84
|
+
// topic: 'workflow-execution-trigger',
|
|
85
|
+
// message: { key: workflow.toString(), value: JSON.stringify({ conversationId }) },
|
|
86
|
+
// acks: -1
|
|
87
|
+
// });
|
|
88
|
+
// }
|
|
89
|
+
// }
|
|
92
90
|
|
|
93
91
|
return saved;
|
|
94
92
|
};
|
|
@@ -2,12 +2,11 @@ import { Schema } from "mongoose";
|
|
|
2
2
|
import { defineModel } from "../runtime.js";
|
|
3
3
|
|
|
4
4
|
const TriggerTemplateSchema = new Schema({
|
|
5
|
-
name: { type: String, required: true, unique: true }, // convers
|
|
5
|
+
name: { type: String, required: true, unique: true, index: true }, // convers
|
|
6
6
|
description: String,
|
|
7
7
|
type: String,
|
|
8
8
|
payload: Schema.Types.Mixed,
|
|
9
9
|
}, {
|
|
10
10
|
timestamps: true,
|
|
11
11
|
});
|
|
12
|
-
TriggerTemplateSchema.index({ name: 1 });
|
|
13
12
|
export const TriggerTemplate = defineModel("TriggerTemplate", TriggerTemplateSchema, "TriggerTemplate");
|