@ainetwork/adk-provider-memory-mongodb 0.4.1 → 0.5.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.
Files changed (49) hide show
  1. package/dist/{chunk-EPJZT2YE.js → chunk-2XJ6S2W5.js} +6 -1
  2. package/dist/chunk-2XJ6S2W5.js.map +1 -0
  3. package/dist/{chunk-T5WRFXBY.js → chunk-QULDFKGZ.js} +2 -1
  4. package/dist/chunk-QULDFKGZ.js.map +1 -0
  5. package/dist/chunk-RC275GLE.js +70 -0
  6. package/dist/chunk-RC275GLE.js.map +1 -0
  7. package/dist/{chunk-ENGJ6NTO.js → chunk-SJ2FHHN6.js} +10 -10
  8. package/dist/chunk-SJ2FHHN6.js.map +1 -0
  9. package/dist/index.cjs +235 -67
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +5 -3
  12. package/dist/index.d.ts +5 -3
  13. package/dist/index.js +155 -55
  14. package/dist/index.js.map +1 -1
  15. package/dist/models/messages.model.cjs +1 -0
  16. package/dist/models/messages.model.cjs.map +1 -1
  17. package/dist/models/messages.model.js +1 -1
  18. package/dist/models/threads.model.cjs +5 -0
  19. package/dist/models/threads.model.cjs.map +1 -1
  20. package/dist/models/threads.model.d.cts +4 -0
  21. package/dist/models/threads.model.d.ts +4 -0
  22. package/dist/models/threads.model.js +1 -1
  23. package/dist/models/user-workflow.model.cjs +105 -0
  24. package/dist/models/user-workflow.model.cjs.map +1 -0
  25. package/dist/models/user-workflow.model.d.cts +92 -0
  26. package/dist/models/user-workflow.model.d.ts +92 -0
  27. package/dist/models/user-workflow.model.js +9 -0
  28. package/dist/models/{workflow.model.cjs → workflow-template.model.cjs} +15 -15
  29. package/dist/models/workflow-template.model.cjs.map +1 -0
  30. package/dist/models/{workflow.model.d.ts → workflow-template.model.d.cts} +10 -13
  31. package/dist/models/{workflow.model.d.cts → workflow-template.model.d.ts} +10 -13
  32. package/dist/models/workflow-template.model.js +9 -0
  33. package/dist/models/workflow-template.model.js.map +1 -0
  34. package/implements/base.memory.ts +49 -12
  35. package/implements/thread.memory.ts +31 -16
  36. package/implements/user-workflow.memory.ts +87 -0
  37. package/implements/workflow-template.memory.ts +69 -0
  38. package/models/messages.model.ts +2 -0
  39. package/models/threads.model.ts +6 -0
  40. package/models/user-workflow.model.ts +91 -0
  41. package/models/{workflow.model.ts → workflow-template.model.ts} +10 -10
  42. package/package.json +3 -3
  43. package/dist/chunk-ENGJ6NTO.js.map +0 -1
  44. package/dist/chunk-EPJZT2YE.js.map +0 -1
  45. package/dist/chunk-T5WRFXBY.js.map +0 -1
  46. package/dist/models/workflow.model.cjs.map +0 -1
  47. package/dist/models/workflow.model.js +0 -9
  48. package/implements/workflow.memory.ts +0 -78
  49. /package/dist/models/{workflow.model.js.map → user-workflow.model.js.map} +0 -0
@@ -27,6 +27,11 @@ var ThreadObjectSchema = new Schema(
27
27
  type: Boolean,
28
28
  required: false,
29
29
  default: false
30
+ },
31
+ workflowId: {
32
+ type: String,
33
+ required: false,
34
+ index: true
30
35
  }
31
36
  },
