@mastra/core 0.2.0-alpha.89 → 0.2.0-alpha.91
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 +1 -2
- package/dist/action/index.d.ts +3 -3
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +4 -4
- package/dist/base.d.ts +1 -1
- package/dist/base.js +2 -2
- package/dist/bundler/index.d.ts +1 -1
- package/dist/bundler/index.js +3 -3
- package/dist/{chunk-D6SEHWUL.js → chunk-4LJFWC2Q.js} +1 -1
- package/dist/chunk-5DYJZVB7.js +66 -0
- package/dist/chunk-AD6IIOCI.js +11 -0
- package/dist/chunk-CQU72KBX.js +54 -0
- package/dist/{chunk-FFZKACHZ.js → chunk-E3TBVBIO.js} +12 -84
- package/dist/{chunk-ADU6ZLCT.js → chunk-ECUVL2G5.js} +1 -1
- package/dist/{chunk-KHPTZCPA.js → chunk-ECXV3EAT.js} +3 -25
- package/dist/{chunk-J556NL2S.js → chunk-FD4KOA4T.js} +1 -1
- package/dist/{chunk-WLG2YHOZ.js → chunk-G4MCO7XF.js} +1 -1
- package/dist/{chunk-IO3KMCXV.js → chunk-ICMEXHKD.js} +0 -1
- package/dist/{chunk-HILJW64N.js → chunk-IE37CBXB.js} +20 -9
- package/dist/chunk-IEFQZ3IL.js +78 -0
- package/dist/{chunk-GTJIVA2D.js → chunk-IJ55HGH4.js} +1 -1
- package/dist/{chunk-SKEBFXFK.js → chunk-MMJCCJNP.js} +5 -9
- package/dist/chunk-NNNAWW2H.js +66 -0
- package/dist/{chunk-T5ZUXYWC.js → chunk-NYBGZL6Z.js} +1 -1
- package/dist/{chunk-654VMNVR.js → chunk-QX2CHXA7.js} +12 -5
- package/dist/chunk-RAR7V3E3.js +66 -0
- package/dist/{chunk-RIATJJC3.js → chunk-RDEXABVY.js} +1 -1
- package/dist/chunk-VPSYTVWP.js +66 -0
- package/dist/{chunk-SMVXLIV7.js → chunk-WGUGRCAP.js} +1 -1
- package/dist/{chunk-Z2KRB7Z4.js → chunk-XDXRDRTQ.js} +1 -1
- package/dist/{chunk-BCNHUSA6.js → chunk-YKASGA6R.js} +1 -1
- package/dist/{chunk-Y7YCQUOD.js → chunk-YPMAHKBC.js} +2 -2
- package/dist/chunk-ZA7MIXNW.js +66 -0
- package/dist/deployer/index.d.ts +1 -1
- package/dist/deployer/index.js +4 -4
- package/dist/embeddings/model/providers/bedrock.d.ts +42 -0
- package/dist/embeddings/model/providers/bedrock.js +3 -0
- package/dist/embeddings/model/providers/bedrock.test.d.ts +2 -0
- package/dist/embeddings/model/providers/bedrock.test.js +37 -0
- package/dist/embeddings/model/providers/cohere.d.ts +34 -0
- package/dist/embeddings/model/providers/cohere.js +3 -0
- package/dist/embeddings/model/providers/cohere.test.d.ts +2 -0
- package/dist/embeddings/model/providers/cohere.test.js +37 -0
- package/dist/embeddings/model/providers/embedder.d.ts +28 -0
- package/dist/embeddings/model/providers/embedder.js +2 -0
- package/dist/embeddings/model/providers/google.d.ts +34 -0
- package/dist/embeddings/model/providers/google.js +3 -0
- package/dist/embeddings/model/providers/google.test.d.ts +2 -0
- package/dist/embeddings/model/providers/google.test.js +37 -0
- package/dist/embeddings/model/providers/mistral.d.ts +34 -0
- package/dist/embeddings/model/providers/mistral.js +3 -0
- package/dist/embeddings/model/providers/mistral.test.d.ts +2 -0
- package/dist/embeddings/model/providers/mistral.test.js +37 -0
- package/dist/embeddings/model/providers/mock.d.ts +20 -0
- package/dist/embeddings/model/providers/mock.js +3 -0
- package/dist/embeddings/model/providers/mock.test.d.ts +2 -0
- package/dist/embeddings/model/providers/mock.test.js +29 -0
- package/dist/embeddings/model/providers/openai.d.ts +34 -0
- package/dist/embeddings/model/providers/openai.js +3 -0
- package/dist/embeddings/model/providers/openai.test.d.ts +2 -0
- package/dist/embeddings/model/providers/openai.test.js +37 -0
- package/dist/embeddings/model/providers/voyage.d.ts +34 -0
- package/dist/embeddings/model/providers/voyage.js +3 -0
- package/dist/embeddings/model/providers/voyage.test.d.ts +2 -0
- package/dist/embeddings/model/providers/voyage.test.js +37 -0
- package/dist/eval/index.d.ts +4 -4
- package/dist/filter/index.d.ts +1 -1
- package/dist/filter/index.js +1 -1
- package/dist/{index-D-mqcYwN.d.ts → index-B48181D5.d.ts} +6 -13
- package/dist/{index-Cktbxvxx.d.ts → index-CBZ2mk2H.d.ts} +0 -1
- package/dist/index.d.ts +7 -8
- package/dist/index.js +17 -18
- package/dist/integration/index.d.ts +5 -5
- package/dist/llm/index.d.ts +4 -4
- package/dist/llm/index.js +3 -3
- package/dist/{model-CD0nIpJn.d.ts → llm/model/index.d.ts} +17 -3
- package/dist/llm/model/index.js +5 -0
- package/dist/llm/model/providers/anthropic-vertex.d.ts +5 -5
- package/dist/llm/model/providers/anthropic-vertex.js +3 -3
- package/dist/llm/model/providers/anthropic.d.ts +5 -5
- package/dist/llm/model/providers/anthropic.js +3 -3
- package/dist/llm/model/providers/azure.d.ts +5 -5
- package/dist/llm/model/providers/azure.js +3 -3
- package/dist/llm/model/providers/baseten.d.ts +5 -5
- package/dist/llm/model/providers/baseten.js +4 -4
- package/dist/llm/model/providers/bedrock.d.ts +5 -5
- package/dist/llm/model/providers/bedrock.js +3 -3
- package/dist/llm/model/providers/cerebras.d.ts +5 -5
- package/dist/llm/model/providers/cerebras.js +3 -3
- package/dist/llm/model/providers/cohere.d.ts +5 -5
- package/dist/llm/model/providers/cohere.js +3 -3
- package/dist/llm/model/providers/deepinfra.d.ts +5 -5
- package/dist/llm/model/providers/deepinfra.js +3 -3
- package/dist/llm/model/providers/deepseek.d.ts +5 -5
- package/dist/llm/model/providers/deepseek.js +3 -3
- package/dist/llm/model/providers/fireworks.d.ts +5 -5
- package/dist/llm/model/providers/fireworks.js +3 -3
- package/dist/llm/model/providers/google-vertex.d.ts +5 -5
- package/dist/llm/model/providers/google-vertex.js +3 -3
- package/dist/llm/model/providers/google.d.ts +5 -5
- package/dist/llm/model/providers/google.js +3 -3
- package/dist/llm/model/providers/grok.d.ts +5 -5
- package/dist/llm/model/providers/grok.js +3 -3
- package/dist/llm/model/providers/groq.d.ts +5 -5
- package/dist/llm/model/providers/groq.js +3 -3
- package/dist/llm/model/providers/lmstudio.d.ts +5 -5
- package/dist/llm/model/providers/lmstudio.js +4 -4
- package/dist/llm/model/providers/mistral.d.ts +5 -5
- package/dist/llm/model/providers/mistral.js +3 -3
- package/dist/llm/model/providers/mock.d.ts +5 -5
- package/dist/llm/model/providers/mock.js +3 -3
- package/dist/llm/model/providers/ollama.d.ts +5 -5
- package/dist/llm/model/providers/ollama.js +3 -3
- package/dist/llm/model/providers/openai-compat.d.ts +5 -5
- package/dist/llm/model/providers/openai-compat.js +4 -4
- package/dist/llm/model/providers/openai.d.ts +5 -5
- package/dist/llm/model/providers/openai.js +4 -4
- package/dist/llm/model/providers/openai.test.js +4 -4
- package/dist/llm/model/providers/perplexity.d.ts +5 -5
- package/dist/llm/model/providers/perplexity.js +3 -3
- package/dist/llm/model/providers/portkey.d.ts +5 -5
- package/dist/llm/model/providers/portkey.js +3 -3
- package/dist/llm/model/providers/togetherai.d.ts +5 -5
- package/dist/llm/model/providers/togetherai.js +3 -3
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.js +1 -1
- package/dist/mastra/index.d.ts +5 -7
- package/dist/mastra/index.js +4 -4
- package/dist/memory/index.d.ts +4 -4
- package/dist/memory/index.js +3 -3
- package/dist/relevance/index.d.ts +4 -4
- package/dist/relevance/index.js +5 -5
- package/dist/storage/index.d.ts +5 -5
- package/dist/storage/index.js +3 -3
- package/dist/tools/index.d.ts +5 -5
- package/dist/tts/index.d.ts +1 -1
- package/dist/tts/index.js +3 -3
- package/dist/vector/index.d.ts +1 -1
- package/dist/vector/index.js +3 -3
- package/dist/vector/libsql/index.d.ts +31 -0
- package/dist/vector/libsql/index.js +662 -0
- package/dist/{workflow-4u4hE9mG.d.ts → workflow-CSwxE-4q.d.ts} +1 -19
- package/dist/workflows/index.d.ts +6 -6
- package/dist/workflows/index.js +3 -3
- package/package.json +14 -8
- package/dist/chunk-NIYVERVP.js +0 -199
- package/dist/engine/index.d.ts +0 -59
- package/dist/engine/index.js +0 -4
- package/dist/engine-EwEG-4Iv.d.ts +0 -127
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export { S as Step, W as Workflow, c as createStep } from '../workflow-
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
export { S as Step, W as Workflow, c as createStep } from '../workflow-CSwxE-4q.js';
|
|
2
|
+
import { av as VariableReference, g as StepResult } from '../index-B48181D5.js';
|
|
3
|
+
export { ax as ActionContext, aw as BaseCondition, aG as DependencyCheckOutput, aM as ExtractSchemaFromStep, aP as ExtractSchemaType, aN as ExtractStepResult, aQ as PathsToStringProps, aD as ResolverFunctionInput, aE as ResolverFunctionOutput, R as RetryConfig, c as StepAction, az as StepCondition, f as StepConfig, ay as StepDef, S as StepExecutionContext, i as StepGraph, aL as StepId, aO as StepInputType, au as StepNode, e as StepVariableType, aF as SubscriberFunctionOutput, aI as WorkflowActionParams, aJ as WorkflowActions, aH as WorkflowActors, aA as WorkflowContext, aC as WorkflowEvent, aB as WorkflowLogMessage, W as WorkflowOptions, h as WorkflowRunState, aK as WorkflowState } from '../index-B48181D5.js';
|
|
4
4
|
import 'xstate';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '../base.js';
|
|
7
7
|
import '@opentelemetry/api';
|
|
8
|
-
import '../index-
|
|
8
|
+
import '../index-CBZ2mk2H.js';
|
|
9
9
|
import 'pino';
|
|
10
10
|
import 'stream';
|
|
11
11
|
import '../telemetry-oCUM52DG.js';
|
|
12
12
|
import '@opentelemetry/sdk-node';
|
|
13
13
|
import '@opentelemetry/sdk-trace-base';
|
|
14
|
-
import '../engine-EwEG-4Iv.js';
|
|
15
14
|
import 'ai';
|
|
16
15
|
import 'json-schema';
|
|
17
16
|
import '../metric-D2V4CR8D.js';
|
|
18
17
|
import 'sift';
|
|
19
|
-
import '../
|
|
18
|
+
import '../embeddings/model/providers/embedder.js';
|
|
20
19
|
import '../vector/index.js';
|
|
20
|
+
import '../types-M16hSruO.js';
|
|
21
21
|
import '../tts/index.js';
|
|
22
22
|
|
|
23
23
|
declare function isErrorEvent(stateEvent: any): stateEvent is {
|
package/dist/workflows/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Step, Workflow, createStep, getStepResult, isErrorEvent, isTransitionEvent, isVariableReference } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { Step, Workflow, createStep, getStepResult, isErrorEvent, isTransitionEvent, isVariableReference } from '../chunk-E3TBVBIO.js';
|
|
2
|
+
import '../chunk-G4MCO7XF.js';
|
|
3
|
+
import '../chunk-ICMEXHKD.js';
|
|
4
4
|
import '../chunk-AJJZUHB4.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/core",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.91",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/core.esm.js",
|
|
@@ -21,24 +21,30 @@
|
|
|
21
21
|
"default": "./dist/*/index.js"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
"./llm": {
|
|
25
|
-
"import": {
|
|
26
|
-
"types": "./dist/llm/model/index.d.ts",
|
|
27
|
-
"default": "./dist/llm/model/index.js"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
24
|
"./llm/*": {
|
|
31
25
|
"import": {
|
|
32
26
|
"types": "./dist/llm/model/providers/*.d.ts",
|
|
33
27
|
"default": "./dist/llm/model/providers/*.js"
|
|
34
28
|
}
|
|
35
29
|
},
|
|
30
|
+
"./llm": {
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/llm/model/index.d.ts",
|
|
33
|
+
"default": "./dist/llm/model/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
36
|
"./embeddings/*": {
|
|
37
37
|
"import": {
|
|
38
38
|
"types": "./dist/embeddings/model/providers/*.d.ts",
|
|
39
39
|
"default": "./dist/embeddings/model/providers/*.js"
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
|
+
"./vector/libsql": {
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./dist/vector/libsql/index.d.ts",
|
|
45
|
+
"default": "./dist/vector/libsql/index.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
42
48
|
"./utils": {
|
|
43
49
|
"import": {
|
|
44
50
|
"types": "./dist/utils.d.ts",
|
|
@@ -151,7 +157,7 @@
|
|
|
151
157
|
"scripts": {
|
|
152
158
|
"check": "tsc --noEmit",
|
|
153
159
|
"analyze": "size-limit --why",
|
|
154
|
-
"build": "tsup-node src/index.ts src/base.ts src/utils.ts src/*/index.ts src/llm/model/providers/*.ts --format esm --clean --dts --treeshake",
|
|
160
|
+
"build": "tsup-node src/index.ts src/base.ts src/utils.ts src/*/index.ts src/vector/libsql/index.ts src/llm/model/index.ts src/llm/model/providers/*.ts src/embeddings/model/providers/*.ts --format esm --clean --dts --treeshake",
|
|
155
161
|
"build:dev": "pnpm build --watch",
|
|
156
162
|
"size": "size-limit",
|
|
157
163
|
"test": "vitest run"
|
package/dist/chunk-NIYVERVP.js
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { MastraBase } from './chunk-WLG2YHOZ.js';
|
|
2
|
-
import { __name, __publicField } from './chunk-AJJZUHB4.js';
|
|
3
|
-
|
|
4
|
-
// src/engine/types.ts
|
|
5
|
-
var PropertyType = /* @__PURE__ */ function(PropertyType2) {
|
|
6
|
-
PropertyType2["LONG_TEXT"] = "LONG_TEXT";
|
|
7
|
-
PropertyType2["SINGLE_LINE_TEXT"] = "SINGLE_LINE_TEXT";
|
|
8
|
-
PropertyType2["SINGLE_SELECT"] = "SINGLE_SELECT";
|
|
9
|
-
PropertyType2["MULTI_SELECT"] = "MULTI_SELECT";
|
|
10
|
-
PropertyType2["CHECKBOX"] = "CHECKBOX";
|
|
11
|
-
PropertyType2["DATE"] = "DATE";
|
|
12
|
-
PropertyType2["USER"] = "USER";
|
|
13
|
-
PropertyType2["BADGE_LIST"] = "BADGE_LIST";
|
|
14
|
-
PropertyType2["CURRENCY"] = "CURRENCY";
|
|
15
|
-
PropertyType2["URL"] = "URL";
|
|
16
|
-
PropertyType2["PHONE"] = "PHONE";
|
|
17
|
-
PropertyType2["CONTACT"] = "CONTACT";
|
|
18
|
-
PropertyType2["COMPANY"] = "COMPANY";
|
|
19
|
-
PropertyType2["PERSON"] = "PERSON";
|
|
20
|
-
PropertyType2["ENRICHMENT"] = "ENRICHMENT";
|
|
21
|
-
PropertyType2["COMPOSITE"] = "COMPOSITE";
|
|
22
|
-
PropertyType2["BOOLEAN"] = "BOOLEAN";
|
|
23
|
-
PropertyType2["NUMBER"] = "NUMBER";
|
|
24
|
-
PropertyType2["FLOAT"] = "FLOAT";
|
|
25
|
-
PropertyType2["JSON_OBJECT"] = "JSON_OBJECT";
|
|
26
|
-
PropertyType2["JSON_ARRAY"] = "JSON_ARRAY";
|
|
27
|
-
return PropertyType2;
|
|
28
|
-
}({});
|
|
29
|
-
var FilterOperators = /* @__PURE__ */ function(FilterOperators2) {
|
|
30
|
-
FilterOperators2["IS"] = "is";
|
|
31
|
-
FilterOperators2["EQUAL"] = "eq";
|
|
32
|
-
FilterOperators2["NOT_EQUAL"] = "not_eq";
|
|
33
|
-
FilterOperators2["CONTAINS"] = "contains";
|
|
34
|
-
FilterOperators2["IN"] = "in";
|
|
35
|
-
FilterOperators2["NOT_IN"] = "not_in";
|
|
36
|
-
FilterOperators2["GREATER_THAN"] = "gt";
|
|
37
|
-
FilterOperators2["LESS_THAN"] = "lt";
|
|
38
|
-
FilterOperators2["NOT_CONTAINS"] = "not_contains";
|
|
39
|
-
FilterOperators2["GREATER_THAN_OR_EQUAL"] = "gte";
|
|
40
|
-
FilterOperators2["LESS_THAN_OR_EQUAL"] = "lte";
|
|
41
|
-
FilterOperators2["OP"] = "op";
|
|
42
|
-
FilterOperators2["SET"] = "set";
|
|
43
|
-
FilterOperators2["NOT_SET"] = "not_set";
|
|
44
|
-
return FilterOperators2;
|
|
45
|
-
}({});
|
|
46
|
-
|
|
47
|
-
// src/engine/engine.ts
|
|
48
|
-
var _MastraEngine = class _MastraEngine extends MastraBase {
|
|
49
|
-
/**
|
|
50
|
-
* Initializes the database connection
|
|
51
|
-
* @param config Configuration object for database connection
|
|
52
|
-
*/
|
|
53
|
-
constructor(_config) {
|
|
54
|
-
super({
|
|
55
|
-
component: "ENGINE",
|
|
56
|
-
name: "MastraEngine"
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
__name(_MastraEngine, "MastraEngine");
|
|
61
|
-
var MastraEngine = _MastraEngine;
|
|
62
|
-
|
|
63
|
-
// src/engine/engine.mock.ts
|
|
64
|
-
var _MockMastraEngine = class _MockMastraEngine extends MastraEngine {
|
|
65
|
-
constructor(config) {
|
|
66
|
-
super(config);
|
|
67
|
-
__publicField(this, "entities", []);
|
|
68
|
-
__publicField(this, "records", []);
|
|
69
|
-
}
|
|
70
|
-
async createEntity(params) {
|
|
71
|
-
const entity = {
|
|
72
|
-
id: `entity_${Date.now()}`,
|
|
73
|
-
name: params.name,
|
|
74
|
-
connectionId: params.connectionId,
|
|
75
|
-
createdAt: /* @__PURE__ */ new Date(),
|
|
76
|
-
updatedAt: /* @__PURE__ */ new Date(),
|
|
77
|
-
lastSyncId: null
|
|
78
|
-
};
|
|
79
|
-
this.entities.push(entity);
|
|
80
|
-
return entity;
|
|
81
|
-
}
|
|
82
|
-
async getEntityById(params) {
|
|
83
|
-
const entity = this.entities.find((e) => e.id === params.id);
|
|
84
|
-
if (!entity) {
|
|
85
|
-
throw new Error(`Entity with id ${params.id} not found`);
|
|
86
|
-
}
|
|
87
|
-
return entity;
|
|
88
|
-
}
|
|
89
|
-
async getEntity({ connectionId, name }) {
|
|
90
|
-
return this.entities.find((e) => (name ? e.name === name : true) && (connectionId ? e.connectionId === connectionId : true));
|
|
91
|
-
}
|
|
92
|
-
async deleteEntityById({ id }) {
|
|
93
|
-
const entityIndex = this.entities.findIndex((e) => e.id === id);
|
|
94
|
-
if (entityIndex === -1) {
|
|
95
|
-
throw new Error(`Entity with id ${id} not found`);
|
|
96
|
-
}
|
|
97
|
-
const [deletedEntity] = this.entities.splice(entityIndex, 1);
|
|
98
|
-
this.records = this.records.filter((r) => r.entityId !== id);
|
|
99
|
-
return deletedEntity;
|
|
100
|
-
}
|
|
101
|
-
async upsertRecords(params) {
|
|
102
|
-
await this.getEntityById({
|
|
103
|
-
id: params.entityId
|
|
104
|
-
});
|
|
105
|
-
for (const record of params.records) {
|
|
106
|
-
const existingRecordIndex = this.records.findIndex((r) => r.entityId === params.entityId && r.externalId === record.externalId);
|
|
107
|
-
const fullRecord = {
|
|
108
|
-
id: `record_${Date.now()}_${Math.random()}`,
|
|
109
|
-
entityId: params.entityId,
|
|
110
|
-
externalId: record.externalId,
|
|
111
|
-
data: record.data,
|
|
112
|
-
entityType: record.entityType,
|
|
113
|
-
createdAt: /* @__PURE__ */ new Date(),
|
|
114
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
115
|
-
};
|
|
116
|
-
if (existingRecordIndex !== -1) {
|
|
117
|
-
this.records[existingRecordIndex] = fullRecord;
|
|
118
|
-
} else {
|
|
119
|
-
this.records.push(fullRecord);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
async getRecordsByEntityId(params) {
|
|
124
|
-
return this.records.filter((r) => r.entityId === params.entityId);
|
|
125
|
-
}
|
|
126
|
-
async getRecordsByEntityNameAndExternalId({ entityName, connectionId, externalId }) {
|
|
127
|
-
const entity = await this.getEntity({
|
|
128
|
-
name: entityName,
|
|
129
|
-
connectionId
|
|
130
|
-
});
|
|
131
|
-
if (!entity) {
|
|
132
|
-
return [];
|
|
133
|
-
}
|
|
134
|
-
return this.records.filter((r) => r.entityId === entity.id && r.externalId === externalId);
|
|
135
|
-
}
|
|
136
|
-
async getRecordsByEntityName({ name, connectionId }) {
|
|
137
|
-
const entity = await this.getEntity({
|
|
138
|
-
name,
|
|
139
|
-
connectionId
|
|
140
|
-
});
|
|
141
|
-
if (!entity) {
|
|
142
|
-
return [];
|
|
143
|
-
}
|
|
144
|
-
return this.getRecordsByEntityId({
|
|
145
|
-
entityId: entity.id
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
async getRecords({ entityName, connectionId, options }) {
|
|
149
|
-
const entity = await this.getEntity({
|
|
150
|
-
name: entityName,
|
|
151
|
-
connectionId
|
|
152
|
-
});
|
|
153
|
-
if (!entity) {
|
|
154
|
-
return [];
|
|
155
|
-
}
|
|
156
|
-
let records = await this.getRecordsByEntityId({
|
|
157
|
-
entityId: entity.id
|
|
158
|
-
});
|
|
159
|
-
if (options.filters) {
|
|
160
|
-
records = records.filter(() => {
|
|
161
|
-
return true;
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
if (options.sort) {
|
|
165
|
-
records = records.sort(() => {
|
|
166
|
-
return 0;
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
if (options.limit) {
|
|
170
|
-
const start = options.offset || 0;
|
|
171
|
-
records = records.slice(start, start + options.limit);
|
|
172
|
-
}
|
|
173
|
-
return records;
|
|
174
|
-
}
|
|
175
|
-
async syncRecords({ connectionId, name, records, lastSyncId }) {
|
|
176
|
-
let entity = await this.getEntity({
|
|
177
|
-
name,
|
|
178
|
-
connectionId
|
|
179
|
-
});
|
|
180
|
-
if (!entity) {
|
|
181
|
-
entity = await this.createEntity({
|
|
182
|
-
name,
|
|
183
|
-
connectionId
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
await this.upsertRecords({
|
|
187
|
-
entityId: entity.id,
|
|
188
|
-
records: records.map((record) => ({
|
|
189
|
-
...record,
|
|
190
|
-
lastSyncId,
|
|
191
|
-
entityType: name
|
|
192
|
-
}))
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
__name(_MockMastraEngine, "MockMastraEngine");
|
|
197
|
-
var MockMastraEngine = _MockMastraEngine;
|
|
198
|
-
|
|
199
|
-
export { FilterOperators, MastraEngine, MockMastraEngine, PropertyType };
|
package/dist/engine/index.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { M as MastraEngine, D as DatabaseConfig, B as BaseEntity, a as BaseRecord, Q as QueryOptions } from '../engine-EwEG-4Iv.js';
|
|
2
|
-
export { b as FilterCondition, F as FilterOperators, P as PropertyType, S as SortOrder } from '../engine-EwEG-4Iv.js';
|
|
3
|
-
import '../base.js';
|
|
4
|
-
import '@opentelemetry/api';
|
|
5
|
-
import '../index-Cktbxvxx.js';
|
|
6
|
-
import 'pino';
|
|
7
|
-
import 'stream';
|
|
8
|
-
import '../telemetry-oCUM52DG.js';
|
|
9
|
-
import '@opentelemetry/sdk-node';
|
|
10
|
-
import '@opentelemetry/sdk-trace-base';
|
|
11
|
-
|
|
12
|
-
declare class MockMastraEngine extends MastraEngine {
|
|
13
|
-
private entities;
|
|
14
|
-
private records;
|
|
15
|
-
constructor(config: DatabaseConfig);
|
|
16
|
-
createEntity(params: {
|
|
17
|
-
name: string;
|
|
18
|
-
connectionId: string;
|
|
19
|
-
}): Promise<BaseEntity>;
|
|
20
|
-
getEntityById(params: {
|
|
21
|
-
id: string;
|
|
22
|
-
}): Promise<BaseEntity>;
|
|
23
|
-
getEntity({ connectionId, name }: {
|
|
24
|
-
name?: string;
|
|
25
|
-
connectionId?: string;
|
|
26
|
-
}): Promise<BaseEntity | undefined>;
|
|
27
|
-
deleteEntityById({ id }: {
|
|
28
|
-
id: string;
|
|
29
|
-
}): Promise<BaseEntity>;
|
|
30
|
-
upsertRecords(params: {
|
|
31
|
-
entityId: string;
|
|
32
|
-
records: Pick<BaseRecord, 'externalId' | 'data' | 'entityType'>[];
|
|
33
|
-
}): Promise<void>;
|
|
34
|
-
getRecordsByEntityId(params: {
|
|
35
|
-
entityId: string;
|
|
36
|
-
}): Promise<BaseRecord[]>;
|
|
37
|
-
getRecordsByEntityNameAndExternalId({ entityName, connectionId, externalId, }: {
|
|
38
|
-
entityName: string;
|
|
39
|
-
connectionId: string;
|
|
40
|
-
externalId: string;
|
|
41
|
-
}): Promise<BaseRecord[]>;
|
|
42
|
-
getRecordsByEntityName({ name, connectionId }: {
|
|
43
|
-
name: string;
|
|
44
|
-
connectionId: string;
|
|
45
|
-
}): Promise<BaseRecord[]>;
|
|
46
|
-
getRecords({ entityName, connectionId, options, }: {
|
|
47
|
-
entityName: string;
|
|
48
|
-
options: QueryOptions;
|
|
49
|
-
connectionId: string;
|
|
50
|
-
}): Promise<BaseRecord[]>;
|
|
51
|
-
syncRecords({ connectionId, name, records, lastSyncId, }: {
|
|
52
|
-
name: string;
|
|
53
|
-
connectionId: string;
|
|
54
|
-
records: Pick<BaseRecord, 'externalId' | 'data'>[];
|
|
55
|
-
lastSyncId?: string;
|
|
56
|
-
}): Promise<void>;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export { BaseEntity, BaseRecord, DatabaseConfig, MastraEngine, MockMastraEngine, QueryOptions };
|
package/dist/engine/index.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { MastraBase } from './base.js';
|
|
2
|
-
|
|
3
|
-
interface BaseEntity {
|
|
4
|
-
id: string;
|
|
5
|
-
connectionId: string;
|
|
6
|
-
name: string;
|
|
7
|
-
createdAt: Date;
|
|
8
|
-
updatedAt: Date | null;
|
|
9
|
-
lastSyncId: string | null;
|
|
10
|
-
}
|
|
11
|
-
interface BaseRecord {
|
|
12
|
-
id: string;
|
|
13
|
-
entityId: string;
|
|
14
|
-
data: Record<string, any>;
|
|
15
|
-
createdAt: Date;
|
|
16
|
-
updatedAt: Date | null;
|
|
17
|
-
externalId: string;
|
|
18
|
-
entityType: string;
|
|
19
|
-
}
|
|
20
|
-
declare enum PropertyType {
|
|
21
|
-
'LONG_TEXT' = "LONG_TEXT",
|
|
22
|
-
'SINGLE_LINE_TEXT' = "SINGLE_LINE_TEXT",
|
|
23
|
-
'SINGLE_SELECT' = "SINGLE_SELECT",
|
|
24
|
-
'MULTI_SELECT' = "MULTI_SELECT",
|
|
25
|
-
'CHECKBOX' = "CHECKBOX",
|
|
26
|
-
'DATE' = "DATE",
|
|
27
|
-
'USER' = "USER",
|
|
28
|
-
'BADGE_LIST' = "BADGE_LIST",
|
|
29
|
-
'CURRENCY' = "CURRENCY",
|
|
30
|
-
'URL' = "URL",
|
|
31
|
-
'PHONE' = "PHONE",
|
|
32
|
-
'CONTACT' = "CONTACT",
|
|
33
|
-
'COMPANY' = "COMPANY",
|
|
34
|
-
'PERSON' = "PERSON",
|
|
35
|
-
'ENRICHMENT' = "ENRICHMENT",
|
|
36
|
-
'COMPOSITE' = "COMPOSITE",
|
|
37
|
-
'BOOLEAN' = "BOOLEAN",
|
|
38
|
-
'NUMBER' = "NUMBER",
|
|
39
|
-
'FLOAT' = "FLOAT",
|
|
40
|
-
'JSON_OBJECT' = "JSON_OBJECT",
|
|
41
|
-
'JSON_ARRAY' = "JSON_ARRAY"
|
|
42
|
-
}
|
|
43
|
-
declare enum FilterOperators {
|
|
44
|
-
IS = "is",
|
|
45
|
-
EQUAL = "eq",
|
|
46
|
-
NOT_EQUAL = "not_eq",
|
|
47
|
-
CONTAINS = "contains",
|
|
48
|
-
IN = "in",
|
|
49
|
-
NOT_IN = "not_in",
|
|
50
|
-
GREATER_THAN = "gt",
|
|
51
|
-
LESS_THAN = "lt",
|
|
52
|
-
NOT_CONTAINS = "not_contains",
|
|
53
|
-
GREATER_THAN_OR_EQUAL = "gte",
|
|
54
|
-
LESS_THAN_OR_EQUAL = "lte",
|
|
55
|
-
OP = "op",
|
|
56
|
-
SET = "set",
|
|
57
|
-
NOT_SET = "not_set"
|
|
58
|
-
}
|
|
59
|
-
interface FilterCondition {
|
|
60
|
-
field: string;
|
|
61
|
-
operator: FilterOperators;
|
|
62
|
-
value: any;
|
|
63
|
-
}
|
|
64
|
-
interface SortOrder {
|
|
65
|
-
field: string;
|
|
66
|
-
direction: 'ASC' | 'DESC';
|
|
67
|
-
}
|
|
68
|
-
interface QueryOptions {
|
|
69
|
-
filters?: FilterCondition[];
|
|
70
|
-
sort?: SortOrder[];
|
|
71
|
-
limit?: number;
|
|
72
|
-
offset?: number;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
interface DatabaseConfig {
|
|
76
|
-
url: string;
|
|
77
|
-
}
|
|
78
|
-
declare abstract class MastraEngine extends MastraBase {
|
|
79
|
-
/**
|
|
80
|
-
* Initializes the database connection
|
|
81
|
-
* @param config Configuration object for database connection
|
|
82
|
-
*/
|
|
83
|
-
constructor(_config: DatabaseConfig);
|
|
84
|
-
abstract createEntity(params: {
|
|
85
|
-
name: string;
|
|
86
|
-
connectionId: string;
|
|
87
|
-
}): Promise<BaseEntity>;
|
|
88
|
-
abstract getEntityById(params: {
|
|
89
|
-
id: string;
|
|
90
|
-
}): Promise<BaseEntity>;
|
|
91
|
-
abstract getEntity({ connectionId, name }: {
|
|
92
|
-
name?: string;
|
|
93
|
-
connectionId?: string;
|
|
94
|
-
}): Promise<BaseEntity | undefined>;
|
|
95
|
-
abstract deleteEntityById({ id }: {
|
|
96
|
-
id: string;
|
|
97
|
-
}): Promise<BaseEntity>;
|
|
98
|
-
abstract upsertRecords(params: {
|
|
99
|
-
entityId: string;
|
|
100
|
-
records: Pick<BaseRecord, 'externalId' | 'data' | 'entityType'>[];
|
|
101
|
-
}): Promise<void>;
|
|
102
|
-
abstract getRecordsByEntityId(params: {
|
|
103
|
-
entityId: string;
|
|
104
|
-
}): Promise<BaseRecord[]>;
|
|
105
|
-
abstract getRecordsByEntityName({ name, connectionId, }: {
|
|
106
|
-
name: string;
|
|
107
|
-
connectionId: string;
|
|
108
|
-
}): Promise<BaseRecord[]>;
|
|
109
|
-
abstract getRecords({ entityName, connectionId, options, }: {
|
|
110
|
-
entityName: string;
|
|
111
|
-
options: QueryOptions;
|
|
112
|
-
connectionId: string;
|
|
113
|
-
}): Promise<BaseRecord[]>;
|
|
114
|
-
abstract syncRecords({ connectionId, name, records, lastSyncId, }: {
|
|
115
|
-
name: string;
|
|
116
|
-
connectionId: string;
|
|
117
|
-
records: Pick<BaseRecord, 'externalId' | 'data'>[];
|
|
118
|
-
lastSyncId?: string;
|
|
119
|
-
}): Promise<void>;
|
|
120
|
-
abstract getRecordsByEntityNameAndExternalId({ entityName, connectionId, externalId, }: {
|
|
121
|
-
entityName: string;
|
|
122
|
-
connectionId: string;
|
|
123
|
-
externalId: string;
|
|
124
|
-
}): Promise<BaseRecord[]>;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export { type BaseEntity as B, type DatabaseConfig as D, FilterOperators as F, MastraEngine as M, PropertyType as P, type QueryOptions as Q, type SortOrder as S, type BaseRecord as a, type FilterCondition as b };
|