@mastra/spanner 0.0.0 → 1.0.0-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/CHANGELOG.md +3 -9
- package/dist/docs/SKILL.md +22 -0
- package/dist/docs/assets/SOURCE_MAP.json +6 -0
- package/dist/docs/references/reference-storage-spanner.md +213 -0
- package/dist/index.cjs +9781 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9765 -0
- package/dist/index.js.map +1 -0
- package/dist/storage/db/index.d.ts +344 -0
- package/dist/storage/db/index.d.ts.map +1 -0
- package/dist/storage/db/utils.d.ts +27 -0
- package/dist/storage/db/utils.d.ts.map +1 -0
- package/dist/storage/domains/agents/index.d.ts +44 -0
- package/dist/storage/domains/agents/index.d.ts.map +1 -0
- package/dist/storage/domains/background-tasks/index.d.ts +27 -0
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -0
- package/dist/storage/domains/blobs/index.d.ts +36 -0
- package/dist/storage/domains/blobs/index.d.ts.map +1 -0
- package/dist/storage/domains/mcp-clients/index.d.ts +64 -0
- package/dist/storage/domains/mcp-clients/index.d.ts.map +1 -0
- package/dist/storage/domains/mcp-servers/index.d.ts +64 -0
- package/dist/storage/domains/mcp-servers/index.d.ts.map +1 -0
- package/dist/storage/domains/memory/index.d.ts +101 -0
- package/dist/storage/domains/memory/index.d.ts.map +1 -0
- package/dist/storage/domains/observability/index.d.ts +67 -0
- package/dist/storage/domains/observability/index.d.ts.map +1 -0
- package/dist/storage/domains/observability/metrics.d.ts +119 -0
- package/dist/storage/domains/observability/metrics.d.ts.map +1 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts +65 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -0
- package/dist/storage/domains/schedules/index.d.ts +55 -0
- package/dist/storage/domains/schedules/index.d.ts.map +1 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts +64 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -0
- package/dist/storage/domains/scores/index.d.ts +46 -0
- package/dist/storage/domains/scores/index.d.ts.map +1 -0
- package/dist/storage/domains/skills/index.d.ts +64 -0
- package/dist/storage/domains/skills/index.d.ts.map +1 -0
- package/dist/storage/domains/utils.d.ts +17 -0
- package/dist/storage/domains/utils.d.ts.map +1 -0
- package/dist/storage/domains/workflows/index.d.ts +97 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -0
- package/dist/storage/index.d.ts +178 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { Spanner } from '@google-cloud/spanner';
|
|
2
|
+
import type { Database, Transaction } from '@google-cloud/spanner';
|
|
3
|
+
import { MastraBase } from '@mastra/core/base';
|
|
4
|
+
import type { StorageColumn, TABLE_NAMES, CreateIndexOptions, IndexInfo, StorageIndexStats } from '@mastra/core/storage';
|
|
5
|
+
export type { CreateIndexOptions, IndexInfo, StorageIndexStats };
|
|
6
|
+
/**
|
|
7
|
+
* Controls whether `init()` is allowed to apply schema changes.
|
|
8
|
+
*
|
|
9
|
+
* - `'sync'` (default): the adapter creates missing tables, columns, and
|
|
10
|
+
* indexes during `init()`. This is the historical behavior.
|
|
11
|
+
* - `'validate'`: the adapter applies no DDL during `init()` and instead
|
|
12
|
+
* verifies that every table, column (from `alterTable.ifNotExists`), and
|
|
13
|
+
* default/custom index it would have created already exists. Missing
|
|
14
|
+
* schema elements throw a typed user error.
|
|
15
|
+
*
|
|
16
|
+
* `'validate'` is intended for environments where another process (Terraform,
|
|
17
|
+
* Liquibase, a release pipeline, etc.) owns the schema and Mastra should only
|
|
18
|
+
* verify that the live database matches what the adapter expects.
|
|
19
|
+
*/
|
|
20
|
+
export type SpannerInitMode = 'sync' | 'validate';
|
|
21
|
+
/**
|
|
22
|
+
* Configuration for standalone domain usage.
|
|
23
|
+
* Accepts either:
|
|
24
|
+
* 1. A pre-configured `database` (the domain reuses it as-is), or
|
|
25
|
+
* 2. Connection details from which the domain creates a Spanner client internally.
|
|
26
|
+
*/
|
|
27
|
+
export type SpannerDomainConfig = SpannerDomainDatabaseConfig | SpannerDomainConnectionConfig;
|
|
28
|
+
/**
|
|
29
|
+
* Reuse an existing Spanner Database handle.
|
|
30
|
+
*/
|
|
31
|
+
export interface SpannerDomainDatabaseConfig {
|
|
32
|
+
database: Database;
|
|
33
|
+
/** Custom indexes to create for this domain's tables */
|
|
34
|
+
indexes?: CreateIndexOptions[];
|
|
35
|
+
/** When true, skips creation of default indexes */
|
|
36
|
+
skipDefaultIndexes?: boolean;
|
|
37
|
+
/** See {@link SpannerInitMode}. Defaults to `'sync'`. */
|
|
38
|
+
initMode?: SpannerInitMode;
|
|
39
|
+
/**
|
|
40
|
+
* When true, versioned domains (agents / skills / prompt-blocks /
|
|
41
|
+
* mcp-clients / mcp-servers / scorer-definitions) sweep orphaned draft
|
|
42
|
+
* thin-row records during `init()` i.e. drafts whose paired version row
|
|
43
|
+
* was never written. Useful for cleaning up after process crashes that
|
|
44
|
+
* pre-date the transactional `create()` rewrite, or for environments
|
|
45
|
+
* where data integrity outweighs the small startup cost.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
cleanupStaleDraftsOnStartup?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Maximum acceptable staleness (in milliseconds) for read-only dashboard
|
|
51
|
+
* queries in the observability domain (metrics list / aggregates /
|
|
52
|
+
* breakdowns / time-series / percentiles / discovery). When > 0, these
|
|
53
|
+
* reads are issued as single-use read-only transactions with
|
|
54
|
+
* `maxStaleness`, which lets Spanner serve them from any replica that has
|
|
55
|
+
* data at least that fresh — they stop contending with leader writes and
|
|
56
|
+
* can be routed to a closer replica.
|
|
57
|
+
*
|
|
58
|
+
* Default is 0 (strong reads) for backwards compatibility and to keep
|
|
59
|
+
* write-then-read paths in tests deterministic. For real dashboards,
|
|
60
|
+
* 10000 (10 s) is a common sweet spot.
|
|
61
|
+
* @default 0
|
|
62
|
+
*/
|
|
63
|
+
dashboardStalenessMs?: number;
|
|
64
|
+
/**
|
|
65
|
+
* When true (the default), the observability domain's metric methods
|
|
66
|
+
* (`batchCreateMetrics`, `listMetrics`, `getMetricAggregate`, etc.) throw
|
|
67
|
+
* the base-class `*_NOT_IMPLEMENTED` errors and the metrics table is not
|
|
68
|
+
* created during `init()`. The `MastraStorageExporter` treats these
|
|
69
|
+
* errors as a signal to silently drop metric emissions, which is the
|
|
70
|
+
* recommended default for Spanner deployments: Spanner is row-oriented
|
|
71
|
+
* and OLTP-shaped, which makes it a poor fit for the high-volume,
|
|
72
|
+
* write-heavy, scan-heavy metrics workload. Pair Spanner spans with a
|
|
73
|
+
* dedicated OLAP store for metrics (BigQuery, DuckDB, ClickHouse) via a
|
|
74
|
+
* `MastraCompositeStore`-level wrapper that fans out by signal.
|
|
75
|
+
*
|
|
76
|
+
* Set to `false` to opt back in to the Spanner metrics implementation.
|
|
77
|
+
* It is correct and bounded at small scale (sustained < ~50 metrics/sec,
|
|
78
|
+
* < 1 yr retention), but past that you will hit hot-tail write
|
|
79
|
+
* contention on the leading-name index and analytical queries will start
|
|
80
|
+
* competing with span writes for node CPU.
|
|
81
|
+
* @default true
|
|
82
|
+
*/
|
|
83
|
+
disableMetrics?: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Create a Spanner client internally from connection details.
|
|
87
|
+
*/
|
|
88
|
+
export interface SpannerDomainConnectionConfig {
|
|
89
|
+
projectId: string;
|
|
90
|
+
instanceId: string;
|
|
91
|
+
databaseId: string;
|
|
92
|
+
/** Optional pass-through to the Spanner client constructor (auth, servicePath, etc.) */
|
|
93
|
+
spannerOptions?: ConstructorParameters<typeof Spanner>[0];
|
|
94
|
+
/** Custom indexes to create for this domain's tables */
|
|
95
|
+
indexes?: CreateIndexOptions[];
|
|
96
|
+
/** When true, skips creation of default indexes */
|
|
97
|
+
skipDefaultIndexes?: boolean;
|
|
98
|
+
/** See {@link SpannerInitMode}. Defaults to `'sync'`. */
|
|
99
|
+
initMode?: SpannerInitMode;
|
|
100
|
+
/** See {@link SpannerDomainDatabaseConfig.cleanupStaleDraftsOnStartup}. Defaults to `false`. */
|
|
101
|
+
cleanupStaleDraftsOnStartup?: boolean;
|
|
102
|
+
/** See {@link SpannerDomainDatabaseConfig.dashboardStalenessMs}. Defaults to `0`. */
|
|
103
|
+
dashboardStalenessMs?: number;
|
|
104
|
+
/** See {@link SpannerDomainDatabaseConfig.disableMetrics}. Defaults to `true`. */
|
|
105
|
+
disableMetrics?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Resolves a SpannerDomainConfig into a concrete Database handle plus options.
|
|
109
|
+
*/
|
|
110
|
+
export declare function resolveSpannerConfig(config: SpannerDomainConfig): {
|
|
111
|
+
database: Database;
|
|
112
|
+
indexes?: CreateIndexOptions[];
|
|
113
|
+
skipDefaultIndexes?: boolean;
|
|
114
|
+
initMode?: SpannerInitMode;
|
|
115
|
+
cleanupStaleDraftsOnStartup?: boolean;
|
|
116
|
+
dashboardStalenessMs?: number;
|
|
117
|
+
disableMetrics?: boolean;
|
|
118
|
+
ownsClient: boolean;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Internal helper that performs all GoogleSQL Spanner work for the various domain
|
|
122
|
+
* implementations (memory, workflows, scores, background-tasks).
|
|
123
|
+
*/
|
|
124
|
+
export declare class SpannerDB extends MastraBase {
|
|
125
|
+
database: Database;
|
|
126
|
+
skipDefaultIndexes?: boolean;
|
|
127
|
+
/** See {@link SpannerInitMode}. Public so domains can branch on it for
|
|
128
|
+
* domain-specific schema work that doesn't go through this class
|
|
129
|
+
* (e.g. the workflows snapshotStatus generated column). */
|
|
130
|
+
readonly initMode: SpannerInitMode;
|
|
131
|
+
/** Public so versioned domains can decide whether to call their
|
|
132
|
+
* cleanupStaleDrafts() helper during init(). Default false. */
|
|
133
|
+
readonly cleanupStaleDraftsOnStartup: boolean;
|
|
134
|
+
/** Cache of actual table columns: tableName -> Set<columnName> */
|
|
135
|
+
private tableColumnsCache;
|
|
136
|
+
constructor({ database, skipDefaultIndexes, initMode, cleanupStaleDraftsOnStartup, }: {
|
|
137
|
+
database: Database;
|
|
138
|
+
skipDefaultIndexes?: boolean;
|
|
139
|
+
initMode?: SpannerInitMode;
|
|
140
|
+
cleanupStaleDraftsOnStartup?: boolean;
|
|
141
|
+
});
|
|
142
|
+
/**
|
|
143
|
+
* Builds a typed user-facing error for validate-mode schema mismatches so
|
|
144
|
+
* operators get a clear signal that the externally-managed schema is out
|
|
145
|
+
* of date relative to what the adapter expects.
|
|
146
|
+
*/
|
|
147
|
+
private validateError;
|
|
148
|
+
/** Returns the set of column names that actually exist in the database table. */
|
|
149
|
+
private getTableColumns;
|
|
150
|
+
/** Returns true if the named table exists. */
|
|
151
|
+
private tableExists;
|
|
152
|
+
/** Returns true if `column` exists on `table`. */
|
|
153
|
+
hasColumn(table: string, column: string): Promise<boolean>;
|
|
154
|
+
/** Returns true if the named index exists. */
|
|
155
|
+
private indexExists;
|
|
156
|
+
/**
|
|
157
|
+
* Filter a record to only contain columns that exist in the live database table.
|
|
158
|
+
* Unknown columns are silently dropped to ensure forward compatibility with newer
|
|
159
|
+
* code writing columns the database hasn't been migrated to yet.
|
|
160
|
+
*/
|
|
161
|
+
private filterRecordToKnownColumns;
|
|
162
|
+
protected getDefaultLiteral(type: StorageColumn['type']): string;
|
|
163
|
+
/** Build the column definition fragment for a CREATE TABLE statement. */
|
|
164
|
+
private buildColumnDefinition;
|
|
165
|
+
/** Apply DDL statements via `database.updateSchema` and wait for the operation. */
|
|
166
|
+
private runDdl;
|
|
167
|
+
/**
|
|
168
|
+
* Run a single DML statement either inside the provided transaction or by
|
|
169
|
+
* starting a new short-lived read-write transaction. Spanner's `Database`
|
|
170
|
+
* surface exposes only `run` (read-only); DML must always go through a
|
|
171
|
+
* transaction.
|
|
172
|
+
*
|
|
173
|
+
* Auto-retries on `ABORTED` (gRPC code 10) Spanner aborts read-write
|
|
174
|
+
* transactions when they conflict with another, and the official guidance is
|
|
175
|
+
* to retry from the start. The emulator hits this much more often than
|
|
176
|
+
* managed Spanner because it serializes all read-write work.
|
|
177
|
+
*/
|
|
178
|
+
runDml(request: {
|
|
179
|
+
sql: string;
|
|
180
|
+
params?: Record<string, any>;
|
|
181
|
+
types?: Record<string, any>;
|
|
182
|
+
}, transaction?: Transaction): Promise<number>;
|
|
183
|
+
/**
|
|
184
|
+
* Retries `fn` on Spanner ABORTED errors with exponential backoff.
|
|
185
|
+
* Caps at 5 attempts (~1.5s total backoff) before surfacing the error.
|
|
186
|
+
*
|
|
187
|
+
* Public so domain implementations can wrap their own
|
|
188
|
+
* `database.runTransactionAsync` calls when running concurrent writes.
|
|
189
|
+
*/
|
|
190
|
+
runWithAbortRetry<T>(fn: () => Promise<T>): Promise<T>;
|
|
191
|
+
/**
|
|
192
|
+
* Determine the primary-key column list for a table. Some core tables (like
|
|
193
|
+
* `mastra_workflow_snapshot`) don't carry a single-column PK in the schema,
|
|
194
|
+
* so we hardcode known composite PKs here.
|
|
195
|
+
*/
|
|
196
|
+
private getPrimaryKeyColumns;
|
|
197
|
+
private validateTableSchema;
|
|
198
|
+
createTable({ tableName, schema, }: {
|
|
199
|
+
tableName: TABLE_NAMES;
|
|
200
|
+
schema: Record<string, StorageColumn>;
|
|
201
|
+
}): Promise<void>;
|
|
202
|
+
/**
|
|
203
|
+
* Adds columns from `schema` that don't yet exist on the table.
|
|
204
|
+
* Useful for forward-compatible schema migrations.
|
|
205
|
+
*/
|
|
206
|
+
alterTable({ tableName, schema, ifNotExists, }: {
|
|
207
|
+
tableName: TABLE_NAMES;
|
|
208
|
+
schema: Record<string, StorageColumn>;
|
|
209
|
+
ifNotExists: string[];
|
|
210
|
+
}): Promise<void>;
|
|
211
|
+
dropTable({ tableName }: {
|
|
212
|
+
tableName: TABLE_NAMES;
|
|
213
|
+
}): Promise<void>;
|
|
214
|
+
/** Spanner has no TRUNCATE fall back to `DELETE WHERE TRUE`. */
|
|
215
|
+
clearTable({ tableName }: {
|
|
216
|
+
tableName: TABLE_NAMES;
|
|
217
|
+
}): Promise<void>;
|
|
218
|
+
/**
|
|
219
|
+
* Converts a JS value into the form Spanner expects for the column.
|
|
220
|
+
* - jsonb: serialize to JSON string (caller must pass type 'json' in `types`).
|
|
221
|
+
* - integer/bigint: pass through (numbers are accepted; Spanner will coerce).
|
|
222
|
+
* - timestamp: ISO string when given a Date.
|
|
223
|
+
* - boolean: pass through as boolean.
|
|
224
|
+
* - text/uuid: stringify objects (legacy callers pass already-stringified JSON).
|
|
225
|
+
*/
|
|
226
|
+
prepareValue(value: any, columnName: string, tableName: TABLE_NAMES): any;
|
|
227
|
+
/**
|
|
228
|
+
* Convert a value into the shape the Spanner Mutations API expects for the
|
|
229
|
+
* given column. Mutations encoding differs from DML in three places:
|
|
230
|
+
*
|
|
231
|
+
* - JSON columns: the codec serializes plain JS objects with
|
|
232
|
+
* `JSON.stringify`, but it encodes arrays as protobuf `list_value`,
|
|
233
|
+
* which the server rejects for JSON-typed columns
|
|
234
|
+
* ("Could not parse list_value … as JSON"). Pre-stringifying every
|
|
235
|
+
* JSON value sidesteps that fork.
|
|
236
|
+
* - FLOAT64 columns: whole-number JS values like `100` get either
|
|
237
|
+
* INT64-inferred or string-encoded by the client when sent as a bare
|
|
238
|
+
* number — the server then refuses them. `Spanner.float()` is the
|
|
239
|
+
* documented escape hatch.
|
|
240
|
+
* - TIMESTAMP columns: the codec already handles `Date` instances via
|
|
241
|
+
* `.toJSON()`, so we pass them through as-is (DML's `prepareValue`
|
|
242
|
+
* converts to an ISO string because DML wants `'timestamp'` type
|
|
243
|
+
* hints; mutations don't take per-row hints).
|
|
244
|
+
*
|
|
245
|
+
* Everything else (text/uuid/bool/int) goes through `prepareValue` for
|
|
246
|
+
* parity with the DML path.
|
|
247
|
+
*/
|
|
248
|
+
prepareValueForMutation(value: any, columnName: string, tableName: TABLE_NAMES): any;
|
|
249
|
+
insert({ tableName, record, transaction, }: {
|
|
250
|
+
tableName: TABLE_NAMES;
|
|
251
|
+
record: Record<string, any>;
|
|
252
|
+
transaction?: Transaction;
|
|
253
|
+
}): Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* INSERT OR UPDATE upsert. Spanner cannot emit RETURNING-style results from
|
|
256
|
+
* INSERT OR UPDATE so callers must re-load the row when they need the post-write
|
|
257
|
+
* state.
|
|
258
|
+
*/
|
|
259
|
+
upsert({ tableName, record, transaction, }: {
|
|
260
|
+
tableName: TABLE_NAMES;
|
|
261
|
+
record: Record<string, any>;
|
|
262
|
+
transaction?: Transaction;
|
|
263
|
+
}): Promise<void>;
|
|
264
|
+
update({ tableName, keys, data, transaction, }: {
|
|
265
|
+
tableName: TABLE_NAMES;
|
|
266
|
+
keys: Record<string, any>;
|
|
267
|
+
data: Record<string, any>;
|
|
268
|
+
transaction?: Transaction;
|
|
269
|
+
}): Promise<void>;
|
|
270
|
+
batchInsert({ tableName, records }: {
|
|
271
|
+
tableName: TABLE_NAMES;
|
|
272
|
+
records: Record<string, any>[];
|
|
273
|
+
}): Promise<void>;
|
|
274
|
+
batchUpdate({ tableName, updates, }: {
|
|
275
|
+
tableName: TABLE_NAMES;
|
|
276
|
+
updates: Array<{
|
|
277
|
+
keys: Record<string, any>;
|
|
278
|
+
data: Record<string, any>;
|
|
279
|
+
}>;
|
|
280
|
+
}): Promise<void>;
|
|
281
|
+
batchDelete({ tableName, keys }: {
|
|
282
|
+
tableName: TABLE_NAMES;
|
|
283
|
+
keys: Record<string, any>[];
|
|
284
|
+
}): Promise<void>;
|
|
285
|
+
/**
|
|
286
|
+
* Binds a single (column, value) pair into the SQL conditions/params/types
|
|
287
|
+
* accumulators and returns the next available parameter index.
|
|
288
|
+
*
|
|
289
|
+
* The previous version of this helper accepted `i` as a primitive argument
|
|
290
|
+
* and used `i++` internally, which only mutated the local copy every
|
|
291
|
+
* call ended up emitting `@p0`. Returning the new counter value forces
|
|
292
|
+
* callers to thread the index forward and makes that footgun impossible.
|
|
293
|
+
*/
|
|
294
|
+
private aggregateParams;
|
|
295
|
+
load<R>({ tableName, keys }: {
|
|
296
|
+
tableName: TABLE_NAMES;
|
|
297
|
+
keys: Record<string, any>;
|
|
298
|
+
}): Promise<R | null>;
|
|
299
|
+
/**
|
|
300
|
+
* Convert a raw Spanner JSON row into the storage layer's expected shape.
|
|
301
|
+
* Handles JSON-string values, timestamp strings, and bigint integers returned
|
|
302
|
+
* by the Spanner client.
|
|
303
|
+
*/
|
|
304
|
+
transformRow<T = Record<string, any>>(tableName: TABLE_NAMES, row: Record<string, any>): T;
|
|
305
|
+
/**
|
|
306
|
+
* Build a parameterized WHERE fragment from a filter object.
|
|
307
|
+
* Supports `_gte`/`_gt`/`_lte`/`_lt` suffixes, `$in` operator, array-as-IN,
|
|
308
|
+
* and `null` IS NULL comparisons.
|
|
309
|
+
*/
|
|
310
|
+
prepareWhereClause(filters: Record<string, any>, tableName?: TABLE_NAMES): {
|
|
311
|
+
sql: string;
|
|
312
|
+
params: Record<string, any>;
|
|
313
|
+
types: Record<string, any>;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Reads an index from INFORMATION_SCHEMA and compares its table, column list
|
|
317
|
+
* (with ordering), and unique flag against the expected definition. Throws a
|
|
318
|
+
* typed VALIDATE_FAILED error when anything diverges so the operator can
|
|
319
|
+
* reconcile their externally-managed schema.
|
|
320
|
+
*/
|
|
321
|
+
private validateIndexDefinition;
|
|
322
|
+
createIndex(options: CreateIndexOptions): Promise<void>;
|
|
323
|
+
/**
|
|
324
|
+
* Creates a batch of indexes, swallowing per-index failures with a logger
|
|
325
|
+
* warning. Two classes of failure ALWAYS propagate:
|
|
326
|
+
*
|
|
327
|
+
* - validate-mode mismatches, so the operator sees the missing-index
|
|
328
|
+
* error instead of a silent no-op;
|
|
329
|
+
* - failures on `unique: true` indexes, because a unique index encodes a
|
|
330
|
+
* data-integrity invariant (e.g. duplicate-version prevention). If we
|
|
331
|
+
* swallowed those failures the invariant would silently not be in
|
|
332
|
+
* force, so we surface the error and let init() abort.
|
|
333
|
+
*
|
|
334
|
+
* Non-unique indexes are best-effort: domains use this for both default
|
|
335
|
+
* and custom index creation, and the swallow behavior keeps `init()`
|
|
336
|
+
* resilient to transient races (another process creating the same index
|
|
337
|
+
* concurrently, etc.).
|
|
338
|
+
*/
|
|
339
|
+
createIndexes(indexes: CreateIndexOptions[]): Promise<void>;
|
|
340
|
+
dropIndex(indexName: string): Promise<void>;
|
|
341
|
+
listIndexes(tableName?: string): Promise<IndexInfo[]>;
|
|
342
|
+
describeIndex(indexName: string): Promise<StorageIndexStats>;
|
|
343
|
+
}
|
|
344
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAS/C,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,SAAS,EACT,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAI9B,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;AAEjE;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,UAAU,CAAC;AAElD;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,2BAA2B,GAAG,6BAA6B,CAAC;AAE9F;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,QAAQ,CAAC;IACnB,wDAAwD;IACxD,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,mDAAmD;IACnD,k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storage';
|
|
2
|
+
/**
|
|
3
|
+
* Quote a Spanner identifier with backticks. GoogleSQL uses backticks for
|
|
4
|
+
* identifiers that may collide with reserved keywords.
|
|
5
|
+
*/
|
|
6
|
+
export declare function quoteIdent(name: string, kind?: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the GoogleSQL type literal corresponding to a storage column type.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getSpannerType(type: StorageColumn['type']): string;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the @google-cloud/spanner param type spec for a storage column type.
|
|
13
|
+
* Used when binding `null` values where Spanner needs an explicit type hint.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getSpannerParamType(type: StorageColumn['type'] | undefined): string;
|
|
16
|
+
/**
|
|
17
|
+
* Look up the storage column definition for a (table, column) pair.
|
|
18
|
+
* Returns undefined for columns not defined in the schema (e.g. internal columns).
|
|
19
|
+
*/
|
|
20
|
+
export declare function getColumnDef(table: TABLE_NAMES, column: string): StorageColumn | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Returns true if the value is the `$in` operator object used by storage filters.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isInOperator(value: unknown): value is {
|
|
25
|
+
$in: unknown[];
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/storage/db/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIvE;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAe,GAAG,MAAM,CAGpE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,MAAM,CAqBlE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAkBnF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAE1F;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,GAAG,EAAE,OAAO,EAAE,CAAA;CAAE,CAIxE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { AgentsStorage } from '@mastra/core/storage';
|
|
2
|
+
import type { AgentVersion, CreateIndexOptions, CreateVersionInput, ListVersionsInput, ListVersionsOutput, StorageAgentType, StorageCreateAgentInput, StorageListAgentsInput, StorageListAgentsOutput, StorageUpdateAgentInput } from '@mastra/core/storage';
|
|
3
|
+
import type { SpannerDomainConfig } from '../../db/index.js';
|
|
4
|
+
export declare class AgentsSpanner extends AgentsStorage {
|
|
5
|
+
private database;
|
|
6
|
+
private db;
|
|
7
|
+
private readonly skipDefaultIndexes?;
|
|
8
|
+
private readonly indexes?;
|
|
9
|
+
static readonly MANAGED_TABLES: readonly ["mastra_agents", "mastra_agent_versions"];
|
|
10
|
+
constructor(config: SpannerDomainConfig);
|
|
11
|
+
init(): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Sweeps orphaned draft thin-rows whose paired version row was never written.
|
|
14
|
+
* Skipped under `initMode: 'validate'` because that mode owns the schema and
|
|
15
|
+
* data externally and must never issue destructive DML.
|
|
16
|
+
*/
|
|
17
|
+
private cleanupStaleDrafts;
|
|
18
|
+
getDefaultIndexDefinitions(): CreateIndexOptions[];
|
|
19
|
+
createDefaultIndexes(): Promise<void>;
|
|
20
|
+
createCustomIndexes(): Promise<void>;
|
|
21
|
+
dangerouslyClearAll(): Promise<void>;
|
|
22
|
+
private parseAgentRow;
|
|
23
|
+
/** Coerces stored instructions (string or JSON-stringified array of blocks) back to its API shape. */
|
|
24
|
+
private deserializeInstructions;
|
|
25
|
+
private serializeInstructions;
|
|
26
|
+
private parseVersionRow;
|
|
27
|
+
getById(id: string): Promise<StorageAgentType | null>;
|
|
28
|
+
create(input: {
|
|
29
|
+
agent: StorageCreateAgentInput;
|
|
30
|
+
}): Promise<StorageAgentType>;
|
|
31
|
+
update(input: StorageUpdateAgentInput): Promise<StorageAgentType>;
|
|
32
|
+
/** Removes an agent and all its versions atomically in a single transaction. */
|
|
33
|
+
delete(id: string): Promise<void>;
|
|
34
|
+
list(args?: StorageListAgentsInput): Promise<StorageListAgentsOutput>;
|
|
35
|
+
createVersion(input: CreateVersionInput): Promise<AgentVersion>;
|
|
36
|
+
getVersion(id: string): Promise<AgentVersion | null>;
|
|
37
|
+
getVersionByNumber(agentId: string, versionNumber: number): Promise<AgentVersion | null>;
|
|
38
|
+
getLatestVersion(agentId: string): Promise<AgentVersion | null>;
|
|
39
|
+
listVersions(input: ListVersionsInput): Promise<ListVersionsOutput>;
|
|
40
|
+
deleteVersion(id: string): Promise<void>;
|
|
41
|
+
deleteVersionsByParentId(entityId: string): Promise<void>;
|
|
42
|
+
countVersions(agentId: string): Promise<number>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/agents/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EAQd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAEV,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AA2BpD,qBAAa,aAAc,SAAQ,aAAa;IAC9C,OAAO,CAAC,QAAQ,CAAW;IAC3B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C,YAAY,GAAG,IAAI,CAAC;IA0BxF,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IA0B/D,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA+DnE,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBxC,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBzD,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAqBtD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { BackgroundTask, TaskFilter, TaskListResult, UpdateBackgroundTask } from '@mastra/core/background-tasks';
|
|
2
|
+
import type { CreateIndexOptions } from '@mastra/core/storage';
|
|
3
|
+
import { BackgroundTasksStorage } from '@mastra/core/storage';
|
|
4
|
+
import type { SpannerDomainConfig } from '../../db/index.js';
|
|
5
|
+
export declare class BackgroundTasksSpanner extends BackgroundTasksStorage {
|
|
6
|
+
private database;
|
|
7
|
+
private db;
|
|
8
|
+
private skipDefaultIndexes?;
|
|
9
|
+
private indexes?;
|
|
10
|
+
static readonly MANAGED_TABLES: readonly ["mastra_background_tasks"];
|
|
11
|
+
constructor(config: SpannerDomainConfig);
|
|
12
|
+
init(): Promise<void>;
|
|
13
|
+
getDefaultIndexDefinitions(): CreateIndexOptions[];
|
|
14
|
+
createDefaultIndexes(): Promise<void>;
|
|
15
|
+
createCustomIndexes(): Promise<void>;
|
|
16
|
+
dangerouslyClearAll(): Promise<void>;
|
|
17
|
+
private tableName;
|
|
18
|
+
createTask(task: BackgroundTask): Promise<void>;
|
|
19
|
+
updateTask(taskId: string, update: UpdateBackgroundTask): Promise<void>;
|
|
20
|
+
getTask(taskId: string): Promise<BackgroundTask | null>;
|
|
21
|
+
listTasks(filter: TaskFilter): Promise<TaskListResult>;
|
|
22
|
+
deleteTask(taskId: string): Promise<void>;
|
|
23
|
+
deleteTasks(filter: TaskFilter): Promise<void>;
|
|
24
|
+
getRunningCount(): Promise<number>;
|
|
25
|
+
getRunningCountByAgent(agentId: string): Promise<number>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/background-tasks/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAEd,UAAU,EACV,cAAc,EACd,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EACL,sBAAsB,EAIvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AA2EpD,qBAAa,sBAAuB,SAAQ,sBAAsB;IAChE,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,EAAE,CAAY;IACtB,OAAO,CAAC,kBAAkB,CAAC,CAAU;IACrC,OAAO,CAAC,OAAO,CAAC,CAAuB;IAEvC,MAAM,CAAC,QAAQ,CAAC,cAAc,uCAAqC;gBAEvD,MAAM,EAAE,mBAAmB;IAWjC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAS3B,0BAA0B,IAAI,kBAAkB,EAAE;IAiD5C,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKrC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAKpC,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,OAAO,CAAC,SAAS;IAIX,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B/C,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAcvE,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAWvD,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,cAAc,CAAC;IAgItD,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOzC,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAsE9C,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAQlC,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAQ/D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BlobStore } from '@mastra/core/storage';
|
|
2
|
+
import type { StorageBlobEntry } from '@mastra/core/storage';
|
|
3
|
+
import type { SpannerDomainConfig } from '../../db/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Content-addressable blob store backed by Spanner. Blobs are keyed by their
|
|
6
|
+
* SHA-256 hash; duplicate puts are no-ops thanks to `INSERT OR IGNORE`.
|
|
7
|
+
*/
|
|
8
|
+
export declare class BlobsSpanner extends BlobStore {
|
|
9
|
+
private database;
|
|
10
|
+
private db;
|
|
11
|
+
private readonly skipDefaultIndexes?;
|
|
12
|
+
private readonly indexes?;
|
|
13
|
+
static readonly MANAGED_TABLES: readonly ["mastra_skill_blobs"];
|
|
14
|
+
constructor(config: SpannerDomainConfig);
|
|
15
|
+
/** Creates the blobs table and any caller-supplied custom indexes. */
|
|
16
|
+
init(): Promise<void>;
|
|
17
|
+
/** Creates custom indexes routed to the blobs table; no-op when none supplied. */
|
|
18
|
+
createCustomIndexes(): Promise<void>;
|
|
19
|
+
/** Removes every row from the blobs table. Intended for tests. */
|
|
20
|
+
dangerouslyClearAll(): Promise<void>;
|
|
21
|
+
/** Decodes a raw Spanner row into the public `StorageBlobEntry` shape. */
|
|
22
|
+
private parseRow;
|
|
23
|
+
/** Stores a single blob keyed by its hash. Idempotent: a repeat hash is a no-op. */
|
|
24
|
+
put(entry: StorageBlobEntry): Promise<void>;
|
|
25
|
+
/** Fetches a blob by its hash, or `null` when no row matches. */
|
|
26
|
+
get(hash: string): Promise<StorageBlobEntry | null>;
|
|
27
|
+
/** Returns true when a blob with the given hash exists; cheaper than `get`. */
|
|
28
|
+
has(hash: string): Promise<boolean>;
|
|
29
|
+
/** Deletes the blob with the given hash. Returns true when a row was removed. */
|
|
30
|
+
delete(hash: string): Promise<boolean>;
|
|
31
|
+
/** Atomically stores a batch of blobs in a single Spanner transaction. */
|
|
32
|
+
putMany(entries: StorageBlobEntry[]): Promise<void>;
|
|
33
|
+
/** Fetches multiple blobs by hash in chunks of 500. Missing hashes are absent from the map. */
|
|
34
|
+
getMany(hashes: string[]): Promise<Map<string, StorageBlobEntry>>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/blobs/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAA+D,MAAM,sBAAsB,CAAC;AAC9G,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEjF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAIpD;;;GAGG;AACH,qBAAa,YAAa,SAAQ,SAAS;IACzC,OAAO,CAAC,QAAQ,CAAW;IAC3B,OAAO,CAAC,EAAE,CAAY;IACtB,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAU;IAC9C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAuB;IAEhD,MAAM,CAAC,QAAQ,CAAC,cAAc,kCAAgC;gBAElD,MAAM,EAAE,mBAAmB;IASvC,sEAAsE;IAChE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,kFAAkF;IAC5E,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAK1C,kEAAkE;IAC5D,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1C,0EAA0E;IAC1E,OAAO,CAAC,QAAQ;IAWhB,oFAAoF;IAC9E,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAyCjD,iEAAiE;IAC3D,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAsBzD,+EAA+E;IACzE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAqBzC,iFAAiF;IAC3E,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAoB5C,0EAA0E;IACpE,OAAO,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAoDzD,+FAA+F;IACzF,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAgCxE"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { MCPClientsStorage } from '@mastra/core/storage';
|
|
2
|
+
import type { CreateIndexOptions, StorageMCPClientType, StorageCreateMCPClientInput, StorageListMCPClientsInput, StorageListMCPClientsOutput, StorageUpdateMCPClientInput } from '@mastra/core/storage';
|
|
3
|
+
import type { CreateMCPClientVersionInput, ListMCPClientVersionsInput, ListMCPClientVersionsOutput, MCPClientVersion } from '@mastra/core/storage/domains/mcp-clients';
|
|
4
|
+
import type { SpannerDomainConfig } from '../../db/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Spanner-backed storage for MCP-client definitions and their immutable versions.
|
|
7
|
+
* Mirrors the thin-record + versions pattern used by agents/skills/prompt-blocks.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MCPClientsSpanner extends MCPClientsStorage {
|
|
10
|
+
private database;
|
|
11
|
+
private db;
|
|
12
|
+
private readonly skipDefaultIndexes?;
|
|
13
|
+
private readonly indexes?;
|
|
14
|
+
static readonly MANAGED_TABLES: readonly ["mastra_mcp_clients", "mastra_mcp_client_versions"];
|
|
15
|
+
constructor(config: SpannerDomainConfig);
|
|
16
|
+
/** Creates the MCP-client tables, indexes, and (when opted in) sweeps stale drafts. */
|
|
17
|
+
init(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Sweeps orphaned draft thin-rows whose paired version row was never written.
|
|
20
|
+
* Skipped under `initMode: 'validate'` (no destructive DML in validate mode).
|
|
21
|
+
*/
|
|
22
|
+
private cleanupStaleDrafts;
|
|
23
|
+
/** Returns the default index set this domain creates during `init()`. */
|
|
24
|
+
getDefaultIndexDefinitions(): CreateIndexOptions[];
|
|
25
|
+
/** Creates the default indexes; no-op when `skipDefaultIndexes` was set. */
|
|
26
|
+
createDefaultIndexes(): Promise<void>;
|
|
27
|
+
/** Creates custom indexes routed to this domain's tables; no-op when none supplied. */
|
|
28
|
+
createCustomIndexes(): Promise<void>;
|
|
29
|
+
/** Removes every row from this domain's tables. Intended for tests. */
|
|
30
|
+
dangerouslyClearAll(): Promise<void>;
|
|
31
|
+
/** Decodes a raw Spanner thin-row into the public MCP-client shape. */
|
|
32
|
+
private parseClientRow;
|
|
33
|
+
/** Decodes a raw Spanner version row into the public version shape. */
|
|
34
|
+
private parseVersionRow;
|
|
35
|
+
/** Fetches the thin MCP-client record by id, or `null` when absent. */
|
|
36
|
+
getById(id: string): Promise<StorageMCPClientType | null>;
|
|
37
|
+
/** Atomically inserts a draft thin row + version 1 in a single Spanner transaction. */
|
|
38
|
+
create(input: {
|
|
39
|
+
mcpClient: StorageCreateMCPClientInput;
|
|
40
|
+
}): Promise<StorageMCPClientType>;
|
|
41
|
+
/** Updates thin-record fields (status, activeVersionId, authorId, metadata). */
|
|
42
|
+
update(input: StorageUpdateMCPClientInput): Promise<StorageMCPClientType>;
|
|
43
|
+
/** Removes an MCP client and all its versions atomically in a single transaction. */
|
|
44
|
+
delete(id: string): Promise<void>;
|
|
45
|
+
/** Paginated listing; defaults to `status='published'` so drafts never leak. */
|
|
46
|
+
list(args?: StorageListMCPClientsInput): Promise<StorageListMCPClientsOutput>;
|
|
47
|
+
/** Inserts a new immutable version row for an existing MCP client. */
|
|
48
|
+
createVersion(input: CreateMCPClientVersionInput): Promise<MCPClientVersion>;
|
|
49
|
+
/** Fetches a version row by its id, or `null` when absent. */
|
|
50
|
+
getVersion(id: string): Promise<MCPClientVersion | null>;
|
|
51
|
+
/** Fetches a specific version by `(mcpClientId, versionNumber)`. */
|
|
52
|
+
getVersionByNumber(mcpClientId: string, versionNumber: number): Promise<MCPClientVersion | null>;
|
|
53
|
+
/** Returns the highest-numbered version for an MCP client. */
|
|
54
|
+
getLatestVersion(mcpClientId: string): Promise<MCPClientVersion | null>;
|
|
55
|
+
/** Paginated listing of versions for a single MCP client. */
|
|
56
|
+
listVersions(input: ListMCPClientVersionsInput): Promise<ListMCPClientVersionsOutput>;
|
|
57
|
+
/** Deletes a single version row by id. */
|
|
58
|
+
deleteVersion(id: string): Promise<void>;
|
|
59
|
+
/** Deletes every version row belonging to the given MCP client. */
|
|
60
|
+
deleteVersionsByParentId(entityId: string): Promise<void>;
|
|
61
|
+
/** Returns the total number of version rows for the given MCP client. */
|
|
62
|
+
countVersions(mcpClientId: string): Promise<number>;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/mcp-clients/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,EAMlB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KA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vC,gFAAgF;IAC1E,IAAI,CAAC,IAAI,CAAC,EAAE,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA6FnF,sEAAsE;IAChE,aAAa,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAgClF,8DAA8D;IACxD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAuB9D,oEAAoE;IAC9D,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IA0BtG,8DAA8D;IACxD,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IA0B7E,6DAA6D;IACvD,YAAY,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,2BAA2B,CAAC;IA8D3F,0CAA0C;IACpC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB9C,mEAAmE;IAC7D,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB/D,yEAAyE;IACnE,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAqB1D"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { MCPServersStorage } from '@mastra/core/storage';
|
|
2
|
+
import type { CreateIndexOptions, StorageMCPServerType, StorageCreateMCPServerInput, StorageListMCPServersInput, StorageListMCPServersOutput, StorageUpdateMCPServerInput } from '@mastra/core/storage';
|
|
3
|
+
import type { CreateMCPServerVersionInput, ListMCPServerVersionsInput, ListMCPServerVersionsOutput, MCPServerVersion } from '@mastra/core/storage/domains/mcp-servers';
|
|
4
|
+
import type { SpannerDomainConfig } from '../../db/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Spanner-backed storage for MCP-server definitions and their immutable versions.
|
|
7
|
+
* Mirrors the thin-record + versions pattern used by agents/skills/prompt-blocks.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MCPServersSpanner extends MCPServersStorage {
|
|
10
|
+
private database;
|
|
11
|
+
private db;
|
|
12
|
+
private readonly skipDefaultIndexes?;
|
|
13
|
+
private readonly indexes?;
|
|
14
|
+
static readonly MANAGED_TABLES: readonly ["mastra_mcp_servers", "mastra_mcp_server_versions"];
|
|
15
|
+
constructor(config: SpannerDomainConfig);
|
|
16
|
+
/** Creates the MCP-server tables, indexes, and (when opted in) sweeps stale drafts. */
|
|
17
|
+
init(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Sweeps orphaned draft thin-rows whose paired version row was never written.
|
|
20
|
+
* Skipped under `initMode: 'validate'` (no destructive DML in validate mode).
|
|
21
|
+
*/
|
|
22
|
+
private cleanupStaleDrafts;
|
|
23
|
+
/** Returns the default index set this domain creates during `init()`. */
|
|
24
|
+
getDefaultIndexDefinitions(): CreateIndexOptions[];
|
|
25
|
+
/** Creates the default indexes; no-op when `skipDefaultIndexes` was set. */
|
|
26
|
+
createDefaultIndexes(): Promise<void>;
|
|
27
|
+
/** Creates custom indexes routed to this domain's tables; no-op when none supplied. */
|
|
28
|
+
createCustomIndexes(): Promise<void>;
|
|
29
|
+
/** Removes every row from this domain's tables. Intended for tests. */
|
|
30
|
+
dangerouslyClearAll(): Promise<void>;
|
|
31
|
+
/** Decodes a raw Spanner thin-row into the public MCP-server shape. */
|
|
32
|
+
private parseServerRow;
|
|
33
|
+
/** Decodes a raw Spanner version row into the public version shape. */
|
|
34
|
+
private parseVersionRow;
|
|
35
|
+
/** Fetches the thin MCP-server record by id, or `null` when absent. */
|
|
36
|
+
getById(id: string): Promise<StorageMCPServerType | null>;
|
|
37
|
+
/** Atomically inserts a draft thin row + version 1 in a single Spanner transaction. */
|
|
38
|
+
create(input: {
|
|
39
|
+
mcpServer: StorageCreateMCPServerInput;
|
|
40
|
+
}): Promise<StorageMCPServerType>;
|
|
41
|
+
/** Updates thin-record fields (status, activeVersionId, authorId, metadata). */
|
|
42
|
+
update(input: StorageUpdateMCPServerInput): Promise<StorageMCPServerType>;
|
|
43
|
+
/** Removes an MCP server and all its versions atomically in a single transaction. */
|
|
44
|
+
delete(id: string): Promise<void>;
|
|
45
|
+
/** Paginated listing; defaults to `status='published'` so drafts never leak. */
|
|
46
|
+
list(args?: StorageListMCPServersInput): Promise<StorageListMCPServersOutput>;
|
|
47
|
+
/** Inserts a new immutable version row for an existing MCP server. */
|
|
48
|
+
createVersion(input: CreateMCPServerVersionInput): Promise<MCPServerVersion>;
|
|
49
|
+
/** Fetches a version row by its id, or `null` when absent. */
|
|
50
|
+
getVersion(id: string): Promise<MCPServerVersion | null>;
|
|
51
|
+
/** Fetches a specific version by `(mcpServerId, versionNumber)`. */
|
|
52
|
+
getVersionByNumber(mcpServerId: string, versionNumber: number): Promise<MCPServerVersion | null>;
|
|
53
|
+
/** Returns the highest-numbered version for an MCP server. */
|
|
54
|
+
getLatestVersion(mcpServerId: string): Promise<MCPServerVersion | null>;
|
|
55
|
+
/** Paginated listing of versions for a single MCP server. */
|
|
56
|
+
listVersions(input: ListMCPServerVersionsInput): Promise<ListMCPServerVersionsOutput>;
|
|
57
|
+
/** Deletes a single version row by id. */
|
|
58
|
+
deleteVersion(id: string): Promise<void>;
|
|
59
|
+
/** Deletes every version row belonging to the given MCP server. */
|
|
60
|
+
deleteVersionsByParentId(entityId: string): Promise<void>;
|
|
61
|
+
/** Returns the total number of version rows for the given MCP server. */
|
|
62
|
+
countVersions(mcpServerId: string): Promise<number>;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=index.d.ts.map
|