32
37
  {
@@ -39,4 +44,4 @@ export {
39
44
  ThreadObjectSchema,
40
45
  ThreadModel
41
46
  };
42
- //# sourceMappingURL=chunk-EPJZT2YE.js.map
47
+ //# sourceMappingURL=chunk-2XJ6S2W5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../models/threads.model.ts"],"sourcesContent":["import { ThreadType } from \"@ainetwork/adk/types/memory\";\nimport { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\nexport const ThreadObjectSchema = new Schema(\n\t{\n\t\ttype: {\n\t\t\ttype: String,\n\t\t\tenum: Object.values(ThreadType),\n\t\t\trequired: true,\n\t\t},\n\t\tthreadId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\tuserId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\trequired: false,\n\t\t},\n\t\tisPinned: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false,\n\t\t\tdefault: false,\n\t\t},\n\t\tworkflowId: {\n\t\t\ttype: String,\n\t\t\trequired: false,\n\t\t\tindex: true,\n\t\t},\n\t},\n\t{\n\t\ttimestamps: true,\n\t},\n);\n\nexport interface ThreadDocument extends Document {\n\ttype: ThreadType;\n\tthreadId: string;\n\tuserId: string;\n\ttitle: string;\n\tisPinned: boolean;\n\tworkflowId?: string;\n\tcreatedAt: Date;\n\tupdatedAt: Date;\n}\n\nexport const ThreadModel = mongoose.model<ThreadDocument>(\"Thread\", ThreadObjectSchema);\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAwB,cAAc;AACtC,OAAO,cAAc;AAEd,IAAM,qBAAqB,IAAI;AAAA,EACrC;AAAA,IACC,MAAM;AAAA,MACL,MAAM;AAAA,MACN,MAAM,OAAO,OAAO,UAAU;AAAA,MAC9B,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,MAAM;AAAA,MACN,UAAU;AAAA,MACV,OAAO;AAAA,IACR;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,MACV,OAAO;AAAA,IACR;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACV;AAAA,IACA,YAAY;AAAA,MACX,MAAM;AAAA,MACN,UAAU;AAAA,MACV,OAAO;AAAA,IACR;AAAA,EACD;AAAA,EACA;AAAA,IACC,YAAY;AAAA,EACb;AACD;AAaO,IAAM,cAAc,SAAS,MAAsB,UAAU,kBAAkB;","names":[]}
@@ -48,6 +48,7 @@ var MessageObjectSchema = new Schema(
48
48
  timestamps: true
49
49
  }
50
50
  );
51
+ MessageObjectSchema.index({ threadId: 1, messageId: 1 }, { unique: true });
51
52
  var MessageModel = mongoose.model("Message", MessageObjectSchema);
52
53
 
