@mastra/core 0.1.27-alpha.0 → 0.1.27-alpha.2
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 +2 -34
- package/dist/{next-src/agent → agent}/index.d.ts +3 -2
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/core.cjs.development.js +186 -24
- package/dist/core.cjs.development.js.map +1 -1
- package/dist/core.cjs.production.min.js +1 -1
- package/dist/core.cjs.production.min.js.map +1 -1
- package/dist/core.esm.js +177 -25
- package/dist/core.esm.js.map +1 -1
- package/dist/engine/index.d.ts +147 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/schema.d.ts +37 -0
- package/dist/engine/schema.d.ts.map +1 -0
- package/dist/engine/types.d.ts +116 -0
- package/dist/engine/types.d.ts.map +1 -0
- package/dist/engine/utils.d.ts +28 -0
- package/dist/engine/utils.d.ts.map +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/{next-src/integration → integration}/index.d.ts +1 -3
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/mastra/index.d.ts +41 -0
- package/dist/mastra/index.d.ts.map +1 -0
- package/dist/sync/types.d.ts +16 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/{next-src/tools → tools}/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/{next-src/tools → tools}/types.d.ts +4 -4
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/vector/index.d.ts +18 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/dist/workflows/index.d.ts +98 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/types.d.ts +48 -94
- package/dist/workflows/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/agents/agent-apis.d.ts +0 -32
- package/dist/agents/agent-apis.d.ts.map +0 -1
- package/dist/agents/file-logger.d.ts +0 -6
- package/dist/agents/file-logger.d.ts.map +0 -1
- package/dist/agents/index.d.ts +0 -53
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/openai/assistant.d.ts +0 -77
- package/dist/agents/openai/assistant.d.ts.map +0 -1
- package/dist/agents/utils.d.ts +0 -22
- package/dist/agents/utils.d.ts.map +0 -1
- package/dist/agents/vector-sync.d.ts +0 -47
- package/dist/agents/vector-sync.d.ts.map +0 -1
- package/dist/agents/vercel/index.d.ts +0 -44
- package/dist/agents/vercel/index.d.ts.map +0 -1
- package/dist/authenticator.d.ts +0 -63
- package/dist/authenticator.d.ts.map +0 -1
- package/dist/constants.d.ts +0 -2
- package/dist/constants.d.ts.map +0 -1
- package/dist/framework.d.ts +0 -245
- package/dist/framework.d.ts.map +0 -1
- package/dist/integration.d.ts +0 -100
- package/dist/integration.d.ts.map +0 -1
- package/dist/lib/index.d.ts +0 -2
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/utils/object.d.ts +0 -51
- package/dist/lib/utils/object.d.ts.map +0 -1
- package/dist/next/callback.d.ts +0 -4
- package/dist/next/callback.d.ts.map +0 -1
- package/dist/next/connect.d.ts +0 -4
- package/dist/next/connect.d.ts.map +0 -1
- package/dist/next/cron.d.ts +0 -13
- package/dist/next/cron.d.ts.map +0 -1
- package/dist/next/index.d.ts +0 -16
- package/dist/next/index.d.ts.map +0 -1
- package/dist/next/inngest.d.ts +0 -4
- package/dist/next/inngest.d.ts.map +0 -1
- package/dist/next/utils.d.ts +0 -10
- package/dist/next/utils.d.ts.map +0 -1
- package/dist/next/webhook.d.ts +0 -10
- package/dist/next/webhook.d.ts.map +0 -1
- package/dist/next-src/agent/index.d.ts.map +0 -1
- package/dist/next-src/index.d.ts +0 -41
- package/dist/next-src/index.d.ts.map +0 -1
- package/dist/next-src/integration/index.d.ts.map +0 -1
- package/dist/next-src/logger/index.d.ts.map +0 -1
- package/dist/next-src/tools/index.d.ts.map +0 -1
- package/dist/next-src/tools/types.d.ts.map +0 -1
- package/dist/schemas.d.ts +0 -98
- package/dist/schemas.d.ts.map +0 -1
- package/dist/sync-factory.d.ts +0 -14
- package/dist/sync-factory.d.ts.map +0 -1
- package/dist/sync-fixtures/github.d.ts +0 -950
- package/dist/sync-fixtures/github.d.ts.map +0 -1
- package/dist/sync-fixtures/stripe.d.ts +0 -93
- package/dist/sync-fixtures/stripe.d.ts.map +0 -1
- package/dist/types.d.ts +0 -401
- package/dist/types.d.ts.map +0 -1
- package/dist/utils/errors.d.ts +0 -4
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -15
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/inngest.d.ts +0 -7
- package/dist/utils/inngest.d.ts.map +0 -1
- package/dist/utils/text.d.ts +0 -2
- package/dist/utils/text.d.ts.map +0 -1
- package/dist/vector-access/index.d.ts +0 -22
- package/dist/vector-access/index.d.ts.map +0 -1
- package/dist/vector-access/types.d.ts +0 -7
- package/dist/vector-access/types.d.ts.map +0 -1
- package/dist/workflows/apis.d.ts +0 -9
- package/dist/workflows/apis.d.ts.map +0 -1
- package/dist/workflows/conditions/constants.d.ts +0 -17
- package/dist/workflows/conditions/constants.d.ts.map +0 -1
- package/dist/workflows/conditions/types.d.ts +0 -3
- package/dist/workflows/conditions/types.d.ts.map +0 -1
- package/dist/workflows/handler.d.ts +0 -69
- package/dist/workflows/handler.d.ts.map +0 -1
- package/dist/workflows/runner.d.ts +0 -52
- package/dist/workflows/runner.d.ts.map +0 -1
- package/dist/workflows/schemas.d.ts +0 -1044
- package/dist/workflows/schemas.d.ts.map +0 -1
- package/dist/workflows/utils.d.ts +0 -112
- package/dist/workflows/utils.d.ts.map +0 -1
- /package/dist/{next-src/logger → logger}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,40 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mastra/core
|
|
2
2
|
|
|
3
3
|
This is a guide to developing the core package.
|
|
4
4
|
|
|
5
|
-
### Ensure Docker is Installed
|
|
6
|
-
|
|
7
|
-
If you haven't already, install Docker: (Docker Installation)[https://www.docker.com/]
|
|
8
|
-
|
|
9
|
-
### Start Docker Containers
|
|
10
|
-
|
|
11
|
-
1. Navigate to the .dev directory:`cd .dev`
|
|
12
|
-
2. Start the Docker containers:
|
|
13
|
-
`docker-compose up -d`
|
|
14
|
-
|
|
15
|
-
This command will spin up the necessary services, including the database and the Inngest server.
|
|
16
|
-
|
|
17
|
-
### Setup Environment Variables
|
|
18
|
-
|
|
19
|
-
1. Copy the sample environment variable files:
|
|
20
|
-
packages/admin/.env.local.sample
|
|
21
|
-
packages/core/.env.local.sample
|
|
22
|
-
2. Duplicate and rename each .env.local.sample file to .env:
|
|
23
|
-
cp packages/admin/.env.local.sample packages/admin/.env`
|
|
24
|
-
cp packages/core/.env.local.sample packages/core/.env`
|
|
25
|
-
|
|
26
|
-
Note: We won’t need to do this again after the first setup if the CLI persists credentials.
|
|
27
|
-
|
|
28
5
|
### Install Dependencies for Core Package
|
|
29
6
|
|
|
30
7
|
1. Navigate to the core directory:`cd packages/core`
|
|
31
|
-
2. Install the dependencies:`pnpm install`
|
|
32
|
-
|
|
33
|
-
### Build and Initialize CLI
|
|
34
|
-
|
|
35
|
-
1. Navigate to the cli directory:`cd packages/cli`
|
|
36
|
-
2. Build the project and run the initialization script:`pnpm run build && node dist/index.js init`
|
|
37
|
-
3. When prompted, supply the necessary credentials:
|
|
38
|
-
|
|
39
|
-
Database URL: postgresql://postgres:postgres@localhost:5432/postgres
|
|
40
|
-
Inngest Server URL: http://localhost:8288
|
|
8
|
+
2. Install the dependencies:`pnpm install`
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserContent } from 'ai';
|
|
1
2
|
import { Integration } from '../integration';
|
|
2
3
|
import { Logger } from '../logger';
|
|
3
4
|
import { AllTools, ToolApi } from '../tools/types';
|
|
@@ -48,12 +49,12 @@ export declare class Agent<TIntegrations extends Integration[] | undefined = und
|
|
|
48
49
|
private getAgentParams;
|
|
49
50
|
private createOpenAICompatibleModel;
|
|
50
51
|
text({ messages, onStepFinish, maxSteps, }: {
|
|
51
|
-
messages:
|
|
52
|
+
messages: UserContent[];
|
|
52
53
|
onStepFinish?: (step: string) => void;
|
|
53
54
|
maxSteps?: number;
|
|
54
55
|
}): Promise<import("ai").GenerateTextResult<{}>>;
|
|
55
56
|
stream({ messages, onStepFinish, maxSteps, }: {
|
|
56
|
-
messages:
|
|
57
|
+
messages: UserContent[];
|
|
57
58
|
onStepFinish?: (step: string) => void;
|
|
58
59
|
maxSteps?: number;
|
|
59
60
|
}): Promise<import("ai").StreamTextResult<{}>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agent/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAOL,WAAW,EACZ,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAgB,MAAM,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAY,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE7D,KAAK,sBAAsB,GAAG,OAAO,GAAG,aAAa,GAAG,eAAe,CAAC;AAExE,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,sBAAsB,CAAC;IAC7B,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;CACjC,CAAC;AAEF,KAAK,yBAAyB,GAC1B,wBAAwB,GACxB,0BAA0B,GAC1B,yBAAyB,GACzB,4BAA4B,CAAC;AAEjC,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,IAAI,EAAE,yBAAyB,CAAC;IAChC,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;CACjC,CAAC;AAEF,KAAK,oBAAoB,GACrB,uCAAuC,GACvC,sCAAsC,GACtC,cAAc,GACd,aAAa,CAAC;AAElB,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,oBAAoB,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;CACjC,CAAC;AAEF,KAAK,WAAW,GACZ,kBAAkB,GAClB,qBAAqB,GACrB,gBAAgB,CAAC;AAIrB,qBAAa,KAAK,CAChB,aAAa,SAAS,WAAW,EAAE,GAAG,SAAS,GAAG,SAAS,EAC3D,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,GAAG,SAAS,GAAG,SAAS,EAC7E,KAAK,SAAS,MAAM,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG,MAAM,QAAQ,CAClE,aAAa,EACb,MAAM,CACP;;IAEM,IAAI,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvD,MAAM,EAAE,MAAM,CAAC;gBAEH,MAAM,EAAE;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,WAAW,CAAC;QACnB,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;KAChD;IAYD;;;OAGG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC;IAKxC;;;OAGG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM;IAK1B,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,YAAY;IAuBpB,OAAO,CAAC,cAAc;IAwFtB,OAAO,CAAC,2BAA2B;IAgB7B,IAAI,CAAC,EACT,QAAQ,EACR,YAAY,EACZ,QAAY,GACb,EAAE;QACD,QAAQ,EAAE,WAAW,EAAE,CAAC;QACxB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;IAmDK,MAAM,CAAC,EACX,QAAQ,EACR,YAAY,EACZ,QAAY,GACb,EAAE;QACD,QAAQ,EAAE,WAAW,EAAE,CAAC;QACxB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB;CAkDF"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var redis = require('@upstash/redis');
|
|
6
|
-
var fs = require('fs');
|
|
7
|
-
var path = require('path');
|
|
8
5
|
var anthropic = require('@ai-sdk/anthropic');
|
|
9
6
|
var openai = require('@ai-sdk/openai');
|
|
10
7
|
var ai = require('ai');
|
|
8
|
+
var redis = require('@upstash/redis');
|
|
9
|
+
var fs = require('fs');
|
|
10
|
+
var path = require('path');
|
|
11
11
|
var zod = require('zod');
|
|
12
12
|
|
|
13
13
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
@@ -1218,10 +1218,148 @@ var GmailIntegration = /*#__PURE__*/function (_Integration2) {
|
|
|
1218
1218
|
return GmailIntegration;
|
|
1219
1219
|
}(Integration);
|
|
1220
1220
|
|
|
1221
|
+
exports.PropertyType = void 0;
|
|
1222
|
+
(function (PropertyType) {
|
|
1223
|
+
PropertyType["LONG_TEXT"] = "LONG_TEXT";
|
|
1224
|
+
PropertyType["SINGLE_LINE_TEXT"] = "SINGLE_LINE_TEXT";
|
|
1225
|
+
PropertyType["SINGLE_SELECT"] = "SINGLE_SELECT";
|
|
1226
|
+
PropertyType["MULTI_SELECT"] = "MULTI_SELECT";
|
|
1227
|
+
PropertyType["CHECKBOX"] = "CHECKBOX";
|
|
1228
|
+
PropertyType["DATE"] = "DATE";
|
|
1229
|
+
PropertyType["USER"] = "USER";
|
|
1230
|
+
PropertyType["BADGE_LIST"] = "BADGE_LIST";
|
|
1231
|
+
PropertyType["CURRENCY"] = "CURRENCY";
|
|
1232
|
+
PropertyType["URL"] = "URL";
|
|
1233
|
+
PropertyType["PHONE"] = "PHONE";
|
|
1234
|
+
PropertyType["CONTACT"] = "CONTACT";
|
|
1235
|
+
PropertyType["COMPANY"] = "COMPANY";
|
|
1236
|
+
PropertyType["PERSON"] = "PERSON";
|
|
1237
|
+
PropertyType["ENRICHMENT"] = "ENRICHMENT";
|
|
1238
|
+
PropertyType["COMPOSITE"] = "COMPOSITE";
|
|
1239
|
+
PropertyType["BOOLEAN"] = "BOOLEAN";
|
|
1240
|
+
PropertyType["NUMBER"] = "NUMBER";
|
|
1241
|
+
PropertyType["FLOAT"] = "FLOAT";
|
|
1242
|
+
PropertyType["JSON_OBJECT"] = "JSON_OBJECT";
|
|
1243
|
+
PropertyType["JSON_ARRAY"] = "JSON_ARRAY";
|
|
1244
|
+
})(exports.PropertyType || (exports.PropertyType = {}));
|
|
1245
|
+
exports.FilterOperators = void 0;
|
|
1246
|
+
(function (FilterOperators) {
|
|
1247
|
+
FilterOperators["IS"] = "is";
|
|
1248
|
+
FilterOperators["EQUAL"] = "eq";
|
|
1249
|
+
FilterOperators["NOT_EQUAL"] = "not_eq";
|
|
1250
|
+
FilterOperators["CONTAINS"] = "contains";
|
|
1251
|
+
FilterOperators["IN"] = "in";
|
|
1252
|
+
FilterOperators["NOT_IN"] = "not_in";
|
|
1253
|
+
FilterOperators["GREATER_THAN"] = "gt";
|
|
1254
|
+
FilterOperators["LESS_THAN"] = "lt";
|
|
1255
|
+
FilterOperators["NOT_CONTAINS"] = "not_contains";
|
|
1256
|
+
FilterOperators["GREATER_THAN_OR_EQUAL"] = "gte";
|
|
1257
|
+
FilterOperators["LESS_THAN_OR_EQUAL"] = "lte";
|
|
1258
|
+
FilterOperators["OP"] = "op";
|
|
1259
|
+
FilterOperators["SET"] = "set";
|
|
1260
|
+
FilterOperators["NOT_SET"] = "not_set";
|
|
1261
|
+
})(exports.FilterOperators || (exports.FilterOperators = {}));
|
|
1262
|
+
|
|
1263
|
+
var _FieldTypePrimitiveMa;
|
|
1264
|
+
var FieldTypePrimitiveMap = (_FieldTypePrimitiveMa = {}, _FieldTypePrimitiveMa[exports.PropertyType.BADGE_LIST] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.CHECKBOX] = 'boolean', _FieldTypePrimitiveMa[exports.PropertyType.BOOLEAN] = 'boolean', _FieldTypePrimitiveMa[exports.PropertyType.NUMBER] = 'number', _FieldTypePrimitiveMa[exports.PropertyType.FLOAT] = 'number', _FieldTypePrimitiveMa[exports.PropertyType.JSON_ARRAY] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.JSON_OBJECT] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.CURRENCY] = 'number', _FieldTypePrimitiveMa[exports.PropertyType.DATE] = 'date', _FieldTypePrimitiveMa[exports.PropertyType.LONG_TEXT] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.MULTI_SELECT] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.PHONE] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.SINGLE_LINE_TEXT] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.SINGLE_SELECT] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.URL] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.USER] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.CONTACT] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.COMPANY] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.COMPOSITE] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.PERSON] = 'string', _FieldTypePrimitiveMa[exports.PropertyType.ENRICHMENT] = 'string', _FieldTypePrimitiveMa);
|
|
1265
|
+
/**
|
|
1266
|
+
* Split a string on commas and strip quotes from each part
|
|
1267
|
+
* @param str input string
|
|
1268
|
+
* @returns array of strings
|
|
1269
|
+
*/
|
|
1270
|
+
var splitAndStripQuotes = function splitAndStripQuotes(str) {
|
|
1271
|
+
// Raw regex pattern for splitting on non-quoted commas
|
|
1272
|
+
var pattern = /,\s*(?=(?:[^"]*"[^"]*")*[^"]*$)/;
|
|
1273
|
+
// Split the string
|
|
1274
|
+
var parts = str.split(pattern);
|
|
1275
|
+
// Strip quotes from each part
|
|
1276
|
+
var cleanedParts = parts.map(function (part) {
|
|
1277
|
+
return part.trim().replace(/^"|"$/g, '');
|
|
1278
|
+
});
|
|
1279
|
+
return cleanedParts;
|
|
1280
|
+
};
|
|
1281
|
+
var transformFilterValueArray = function transformFilterValueArray(value) {
|
|
1282
|
+
if (typeof value === 'string') return value.split(',');
|
|
1283
|
+
return value;
|
|
1284
|
+
};
|
|
1285
|
+
var transformFilterValueBoolean = function transformFilterValueBoolean(value) {
|
|
1286
|
+
if (typeof value === 'string') return value === 'true';
|
|
1287
|
+
return value;
|
|
1288
|
+
};
|
|
1289
|
+
/**
|
|
1290
|
+
* This returns the SQL field for a JSON field with appropriate casting.
|
|
1291
|
+
* @param column - JSON field to cast.
|
|
1292
|
+
* @param type - Type of the JSON field.
|
|
1293
|
+
*/
|
|
1294
|
+
var getJSONField = function getJSONField(column, type) {
|
|
1295
|
+
var primitiveType = FieldTypePrimitiveMap[type];
|
|
1296
|
+
switch (primitiveType) {
|
|
1297
|
+
case 'number':
|
|
1298
|
+
{
|
|
1299
|
+
// cast to number if field is numeric
|
|
1300
|
+
return "(" + column + ")::bigint";
|
|
1301
|
+
}
|
|
1302
|
+
case 'boolean':
|
|
1303
|
+
{
|
|
1304
|
+
// cast to boolean if field is boolean
|
|
1305
|
+
return "(" + column + ")::boolean";
|
|
1306
|
+
}
|
|
1307
|
+
case 'date':
|
|
1308
|
+
{
|
|
1309
|
+
return "(" + column + ")::timestamp";
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
return "(" + column + ")::text";
|
|
1313
|
+
};
|
|
1314
|
+
/**
|
|
1315
|
+
* @description
|
|
1316
|
+
* Builds a query string from filter and sort query strings
|
|
1317
|
+
* @param filterQueryString Filter query string
|
|
1318
|
+
* @param sortQueryString Sort query string
|
|
1319
|
+
* @returns
|
|
1320
|
+
*/
|
|
1321
|
+
function buildQueryString(_ref) {
|
|
1322
|
+
var filterQueryString = _ref.filterQueryString,
|
|
1323
|
+
sortQueryString = _ref.sortQueryString;
|
|
1324
|
+
if (!filterQueryString && !sortQueryString) return '';
|
|
1325
|
+
if (!filterQueryString) return "" + sortQueryString;
|
|
1326
|
+
if (!sortQueryString) return "" + filterQueryString;
|
|
1327
|
+
return filterQueryString + "&" + sortQueryString;
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
var filterQuerySchema = /*#__PURE__*/zod.z.object({
|
|
1331
|
+
is: /*#__PURE__*/zod.z.array(zod.z.string()).or(zod.z.string()).optional(),
|
|
1332
|
+
eq: /*#__PURE__*/zod.z.array(zod.z.string()).or(zod.z.string()).optional(),
|
|
1333
|
+
not_eq: /*#__PURE__*/zod.z.array(zod.z.string()).or(zod.z.string()).optional(),
|
|
1334
|
+
contains: /*#__PURE__*/zod.z.array(zod.z.string()).or(zod.z.string()).optional(),
|
|
1335
|
+
not_contains: /*#__PURE__*/zod.z.array(zod.z.string()).or(zod.z.string()).optional(),
|
|
1336
|
+
gt: /*#__PURE__*/zod.z.array(zod.z.string()).or(zod.z.string()).optional(),
|
|
1337
|
+
gte: /*#__PURE__*/zod.z.array(zod.z.string()).or(zod.z.string()).optional(),
|
|
1338
|
+
lt: /*#__PURE__*/zod.z.array(zod.z.string()).or(zod.z.string()).optional(),
|
|
1339
|
+
lte: /*#__PURE__*/zod.z.array(zod.z.string()).or(zod.z.string()).optional(),
|
|
1340
|
+
"in": /*#__PURE__*/zod.z.array(zod.z.string()).or(zod.z.string()).optional(),
|
|
1341
|
+
not_in: /*#__PURE__*/zod.z.array(zod.z.string()).or(zod.z.string()).optional(),
|
|
1342
|
+
op: /*#__PURE__*/zod.z["enum"](['or', 'and']).optional()["default"]('or'),
|
|
1343
|
+
set: /*#__PURE__*/zod.z.string().optional().transform(transformFilterValueBoolean),
|
|
1344
|
+
not_set: /*#__PURE__*/zod.z.string().optional().transform(transformFilterValueBoolean)
|
|
1345
|
+
});
|
|
1346
|
+
var sortQuerySchema = /*#__PURE__*/zod.z.string().transform(transformFilterValueArray);
|
|
1347
|
+
|
|
1348
|
+
var MastraEngine =
|
|
1349
|
+
/**
|
|
1350
|
+
* Initializes the database connection
|
|
1351
|
+
* @param config Configuration object for database connection
|
|
1352
|
+
*/
|
|
1353
|
+
function MastraEngine(config) {};
|
|
1354
|
+
|
|
1355
|
+
var MastraVector = function MastraVector() {};
|
|
1356
|
+
|
|
1221
1357
|
var Mastra = /*#__PURE__*/function () {
|
|
1222
1358
|
function Mastra(config) {
|
|
1223
1359
|
var _this = this,
|
|
1224
1360
|
_config$integrations;
|
|
1361
|
+
this.engine = void 0;
|
|
1362
|
+
this.vectors = void 0;
|
|
1225
1363
|
this.tools = void 0;
|
|
1226
1364
|
this.agents = void 0;
|
|
1227
1365
|
this.integrations = void 0;
|
|
@@ -1283,33 +1421,47 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
1283
1421
|
agent.__setLogger(agentLogger);
|
|
1284
1422
|
}
|
|
1285
1423
|
});
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1424
|
+
if (config.syncs && !config.engine) {
|
|
1425
|
+
throw new Error('Engine is required to run syncs');
|
|
1426
|
+
}
|
|
1427
|
+
this.syncs = config.syncs || {};
|
|
1428
|
+
if (config.engine) {
|
|
1429
|
+
this.engine = config.engine;
|
|
1430
|
+
}
|
|
1431
|
+
if (config.vectors) {
|
|
1432
|
+
this.vectors = config.vectors;
|
|
1433
|
+
}
|
|
1292
1434
|
}
|
|
1293
1435
|
var _proto = Mastra.prototype;
|
|
1294
1436
|
_proto.sync = /*#__PURE__*/function () {
|
|
1295
1437
|
var _sync = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(key, params) {
|
|
1296
|
-
var
|
|
1438
|
+
var _this$syncs;
|
|
1439
|
+
var syncFn;
|
|
1297
1440
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1298
1441
|
while (1) switch (_context.prev = _context.next) {
|
|
1299
1442
|
case 0:
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
_context.next = 3;
|
|
1443
|
+
if (this.engine) {
|
|
1444
|
+
_context.next = 2;
|
|
1303
1445
|
break;
|
|
1304
1446
|
}
|
|
1305
1447
|
throw new Error("Sync function " + key + " not found");
|
|
1306
|
-
case
|
|
1307
|
-
|
|
1308
|
-
|
|
1448
|
+
case 2:
|
|
1449
|
+
syncFn = (_this$syncs = this.syncs) == null ? void 0 : _this$syncs[key];
|
|
1450
|
+
if (syncFn) {
|
|
1451
|
+
_context.next = 5;
|
|
1452
|
+
break;
|
|
1453
|
+
}
|
|
1454
|
+
throw new Error("Sync function " + key + " not found");
|
|
1455
|
+
case 5:
|
|
1456
|
+
_context.next = 7;
|
|
1457
|
+
return syncFn({
|
|
1309
1458
|
tools: this.tools,
|
|
1310
|
-
params: params
|
|
1459
|
+
params: params,
|
|
1460
|
+
engine: this.engine,
|
|
1461
|
+
agents: this.agents,
|
|
1462
|
+
vectors: this.vectors
|
|
1311
1463
|
});
|
|
1312
|
-
case
|
|
1464
|
+
case 7:
|
|
1313
1465
|
case "end":
|
|
1314
1466
|
return _context.stop();
|
|
1315
1467
|
}
|
|
@@ -1335,9 +1487,9 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
1335
1487
|
return integration;
|
|
1336
1488
|
};
|
|
1337
1489
|
_proto.availableIntegrations = function availableIntegrations() {
|
|
1338
|
-
return Array.from(this.integrations.entries()).map(function (
|
|
1339
|
-
var name =
|
|
1340
|
-
integration =
|
|
1490
|
+
return Array.from(this.integrations.entries()).map(function (_ref2) {
|
|
1491
|
+
var name = _ref2[0],
|
|
1492
|
+
integration = _ref2[1];
|
|
1341
1493
|
return {
|
|
1342
1494
|
name: name,
|
|
1343
1495
|
integration: integration
|
|
@@ -1347,9 +1499,9 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
1347
1499
|
_proto.getTools = function getTools() {
|
|
1348
1500
|
return this.tools;
|
|
1349
1501
|
};
|
|
1350
|
-
_proto.setLogger = function setLogger(
|
|
1351
|
-
var key =
|
|
1352
|
-
logger =
|
|
1502
|
+
_proto.setLogger = function setLogger(_ref3) {
|
|
1503
|
+
var key = _ref3.key,
|
|
1504
|
+
logger = _ref3.logger;
|
|
1353
1505
|
this.logger.set(key, logger);
|
|
1354
1506
|
};
|
|
1355
1507
|
_proto.getLogger = function getLogger(key) {
|
|
@@ -1360,13 +1512,23 @@ var Mastra = /*#__PURE__*/function () {
|
|
|
1360
1512
|
|
|
1361
1513
|
exports.Agent = Agent;
|
|
1362
1514
|
exports.BaseLogger = BaseLogger;
|
|
1515
|
+
exports.FieldTypePrimitiveMap = FieldTypePrimitiveMap;
|
|
1363
1516
|
exports.GmailIntegration = GmailIntegration;
|
|
1364
1517
|
exports.Integration = Integration;
|
|
1365
1518
|
exports.LogLevel = LogLevel;
|
|
1366
1519
|
exports.Mastra = Mastra;
|
|
1520
|
+
exports.MastraEngine = MastraEngine;
|
|
1521
|
+
exports.MastraVector = MastraVector;
|
|
1367
1522
|
exports.MultiLogger = MultiLogger;
|
|
1368
1523
|
exports.RegisteredLogger = RegisteredLogger;
|
|
1524
|
+
exports.buildQueryString = buildQueryString;
|
|
1369
1525
|
exports.createLogger = createLogger;
|
|
1370
1526
|
exports.createMultiLogger = createMultiLogger;
|
|
1371
1527
|
exports.createTool = createTool;
|
|
1528
|
+
exports.filterQuerySchema = filterQuerySchema;
|
|
1529
|
+
exports.getJSONField = getJSONField;
|
|
1530
|
+
exports.sortQuerySchema = sortQuerySchema;
|
|
1531
|
+
exports.splitAndStripQuotes = splitAndStripQuotes;
|
|
1532
|
+
exports.transformFilterValueArray = transformFilterValueArray;
|
|
1533
|
+
exports.transformFilterValueBoolean = transformFilterValueBoolean;
|
|
1372
1534
|
//# sourceMappingURL=core.cjs.development.js.map
|