@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.
@@ -3,7 +3,7 @@ name: mastra-mssql
3
3
  description: Documentation for @mastra/mssql. Use when working with @mastra/mssql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/mssql"
6
- version: "1.10.5"
6
+ version: "1.10.6-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.10.5",
2
+ "version": "1.10.6-alpha.0",
3
3
  "package": "@mastra/mssql",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -294,7 +294,7 @@ const storage = new MongoDBStore({
294
294
 
295
295
  ## Reclaiming disk
296
296
 
297
- `prune()` deletes rows but doesn't shrink the database file. On SQLite/libSQL the freed pages go on a freelist and are reused by future writes, so the file stops growing: for most users this alone solves the unbounded-growth problem.
297
+ `prune()` deletes rows but doesn't shrink the database file. On SQLite/libSQL the freed pages go on a freelist for reuse by future writes. Reusing these pages prevents unbounded file growth for most users.
298
298
 
299
299
  Handing that free space back to the OS is a separate concern that Mastra doesn't manage. If you specifically need to shrink the file, run the underlying database's compaction (for example `VACUUM` on self-hosted libSQL) yourself in a maintenance window. A full `VACUUM` locks the file and needs roughly twice the file size in free disk. On PostgreSQL, autovacuum reclaims dead tuples for reuse automatically. A manual `VACUUM FULL` is only needed if you must return disk to the OS.
300
300
 
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region \0rolldown/runtime.js
2
+ // \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -20,7 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
23
- //#endregion
24
23
  let _mastra_core_error = require("@mastra/core/error");
25
24
  let _mastra_core_storage = require("@mastra/core/storage");
26
25
  let mssql = require("mssql");
@@ -29,7 +28,7 @@ let _mastra_core_utils = require("@mastra/core/utils");
29
28
  let _mastra_core_base = require("@mastra/core/base");
30
29
  let _mastra_core_agent = require("@mastra/core/agent");
31
30
  let _mastra_core_evals = require("@mastra/core/evals");
32
- //#region src/storage/db/utils.ts
31
+ // src/storage/db/utils.ts
33
32
  function getSchemaName$1(schema) {
34
33
  return schema ? `[${(0, _mastra_core_utils.parseSqlIdentifier)(schema, "schema name")}]` : void 0;
35
34
  }
@@ -38,8 +37,7 @@ function getTableName$1({ indexName, schemaName }) {
38
37
  const quotedSchemaName = schemaName;
39
38
  return quotedSchemaName ? `${quotedSchemaName}.${quotedIndexName}` : quotedIndexName;
40
39
  }
41
- //#endregion
42
- //#region src/storage/db/index.ts
40
+ // src/storage/db/index.ts
43
41
  /**
44
42
  * Resolves MssqlDomainConfig to pool and schema.
45
43
  * Domain classes create their own MssqlDB instance from the returned pool.
@@ -1057,8 +1055,7 @@ MIGRATION REQUIRED: Duplicate spans detected in ${duplicateInfo.tableName}\n====
1057
1055
  }
1058
1056
  }
1059
1057
  };
1060
- //#endregion
1061
- //#region src/storage/domains/utils.ts
1058
+ // src/storage/domains/utils.ts
1062
1059
  function getSchemaName(schema) {
1063
1060
  return schema ? `[${(0, _mastra_core_utils.parseSqlIdentifier)(schema, "schema name")}]` : void 0;
1064
1061
  }
@@ -1180,8 +1177,7 @@ function transformFromSqlRow({ tableName, sqlRow }) {
1180
1177
  });
1181
1178
  return result;
1182
1179
  }
1183
- //#endregion
1184
- //#region src/storage/domains/agents/index.ts
1180
+ // src/storage/domains/agents/index.ts
1185
1181
  var AgentsMSSQL = class AgentsMSSQL extends _mastra_core_storage.AgentsStorage {
1186
1182
  pool;
1187
1183
  schema;
@@ -1769,8 +1765,7 @@ var AgentsMSSQL = class AgentsMSSQL extends _mastra_core_storage.AgentsStorage {
1769
1765
  }
1770
1766
  }
1771
1767
  };
1772
- //#endregion
1773
- //#region src/storage/domains/background-tasks/index.ts
1768
+ // src/storage/domains/background-tasks/index.ts
1774
1769
  function serializeJson(v) {
1775
1770
  if (typeof v === "object" && v != null) return JSON.stringify(v);
1776
1771
  return v ?? null;
@@ -2131,8 +2126,7 @@ var BackgroundTasksMSSQL = class BackgroundTasksMSSQL extends _mastra_core_stora
2131
2126
  return Number(result.recordset[0]?.count ?? 0);
2132
2127
  }
2133
2128
  };
2134
- //#endregion
2135
- //#region src/storage/db/run-fencing.ts
2129
+ // src/storage/db/run-fencing.ts
2136
2130
  /**
2137
2131
  * Epoch milliseconds on the database clock. SQL Server evaluates
2138
2132
  * `SYSUTCDATETIME()` once when a statement starts, so a statement that waits
@@ -2199,8 +2193,7 @@ async function claimTransaction(pool, fn) {
2199
2193
  if (attempt >= MAX_CLAIM_ATTEMPTS || !(number === ERR_DEADLOCK_VICTIM || number === ERR_PRIMARY_KEY || number === ERR_UNIQUE_INDEX)) throw error;
2200
2194
  }
2201
2195
  }
2202
- //#endregion
2203
- //#region src/storage/domains/memory/index.ts
2196
+ // src/storage/domains/memory/index.ts
2204
2197
  function bindMssqlMetadataParams(request, params) {
2205
2198
  for (const [paramName, paramValue] of Object.entries(params)) request.input(paramName, paramValue);
2206
2199
  }
@@ -3360,8 +3353,7 @@ var MemoryMSSQL = class MemoryMSSQL extends _mastra_core_storage.MemoryStorage {
3360
3353
  }
3361
3354
  }
3362
3355
  };
3363
- //#endregion
3364
- //#region src/storage/domains/observability/index.ts
3356
+ // src/storage/domains/observability/index.ts
3365
3357
  var ObservabilityMSSQL = class ObservabilityMSSQL extends _mastra_core_storage.ObservabilityStorage {
3366
3358
  static retentionTables = { spans: {
3367
3359
  table: _mastra_core_storage.TABLE_SPANS,
@@ -4002,8 +3994,7 @@ var ObservabilityMSSQL = class ObservabilityMSSQL extends _mastra_core_storage.O
4002
3994
  }
4003
3995
  }
4004
3996
  };
4005
- //#endregion
4006
- //#region src/storage/domains/scores/index.ts
3997
+ // src/storage/domains/scores/index.ts
4007
3998
  /**
4008
3999
  * MSSQL-specific score row transformation.
4009
4000
  * Converts timestamp strings to Date objects.
@@ -4419,8 +4410,7 @@ var ScoresMSSQL = class ScoresMSSQL extends _mastra_core_storage.ScoresStorage {
4419
4410
  }
4420
4411
  }
4421
4412
  };
4422
- //#endregion
4423
- //#region src/storage/domains/workflow-definitions/index.ts
4413
+ // src/storage/domains/workflow-definitions/index.ts
4424
4414
  function parseJson(value, column, rowId) {
4425
4415
  if (value == null) return null;
4426
4416
  if (typeof value === "string") try {
@@ -4623,8 +4613,7 @@ var WorkflowDefinitionsMSSQL = class WorkflowDefinitionsMSSQL extends _mastra_co
4623
4613
  await request.query(`DELETE FROM ${tableName} WHERE [id] = @id`);
4624
4614
  }
4625
4615
  };
4626
- //#endregion
4627
- //#region src/storage/domains/workflows/index.ts
4616
+ // src/storage/domains/workflows/index.ts
4628
4617
  const RUN_OWNER_COLUMNS = `[generation], [ownerId], [leaseExpiresAt], ${DB_NOW_MS} AS [nowMs]`;
4629
4618
  function toRunOwnershipRecord(runId, row) {
4630
4619
  const leaseExpiresAt = row.leaseExpiresAt === null ? null : Number(row.leaseExpiresAt);
@@ -5161,8 +5150,7 @@ var WorkflowsMSSQL = class WorkflowsMSSQL extends _mastra_core_storage.Workflows
5161
5150
  }
5162
5151
  }
5163
5152
  };
5164
- //#endregion
5165
- //#region src/storage/index.ts
5153
+ // src/storage/index.ts
5166
5154
  /**
5167
5155
  * Type guard for pre-configured pool config
5168
5156
  */
@@ -5275,12 +5263,8 @@ var MSSQLStore = class extends _mastra_core_storage.MastraCompositeStore {
5275
5263
  }
5276
5264
  }
5277
5265
  async _performInitializationAndStore() {
5278
- try {
5279
- await this.pool.connect();
5280
- return true;
5281
- } catch (err) {
5282
- throw err;
5283
- }
5266
+ await this.pool.connect();
5267
+ return true;
5284
5268
  }
5285
5269
  /**
5286
5270
  * Closes the MSSQL connection pool.
@@ -5291,7 +5275,6 @@ var MSSQLStore = class extends _mastra_core_storage.MastraCompositeStore {
5291
5275
  await this.pool.close();
5292
5276
  }
5293
5277
  };
5294
- //#endregion
5295
5278
  exports.AgentsMSSQL = AgentsMSSQL;
5296
5279
  exports.BackgroundTasksMSSQL = BackgroundTasksMSSQL;
5297
5280
  exports.MSSQLStore = MSSQLStore;