53
54
  export {
@@ -55,4 +56,4 @@ export {
55
56
  MessageObjectSchema,
56
57
  MessageModel
57
58
  };
58
- //# sourceMappingURL=chunk-T5WRFXBY.js.map
59
+ //# sourceMappingURL=chunk-QULDFKGZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../models/messages.model.ts"],"sourcesContent":["import { MessageRole } from \"@ainetwork/adk/types/memory\";\nimport { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\n// MessageContentObject schema\nexport const MessageContentObjectSchema = new Schema(\n\t{\n\t\ttype: { type: String, required: true },\n\t\tparts: { type: [Schema.Types.Mixed], required: true },\n\t},\n\t{ _id: false },\n);\n\n// MessageObject schema - 개별 문서로 저장\nexport const MessageObjectSchema = new Schema(\n\t{\n\t\tmessageId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\tthreadId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\tuserId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\trole: {\n\t\t\ttype: String,\n\t\t\tenum: Object.values(MessageRole),\n\t\t\trequired: true,\n\t\t},\n\t\tcontent: {\n\t\t\ttype: MessageContentObjectSchema,\n\t\t\trequired: true,\n\t\t},\n\t\ttimestamp: {\n\t\t\ttype: Number,\n\t\t\trequired: true,\n\t\t},\n\t\tmetadata: {\n\t\t\ttype: Schema.Types.Mixed,\n\t\t\tdefault: {},\n\t\t},\n\t},\n\t{\n\t\ttimestamps: true,\n\t},\n);\n\nMessageObjectSchema.index({ threadId: 1, messageId: 1 }, { unique: true });\n\n// Message Document interface\nexport interface MessageDocument extends Document {\n\tmessageId: string;\n\tthreadId: string;\n\tuserId: string;\n\trole: MessageRole;\n\tcontent: {\n\t\ttype: string;\n\t\tparts: any[];\n\t};\n\ttimestamp: number;\n\tcreatedAt: Date;\n\tupdatedAt: Date;\n\tmetadata?: { [key: string]: unknown };\n}\n\nexport const MessageModel = mongoose.model<MessageDocument>(\"Message\", MessageObjectSchema);"],"mappings":";AAAA,SAAS,mBAAmB;AAC5B,SAAwB,cAAc;AACtC,OAAO,cAAc;AAGd,IAAM,6BAA6B,IAAI;AAAA,EAC7C;AAAA,IACC,MAAM,EAAE,MAAM,QAAQ,UAAU,KAAK;AAAA,IACrC,OAAO,EAAE,MAAM,CAAC,OAAO,MAAM,KAAK,GAAG,UAAU,KAAK;AAAA,EACrD;AAAA,EACA,EAAE,KAAK,MAAM;AACd;AAGO,IAAM,sBAAsB,IAAI;AAAA,EACtC;AAAA,IACC,WAAW;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA,MACV,OAAO;AAAA,IACR;AAAA,IACA,UAAU;AAAA,MACT,MAAM;AAAA,MACN,UAAU;AAAA,MACV,OAAO;AAAA,IACR;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,MACV,OAAO;AAAA,IACR;AAAA,IACA,MAAM;AAAA,MACL,MAAM;AAAA,MACN,MAAM,OAAO,OAAO,WAAW;AAAA,MAC/B,UAAU;AAAA,IACX;AAAA,IACA,SAAS;AAAA,MACR,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,IACA,UAAU;AAAA,MACT,MAAM,OAAO,MAAM;AAAA,MACnB,SAAS,CAAC;AAAA,IACX;AAAA,EACD;AAAA,EACA;AAAA,IACC,YAAY;AAAA,EACb;AACD;AAEA,oBAAoB,MAAM,EAAE,UAAU,GAAG,WAAW,EAAE,GAAG,EAAE,QAAQ,KAAK,CAAC;AAkBlE,IAAM,eAAe,SAAS,MAAuB,WAAW,mBAAmB;","names":[]}
@@ -0,0 +1,70 @@
1
+ // models/user-workflow.model.ts
2
+ import { Schema } from "mongoose";
3
+ import mongoose from "mongoose";
4
+ var UserWorkflowObjectSchema = new Schema(
5
+ {
6
+ workflowId: {
7
+ type: String,
8
+ required: true,
9
+ unique: true
10
+ },
11
+ userId: {
12
+ type: String,
13
+ required: true,
14
+ index: true
15
+ },
16
+ title: {
17
+ type: String,
18
+ required: true
19
+ },
20
+ description: {
21
+ type: String
22
+ },
23
+ active: {
24
+ type: Boolean,
25
+ required: true,
26
+ default: false
27
+ },
28
+ templateId: {
29
+ type: String
30
+ },
31
+ content: {
32
+ type: String,
33
+ required: true
34
+ },
35
+ variables: {
36
+ type: Schema.Types.Mixed
37
+ },
38
+ variableValues: {
39
+ type: Schema.Types.Mixed
40
+ },
41
+ schedule: {
42
+ type: String
43
+ },
44
+ timezone: {
45
+ type: String
46
+ },
47
+ lastRunAt: {
48
+ type: Number
49
+ },
50
+ nextRunAt: {
51
+ type: Number
52
+ },
53
+ lastThreadId: {
54
+ type: String
55
+ }
56
+ },
57
+ {
58
+ timestamps: true
59
+ }
60
+ );
61
+ var UserWorkflowModel = mongoose.model(
62
+ "UserWorkflow",
63
+ UserWorkflowObjectSchema
64
+ );
65
+
66
+ export {
67
+ UserWorkflowObjectSchema,
68
+ UserWorkflowModel
69
+ };
70
+ //# sourceMappingURL=chunk-RC275GLE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../models/user-workflow.model.ts"],"sourcesContent":["import { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\nexport const UserWorkflowObjectSchema = new Schema(\n\t{\n\t\tworkflowId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tunique: true,\n\t\t},\n\t\tuserId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true,\n\t\t},\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tdescription: {\n\t\t\ttype: String,\n\t\t},\n\t\tactive: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true,\n\t\t\tdefault: false,\n\t\t},\n\t\ttemplateId: {\n\t\t\ttype: String,\n\t\t},\n\t\tcontent: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tvariables: {\n\t\t\ttype: Schema.Types.Mixed,\n\t\t},\n\t\tvariableValues: {\n\t\t\ttype: Schema.Types.Mixed,\n\t\t},\n\t\tschedule: {\n\t\t\ttype: String,\n\t\t},\n\t\ttimezone: {\n\t\t\ttype: String,\n\t\t},\n\t\tlastRunAt: {\n\t\t\ttype: Number,\n\t\t},\n\t\tnextRunAt: {\n\t\t\ttype: Number,\n\t\t},\n\t\tlastThreadId: {\n\t\t\ttype: String,\n\t\t},\n\t},\n\t{\n\t\ttimestamps: true,\n\t}\n);\n\nexport interface UserWorkflowDocument extends Document {\n\tworkflowId: string;\n\tuserId: string;\n\ttitle: string;\n\tdescription?: string;\n\tactive: boolean;\n\ttemplateId?: string;\n\tcontent: string;\n\tvariables?: Record<\n\t\tstring,\n\t\t{\n\t\t\tid: string;\n\t\t\tlabel: string;\n\t\t\ttype: \"select\" | \"date_range\" | \"date_parts\" | \"text\" | \"number\";\n\t\t\toptions?: Array<string>;\n\t\t\tresolveAt?: \"creation\" | \"execution\";\n\t\t}\n\t>;\n\tvariableValues?: Record<string, string>;\n\tschedule?: string;\n\ttimezone?: string;\n\tlastRunAt?: number;\n\tnextRunAt?: number;\n\tlastThreadId?: string;\n}\n\nexport const UserWorkflowModel = mongoose.model<UserWorkflowDocument>(\n\t\"UserWorkflow\",\n\tUserWorkflowObjectSchema\n);\n"],"mappings":";AAAA,SAAwB,cAAc;AACtC,OAAO,cAAc;AAEd,IAAM,2BAA2B,IAAI;AAAA,EAC3C;AAAA,IACC,YAAY;AAAA,MACX,MAAM;AAAA,MACN,UAAU;AAAA,MACV,QAAQ;AAAA,IACT;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,MACV,OAAO;AAAA,IACR;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACZ,MAAM;AAAA,IACP;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACV;AAAA,IACA,YAAY;AAAA,MACX,MAAM;AAAA,IACP;AAAA,IACA,SAAS;AAAA,MACR,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,MACV,MAAM,OAAO,MAAM;AAAA,IACpB;AAAA,IACA,gBAAgB;AAAA,MACf,MAAM,OAAO,MAAM;AAAA,IACpB;AAAA,IACA,UAAU;AAAA,MACT,MAAM;AAAA,IACP;AAAA,IACA,UAAU;AAAA,MACT,MAAM;AAAA,IACP;AAAA,IACA,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,IACA,cAAc;AAAA,MACb,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA;AAAA,IACC,YAAY;AAAA,EACb;AACD;AA4BO,IAAM,oBAAoB,SAAS;AAAA,EACzC;AAAA,EACA;AACD;","names":[]}
@@ -1,16 +1,13 @@
1
- // models/workflow.model.ts
1
+ // models/workflow-template.model.ts
2
2
  import { Schema } from "mongoose";
3
3
  import mongoose from "mongoose";
4
- var WorkflowObjectSchema = new Schema(
4
+ var WorkflowTemplateObjectSchema = new Schema(
5
5
  {
6
- workflowId: {
6
+ templateId: {
7
7
  type: String,
8
8
  required: true,
9
9
  unique: true
10
10
  },
11
- userId: {
12
- type: String
13
- },
14
11
  title: {
15
12
  type: String,
16
13
  required: true
@@ -36,10 +33,13 @@ var WorkflowObjectSchema = new Schema(
36
33
  timestamps: true
37
34
  }
38
35
  );
39
- var WorkflowModel = mongoose.model("Workflow", WorkflowObjectSchema);
36
+ var WorkflowTemplateModel = mongoose.model(
37
+ "WorkflowTemplate",
38
+ WorkflowTemplateObjectSchema
39
+ );
40
40
 
41
41
  export {
42
- WorkflowObjectSchema,
43
- WorkflowModel
42
+ WorkflowTemplateObjectSchema,
43
+ WorkflowTemplateModel
44
44
  };
45
- //# sourceMappingURL=chunk-ENGJ6NTO.js.map
45
+ //# sourceMappingURL=chunk-SJ2FHHN6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../models/workflow-template.model.ts"],"sourcesContent":["import { type Document, Schema } from \"mongoose\";\nimport mongoose from \"mongoose\";\n\nexport const WorkflowTemplateObjectSchema = new Schema(\n\t{\n\t\ttemplateId: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tunique: true,\n\t\t},\n\t\ttitle: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tdescription: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tactive: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true,\n\t\t\tdefault: false,\n\t\t},\n\t\tcontent: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tvariables: {\n\t\t\ttype: Schema.Types.Mixed,\n\t\t},\n\t},\n\t{\n\t\ttimestamps: true,\n\t}\n);\n\nexport interface WorkflowTemplateDocument extends Document {\n\ttemplateId: string;\n\ttitle: string;\n\tdescription: string;\n\tactive: boolean;\n\tcontent: string;\n\tvariables?: Record<\n\t\tstring,\n\t\t{\n\t\t\tid: string;\n\t\t\tlabel: string;\n\t\t\ttype: \"select\" | \"date_range\" | \"date_parts\" | \"text\" | \"number\";\n\t\t\toptions?: Array<string>;\n\t\t\tresolveAt?: \"creation\" | \"execution\";\n\t\t}\n\t>;\n}\n\nexport const WorkflowTemplateModel = mongoose.model<WorkflowTemplateDocument>(\n\t\"WorkflowTemplate\",\n\tWorkflowTemplateObjectSchema\n);\n"],"mappings":";AAAA,SAAwB,cAAc;AACtC,OAAO,cAAc;AAEd,IAAM,+BAA+B,IAAI;AAAA,EAC/C;AAAA,IACC,YAAY;AAAA,MACX,MAAM;AAAA,MACN,UAAU;AAAA,MACV,QAAQ;AAAA,IACT;AAAA,IACA,OAAO;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,IACA,aAAa;AAAA,MACZ,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,IACA,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACV;AAAA,IACA,SAAS;AAAA,MACR,MAAM;AAAA,MACN,UAAU;AAAA,IACX;AAAA,IACA,WAAW;AAAA,MACV,MAAM,OAAO,MAAM;AAAA,IACpB;AAAA,EACD;AAAA,EACA;AAAA,IACC,YAAY;AAAA,EACb;AACD;AAoBO,IAAM,wBAAwB,SAAS;AAAA,EAC7C;AAAA,EACA;AACD;","names":[]}