@mastra/spanner 1.9.0-alpha.0 → 1.9.1-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-spanner
3
3
  description: Documentation for @mastra/spanner. Use when working with @mastra/spanner APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/spanner"
6
- version: "1.9.0-alpha.0"
6
+ version: "1.9.1-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.9.0-alpha.0",
2
+ "version": "1.9.1-alpha.0",
3
3
  "package": "@mastra/spanner",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -202,7 +202,7 @@ async function retentionTick() {
202
202
  }
203
203
  ```
204
204
 
205
- You can also cancel a long-running prune with an `AbortSignal`: the loop stops between batches and returns partial results with `done: false`, so the next run resumes cleanly.
205
+ You can also cancel a long-running prune with an `AbortSignal`: the loop stops between batches and returns partial results with `done: false`. The next run resumes cleanly.
206
206
 
207
207
  ## ClickHouse native TTL
208
208
 
package/dist/index.cjs CHANGED
@@ -4,7 +4,6 @@ let _mastra_core_error = require("@mastra/core/error");
4
4
  let _mastra_core_storage = require("@mastra/core/storage");
5
5
  let _mastra_core_base = require("@mastra/core/base");
6
6
  let _mastra_core_utils = require("@mastra/core/utils");
7
- let crypto = require("crypto");
8
7
  let _mastra_core_agent = require("@mastra/core/agent");
9
8
  let _mastra_core_evals = require("@mastra/core/evals");
10
9
  //#region src/storage/db/utils.ts
@@ -3004,7 +3003,7 @@ var DatasetsSpanner = class DatasetsSpanner extends _mastra_core_storage.Dataset
3004
3003
  async createDataset(input) {
3005
3004
  try {
3006
3005
  const now = /* @__PURE__ */ new Date();
3007
- const id = input.id ?? (0, crypto.randomUUID)();
3006
+ const id = input.id ?? globalThis.crypto.randomUUID();
3008
3007
  if (input.id !== void 0) this.validateCallerDefinedDatasetId(input.id);
3009
3008
  const record = {
3010
3009
  id,
@@ -3352,7 +3351,7 @@ var DatasetsSpanner = class DatasetsSpanner extends _mastra_core_storage.Dataset
3352
3351
  await this.db.insert({
3353
3352
  tableName: _mastra_core_storage.TABLE_DATASET_VERSIONS,
3354
3353
  record: {
3355
- id: (0, crypto.randomUUID)(),
3354
+ id: globalThis.crypto.randomUUID(),
3356
3355
  datasetId,
3357
3356
  version,
3358
3357
  createdAt: now
@@ -3390,7 +3389,7 @@ var DatasetsSpanner = class DatasetsSpanner extends _mastra_core_storage.Dataset
3390
3389
  async _doAddItem(args) {
3391
3390
  try {
3392
3391
  const now = /* @__PURE__ */ new Date();
3393
- const itemId = (0, crypto.randomUUID)();
3392
+ const itemId = globalThis.crypto.randomUUID();
3394
3393
  let created = null;
3395
3394
  await this.db.runWithAbortRetry(() => this.database.runTransactionAsync(async (tx) => {
3396
3395
  try {
@@ -3884,7 +3883,7 @@ var DatasetsSpanner = class DatasetsSpanner extends _mastra_core_storage.Dataset
3884
3883
  async createDatasetVersion(datasetId, version) {
3885
3884
  try {
3886
3885
  const now = /* @__PURE__ */ new Date();
3887
- const id = (0, crypto.randomUUID)();
3886
+ const id = globalThis.crypto.randomUUID();
3888
3887
  await this.db.insert({
3889
3888
  tableName: _mastra_core_storage.TABLE_DATASET_VERSIONS,
3890
3889
  record: {
@@ -3998,7 +3997,7 @@ var DatasetsSpanner = class DatasetsSpanner extends _mastra_core_storage.Dataset
3998
3997
  });
3999
3998
  historyRows = rows.map(rowToItemRow);
4000
3999
  }
4001
- const plan = this.planDatasetItemBatch(input.items, historyRows, crypto.randomUUID);
4000
+ const plan = this.planDatasetItemBatch(input.items, historyRows, () => globalThis.crypto.randomUUID());
4002
4001
  const resolved = new Map([...plan.existingCurrentItems].map(([id, row]) => [id, this.datasetItemFromRow(row)]));
4003
4002
  if (plan.inserts.length > 0) {
4004
4003
  const now = /* @__PURE__ */ new Date();
@@ -4355,7 +4354,7 @@ var ExperimentsSpanner = class ExperimentsSpanner extends _mastra_core_storage.E
4355
4354
  async createExperiment(input) {
4356
4355
  try {
4357
4356
  const now = /* @__PURE__ */ new Date();
4358
- const id = input.id ?? (0, crypto.randomUUID)();
4357
+ const id = input.id ?? globalThis.crypto.randomUUID();
4359
4358
  const experiment = {
4360
4359
  id,
4361
4360
  name: input.name ?? void 0,
@@ -4673,7 +4672,7 @@ var ExperimentsSpanner = class ExperimentsSpanner extends _mastra_core_storage.E
4673
4672
  async addExperimentResult(input) {
4674
4673
  try {
4675
4674
  const now = /* @__PURE__ */ new Date();
4676
- const id = input.id ?? (0, crypto.randomUUID)();
4675
+ const id = input.id ?? globalThis.crypto.randomUUID();
4677
4676
  return await this.#withPurgeBarrier(input.experimentId, input.itemId, async (tx, marker) => {
4678
4677
  const result = {
4679
4678
  id,
@@ -4800,7 +4799,7 @@ var ExperimentsSpanner = class ExperimentsSpanner extends _mastra_core_storage.E
4800
4799
  };
4801
4800
  if (!existingRow) {
4802
4801
  const result = {
4803
- id: (0, crypto.randomUUID)(),
4802
+ id: globalThis.crypto.randomUUID(),
4804
4803
  experimentId: input.experimentId,
4805
4804
  itemId: input.itemId,
4806
4805
  ...values,
@@ -8376,7 +8375,7 @@ async function batchCreateMetrics(database, args) {
8376
8375
  const now = /* @__PURE__ */ new Date();
8377
8376
  const encodeJson = (v) => v == null ? null : JSON.stringify(v);
8378
8377
  const rows = args.metrics.map((m) => ({
8379
- metricId: m.metricId ?? (0, crypto.randomUUID)(),
8378
+ metricId: m.metricId ?? globalThis.crypto.randomUUID(),
8380
8379
  timestamp: m.timestamp instanceof Date ? m.timestamp : new Date(m.timestamp),
8381
8380
  name: m.name,
8382
8381
  value: _google_cloud_spanner.Spanner.float(Number(m.value)),
@@ -10543,7 +10542,7 @@ var SchedulesSpanner = class SchedulesSpanner extends _mastra_core_storage.Sched
10543
10542
  await this.db.insert({
10544
10543
  tableName: _mastra_core_storage.TABLE_SCHEDULE_TRIGGERS,
10545
10544
  record: {
10546
- id: trigger.id ?? (0, crypto.randomUUID)(),
10545
+ id: trigger.id ?? globalThis.crypto.randomUUID(),
10547
10546
  schedule_id: trigger.scheduleId,
10548
10547
  run_id: trigger.runId ?? null,
10549
10548
  scheduled_fire_at: trigger.scheduledFireAt,
@@ -11329,7 +11328,7 @@ var ScoresSpanner = class ScoresSpanner extends _mastra_core_storage.ScoresStora
11329
11328
  }
11330
11329
  try {
11331
11330
  const suppliedId = validatedScore.id;
11332
- const scoreId = suppliedId ?? (0, crypto.randomUUID)();
11331
+ const scoreId = suppliedId ?? globalThis.crypto.randomUUID();
11333
11332
  const now = /* @__PURE__ */ new Date();
11334
11333
  const { id: _suppliedId, scorer, preprocessStepResult, analyzeStepResult, metadata, input, output, additionalContext, requestContext, entity, ...rest } = validatedScore;
11335
11334
  const insertedRecord = {