@mastra/mssql 1.10.5 → 1.10.6-alpha.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.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { parseSqlIdentifier } from "@mastra/core/utils";
5
5
  import { MastraBase } from "@mastra/core/base";
6
6
  import { MessageList } from "@mastra/core/agent";
7
7
  import { saveScorePayloadSchema } from "@mastra/core/evals";
8
- //#region src/storage/db/utils.ts
8
+ // src/storage/db/utils.ts
9
9
  function getSchemaName$1(schema) {
10
10
  return schema ? `[${parseSqlIdentifier(schema, "schema name")}]` : void 0;
11
11
  }
@@ -14,8 +14,7 @@ function getTableName$1({ indexName, schemaName }) {
14
14
  const quotedSchemaName = schemaName;
15
15
  return quotedSchemaName ? `${quotedSchemaName}.${quotedIndexName}` : quotedIndexName;
16
16
  }
17
- //#endregion
18
- //#region src/storage/db/index.ts
17
+ // src/storage/db/index.ts
19
18
  /**
20
19
  * Resolves MssqlDomainConfig to pool and schema.
21
20
  * Domain classes create their own MssqlDB instance from the returned pool.
@@ -1033,8 +1032,7 @@ MIGRATION REQUIRED: Duplicate spans detected in ${duplicateInfo.tableName}\n====
1033
1032
  }
1034
1033
  }
1035
1034
  };
1036
- //#endregion
1037
- //#region src/storage/domains/utils.ts
1035
+ // src/storage/domains/utils.ts
1038
1036
  function getSchemaName(schema) {
1039
1037
  return schema ? `[${parseSqlIdentifier(schema, "schema name")}]` : void 0;
1040
1038
  }
@@ -1156,8 +1154,7 @@ function transformFromSqlRow({ tableName, sqlRow }) {
1156
1154
  });
1157
1155
  return result;
1158
1156
  }
1159
- //#endregion
1160
- //#region src/storage/domains/agents/index.ts
1157
+ // src/storage/domains/agents/index.ts
1161
1158
  var AgentsMSSQL = class AgentsMSSQL extends AgentsStorage {
1162
1159
  pool;
1163
1160
  schema;
@@ -1745,8 +1742,7 @@ var AgentsMSSQL = class AgentsMSSQL extends AgentsStorage {
1745
1742
  }
1746
1743
  }
1747
1744
  };
1748
- //#endregion
1749
- //#region src/storage/domains/background-tasks/index.ts
1745
+ // src/storage/domains/background-tasks/index.ts
1750
1746
  function serializeJson(v) {
1751
1747
  if (typeof v === "object" && v != null) return JSON.stringify(v);
1752
1748
  return v ?? null;
@@ -2107,8 +2103,7 @@ var BackgroundTasksMSSQL = class BackgroundTasksMSSQL extends BackgroundTasksSto
2107
2103
  return Number(result.recordset[0]?.count ?? 0);
2108
2104
  }
2109
2105
  };
2110
- //#endregion
2111
- //#region src/storage/db/run-fencing.ts
2106
+ // src/storage/db/run-fencing.ts
2112
2107
  /**
2113
2108
  * Epoch milliseconds on the database clock. SQL Server evaluates
2114
2109
  * `SYSUTCDATETIME()` once when a statement starts, so a statement that waits
@@ -2175,8 +2170,7 @@ async function claimTransaction(pool, fn) {
2175
2170
  if (attempt >= MAX_CLAIM_ATTEMPTS || !(number === ERR_DEADLOCK_VICTIM || number === ERR_PRIMARY_KEY || number === ERR_UNIQUE_INDEX)) throw error;
2176
2171
  }
2177
2172
  }
2178
- //#endregion
2179
- //#region src/storage/domains/memory/index.ts
2173
+ // src/storage/domains/memory/index.ts
2180
2174
  function bindMssqlMetadataParams(request, params) {
2181
2175
  for (const [paramName, paramValue] of Object.entries(params)) request.input(paramName, paramValue);
2182
2176
  }
@@ -3336,8 +3330,7 @@ var MemoryMSSQL = class MemoryMSSQL extends MemoryStorage {
3336
3330
  }
3337
3331
  }
3338
3332
  };
3339
- //#endregion
3340
- //#region src/storage/domains/observability/index.ts
3333
+ // src/storage/domains/observability/index.ts
3341
3334
  var ObservabilityMSSQL = class ObservabilityMSSQL extends ObservabilityStorage {
3342
3335
  static retentionTables = { spans: {
3343
3336
  table: TABLE_SPANS,
@@ -3978,8 +3971,7 @@ var ObservabilityMSSQL = class ObservabilityMSSQL extends ObservabilityStorage {
3978
3971
  }
3979
3972
  }
3980
3973
  };
3981
- //#endregion
3982
- //#region src/storage/domains/scores/index.ts
3974
+ // src/storage/domains/scores/index.ts
3983
3975
  /**
3984
3976
  * MSSQL-specific score row transformation.
3985
3977
  * Converts timestamp strings to Date objects.
@@ -4395,8 +4387,7 @@ var ScoresMSSQL = class ScoresMSSQL extends ScoresStorage {
4395
4387
  }
4396
4388
  }
4397
4389
  };
4398
- //#endregion
4399
- //#region src/storage/domains/workflow-definitions/index.ts
4390
+ // src/storage/domains/workflow-definitions/index.ts
4400
4391
  function parseJson(value, column, rowId) {
4401
4392
  if (value == null) return null;
4402
4393
  if (typeof value === "string") try {
@@ -4599,8 +4590,7 @@ var WorkflowDefinitionsMSSQL = class WorkflowDefinitionsMSSQL extends WorkflowDe
4599
4590
  await request.query(`DELETE FROM ${tableName} WHERE [id] = @id`);
4600
4591
  }
4601
4592
  };
4602
- //#endregion
4603
- //#region src/storage/domains/workflows/index.ts
4593
+ // src/storage/domains/workflows/index.ts
4604
4594
  const RUN_OWNER_COLUMNS = `[generation], [ownerId], [leaseExpiresAt], ${DB_NOW_MS} AS [nowMs]`;
4605
4595
  function toRunOwnershipRecord(runId, row) {
4606
4596
  const leaseExpiresAt = row.leaseExpiresAt === null ? null : Number(row.leaseExpiresAt);
@@ -5137,8 +5127,7 @@ var WorkflowsMSSQL = class WorkflowsMSSQL extends WorkflowsStorage {
5137
5127
  }
5138
5128
  }
5139
5129
  };
5140
- //#endregion
5141
- //#region src/storage/index.ts
5130
+ // src/storage/index.ts
5142
5131
  /**
5143
5132
  * Type guard for pre-configured pool config
5144
5133
  */
@@ -5251,12 +5240,8 @@ var MSSQLStore = class extends MastraCompositeStore {
5251
5240
  }
5252
5241
  }
5253
5242
  async _performInitializationAndStore() {
5254
- try {
5255
- await this.pool.connect();
5256
- return true;
5257
- } catch (err) {
5258
- throw err;
5259
- }
5243
+ await this.pool.connect();
5244
+ return true;
5260
5245
  }
5261
5246
  /**
5262
5247
  * Closes the MSSQL connection pool.
@@ -5267,7 +5252,6 @@ var MSSQLStore = class extends MastraCompositeStore {
5267
5252
  await this.pool.close();
5268
5253
  }
5269
5254
  };
5270
- //#endregion
5271
5255
  export { AgentsMSSQL, BackgroundTasksMSSQL, MSSQLStore, MemoryMSSQL, ObservabilityMSSQL, ScoresMSSQL, WorkflowDefinitionsMSSQL, WorkflowsMSSQL };
5272
5256
 
5273
5257
  //# sourceMappingURL=index.js.map