@mastra/oracledb 0.4.1 → 0.4.2-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/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-memory-observational-memory.md +61 -14
- package/dist/docs/references/reference-storage-retention.md +1 -1
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/observational-buffering.d.ts.map +1 -1
- package/dist/storage/domains/memory/observational.d.ts.map +1 -1
- package/dist/storage/domains/memory/utils.d.ts.map +1 -1
- package/dist/storage/domains/observability/logs.d.ts.map +1 -1
- package/dist/storage/domains/observability/scores-bridge.d.ts.map +1 -1
- package/dist/storage/domains/scores/index.d.ts.map +1 -1
- package/dist/vector/upsert.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MastraVector, validateTopK, validateUpsertInput } from "@mastra/core/vector";
|
|
2
2
|
import oracledb from "oracledb";
|
|
3
3
|
import { ErrorCategory, ErrorDomain, MastraError } from "@mastra/core/error";
|
|
4
|
-
import { createHash
|
|
4
|
+
import { createHash } from "crypto";
|
|
5
5
|
import { AgentsStorage, MCPClientsStorage, MastraCompositeStore, MemoryStorage, ObservabilityStorage, ScorerDefinitionsStorage, ScoresStorage, TABLE_AGENTS, TABLE_AGENT_VERSIONS, TABLE_MCP_CLIENTS, TABLE_MCP_CLIENT_VERSIONS, TABLE_MESSAGES, TABLE_OBSERVATIONAL_MEMORY, TABLE_RESOURCES, TABLE_SCHEMAS, TABLE_SCORERS, TABLE_SCORER_DEFINITIONS, TABLE_SCORER_DEFINITION_VERSIONS, TABLE_SPANS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, TraceStatus, WorkflowsStorage, calculatePagination, createStorageErrorId, createVectorErrorId, executeRetentionPrune, listLogsArgsSchema, listScoresArgsSchema, listTracesArgsSchema, matchesExpectedWorkflowStatus, normalizePerPage, resolveRetentionTargets, retentionCutoffMs, storageMessageMatchesMetadataFilter, toTraceSpans, transformScoreRow, validateStorageMetadataFilter } from "@mastra/core/storage";
|
|
6
6
|
import { MessageList } from "@mastra/core/agent";
|
|
7
7
|
import { saveScorePayloadSchema } from "@mastra/core/evals";
|
|
@@ -538,7 +538,7 @@ async function upsert(registry, withConnection, upsertBatchSize, { indexName, ve
|
|
|
538
538
|
if (error instanceof MastraError) throw error;
|
|
539
539
|
throw asMastraError("UPSERT", "INVALID_INPUT", { indexName }, error, ErrorCategory.USER);
|
|
540
540
|
}
|
|
541
|
-
const vectorIds = ids ?? vectors.map(() => randomUUID());
|
|
541
|
+
const vectorIds = ids ?? vectors.map(() => globalThis.crypto.randomUUID());
|
|
542
542
|
return withConnection(async (connection) => {
|
|
543
543
|
const indexInfo = await registry.getIndexMetadata(connection, indexName);
|
|
544
544
|
try {
|
|
@@ -3440,7 +3440,7 @@ function parseBufferedChunks(value) {
|
|
|
3440
3440
|
return parsed.map((chunk) => {
|
|
3441
3441
|
const item = chunk;
|
|
3442
3442
|
return {
|
|
3443
|
-
id: String(item.id ?? `ombuf-${randomUUID()}`),
|
|
3443
|
+
id: String(item.id ?? `ombuf-${globalThis.crypto.randomUUID()}`),
|
|
3444
3444
|
cycleId: String(item.cycleId ?? ""),
|
|
3445
3445
|
observations: String(item.observations ?? ""),
|
|
3446
3446
|
tokenCount: Math.round(numberOrZero(item.tokenCount)),
|
|
@@ -4324,7 +4324,7 @@ async function getObservationalMemoryHistory(ctx, threadId, resourceId, limit =
|
|
|
4324
4324
|
async function initializeObservationalMemory(ctx, input) {
|
|
4325
4325
|
const now = /* @__PURE__ */ new Date();
|
|
4326
4326
|
const record = {
|
|
4327
|
-
id: randomUUID(),
|
|
4327
|
+
id: globalThis.crypto.randomUUID(),
|
|
4328
4328
|
scope: input.scope,
|
|
4329
4329
|
threadId: input.threadId,
|
|
4330
4330
|
resourceId: input.resourceId,
|
|
@@ -4401,7 +4401,7 @@ async function updateActiveObservations(ctx, input) {
|
|
|
4401
4401
|
async function createReflectionGeneration(ctx, input) {
|
|
4402
4402
|
const now = /* @__PURE__ */ new Date();
|
|
4403
4403
|
const record = {
|
|
4404
|
-
id: randomUUID(),
|
|
4404
|
+
id: globalThis.crypto.randomUUID(),
|
|
4405
4405
|
scope: input.currentRecord.scope,
|
|
4406
4406
|
threadId: input.currentRecord.threadId,
|
|
4407
4407
|
resourceId: input.currentRecord.resourceId,
|
|
@@ -4725,7 +4725,7 @@ async function updateBufferedObservations(ctx, input) {
|
|
|
4725
4725
|
await ctx.db.tx(async (_client, connection) => {
|
|
4726
4726
|
const existingChunks = parseBufferedChunks((await lockOMRow(ctx, connection, input.id, "UPDATE_BUFFERED_OBSERVATIONS")).bufferedObservationChunks);
|
|
4727
4727
|
const newChunk = {
|
|
4728
|
-
id: `ombuf-${randomUUID()}`,
|
|
4728
|
+
id: `ombuf-${globalThis.crypto.randomUUID()}`,
|
|
4729
4729
|
cycleId: input.chunk.cycleId,
|
|
4730
4730
|
observations: input.chunk.observations,
|
|
4731
4731
|
tokenCount: Math.round(input.chunk.tokenCount),
|
|
@@ -4831,7 +4831,7 @@ async function swapBufferedReflectionToActive(ctx, input) {
|
|
|
4831
4831
|
const now = /* @__PURE__ */ new Date();
|
|
4832
4832
|
const lockedRecord = parseOMRow(row);
|
|
4833
4833
|
const newRecord = {
|
|
4834
|
-
id: randomUUID(),
|
|
4834
|
+
id: globalThis.crypto.randomUUID(),
|
|
4835
4835
|
scope: lockedRecord.scope,
|
|
4836
4836
|
threadId: lockedRecord.threadId,
|
|
4837
4837
|
resourceId: lockedRecord.resourceId,
|
|
@@ -5465,7 +5465,7 @@ var MemoryOracle = class MemoryOracle extends MemoryStorage {
|
|
|
5465
5465
|
const sourceThread = await this.getThreadById({ threadId: args.sourceThreadId });
|
|
5466
5466
|
if (!sourceThread) throw storageError$1("CLONE_THREAD", "FAILED", { threadId: args.sourceThreadId }, /* @__PURE__ */ new Error(`Thread ${args.sourceThreadId} not found`), ErrorCategory.USER);
|
|
5467
5467
|
const sourceMessages = await this.messagesForClone(args);
|
|
5468
|
-
const newThreadId = args.newThreadId ?? randomUUID();
|
|
5468
|
+
const newThreadId = args.newThreadId ?? globalThis.crypto.randomUUID();
|
|
5469
5469
|
if (await this.getThreadById({ threadId: newThreadId })) throw storageError$1("CLONE_THREAD", "DESTINATION_EXISTS", { threadId: newThreadId }, /* @__PURE__ */ new Error(`Thread ${newThreadId} already exists`), ErrorCategory.USER);
|
|
5470
5470
|
const now = /* @__PURE__ */ new Date();
|
|
5471
5471
|
const cloneMetadata = {
|
|
@@ -5487,7 +5487,7 @@ var MemoryOracle = class MemoryOracle extends MemoryStorage {
|
|
|
5487
5487
|
};
|
|
5488
5488
|
const messageIdMap = {};
|
|
5489
5489
|
const clonedMessages = sourceMessages.map((message) => {
|
|
5490
|
-
const newMessageId = randomUUID();
|
|
5490
|
+
const newMessageId = globalThis.crypto.randomUUID();
|
|
5491
5491
|
messageIdMap[message.id] = newMessageId;
|
|
5492
5492
|
return {
|
|
5493
5493
|
...message,
|
|
@@ -5964,7 +5964,7 @@ async function batchCreateLogs(db, schemaName, args) {
|
|
|
5964
5964
|
try {
|
|
5965
5965
|
const binds = args.logs.map((log) => logRecordBinds({
|
|
5966
5966
|
...log,
|
|
5967
|
-
logId: log.logId ?? randomUUID(),
|
|
5967
|
+
logId: log.logId ?? globalThis.crypto.randomUUID(),
|
|
5968
5968
|
executionSource: log.executionSource ?? log.source ?? null
|
|
5969
5969
|
}));
|
|
5970
5970
|
await db.tx(async (client) => {
|
|
@@ -6221,7 +6221,7 @@ function transformObservabilityScoreRow(row) {
|
|
|
6221
6221
|
};
|
|
6222
6222
|
}
|
|
6223
6223
|
function scoreRecordToTableRecord(score) {
|
|
6224
|
-
const id = score.scoreId ?? randomUUID();
|
|
6224
|
+
const id = score.scoreId ?? globalThis.crypto.randomUUID();
|
|
6225
6225
|
const timestamp = score.timestamp instanceof Date ? score.timestamp : new Date(score.timestamp ?? Date.now());
|
|
6226
6226
|
const source = score.scoreSource ?? score.source ?? "observability";
|
|
6227
6227
|
const contextualMetadata = removeUndefined({
|
|
@@ -7570,7 +7570,7 @@ var ScoresOracle = class ScoresOracle extends ScoresStorage {
|
|
|
7570
7570
|
}, error, ErrorCategory.USER);
|
|
7571
7571
|
}
|
|
7572
7572
|
try {
|
|
7573
|
-
const id = randomUUID();
|
|
7573
|
+
const id = globalThis.crypto.randomUUID();
|
|
7574
7574
|
const now = /* @__PURE__ */ new Date();
|
|
7575
7575
|
await this.db.insert({
|
|
7576
7576
|
tableName: TABLE_SCORERS,
|