@mastra/spanner 1.6.4-alpha.1 → 1.6.4-alpha.2
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/README.md +7 -79
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @mastra/spanner
|
|
2
2
|
|
|
3
|
-
Google Cloud Spanner
|
|
3
|
+
Persist Mastra data in Google Cloud Spanner with strong consistency, GoogleSQL schemas, emulator support, initialization, and direct database access.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -8,12 +8,6 @@ Google Cloud Spanner storage adapter for Mastra. Implements the GoogleSQL dialec
|
|
|
8
8
|
npm install @mastra/spanner
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## Prerequisites
|
|
12
|
-
|
|
13
|
-
- A Cloud Spanner instance and database created with the GoogleSQL dialect.
|
|
14
|
-
- Application credentials available to the Node.js client (Application Default Credentials, service account JSON, or `GOOGLE_APPLICATION_CREDENTIALS`).
|
|
15
|
-
- For local development, the [Spanner emulator](https://cloud.google.com/spanner/docs/emulator) running on `localhost:9010`.
|
|
16
|
-
|
|
17
11
|
## Usage
|
|
18
12
|
|
|
19
13
|
### Connecting to a managed Cloud Spanner database
|
|
@@ -29,80 +23,14 @@ const store = new SpannerStore({
|
|
|
29
23
|
});
|
|
30
24
|
```
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
```typescript
|
|
35
|
-
process.env.SPANNER_EMULATOR_HOST = 'localhost:9010';
|
|
36
|
-
|
|
37
|
-
const store = new SpannerStore({
|
|
38
|
-
id: 'spanner-storage',
|
|
39
|
-
projectId: 'test-project',
|
|
40
|
-
instanceId: 'test-instance',
|
|
41
|
-
databaseId: 'test-db',
|
|
42
|
-
// Skip auth checks when talking to the emulator
|
|
43
|
-
spannerOptions: { servicePath: 'localhost', port: 9010, sslCreds: undefined },
|
|
44
|
-
});
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
The store automatically detects the `SPANNER_EMULATOR_HOST` env var and uses
|
|
48
|
-
unauthenticated channels when set. You can also create the instance/database
|
|
49
|
-
through the emulator using the standard `gcloud` CLI.
|
|
50
|
-
|
|
51
|
-
### Pre-configured client or database
|
|
52
|
-
|
|
53
|
-
If you already manage a Spanner client elsewhere, pass the database directly:
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
import { Spanner } from '@google-cloud/spanner';
|
|
57
|
-
import { SpannerStore } from '@mastra/spanner';
|
|
58
|
-
|
|
59
|
-
const spanner = new Spanner({ projectId: 'my-project' });
|
|
60
|
-
const database = spanner.instance('my-instance').database('mastra');
|
|
61
|
-
|
|
62
|
-
const store = new SpannerStore({
|
|
63
|
-
id: 'spanner-storage',
|
|
64
|
-
database,
|
|
65
|
-
});
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Notes on the GoogleSQL dialect
|
|
69
|
-
|
|
70
|
-
- Tables are created with the GoogleSQL dialect using `STRING(MAX)` for text/JSON
|
|
71
|
-
payloads, `INT64`, `FLOAT64`, `BOOL` and `TIMESTAMP`.
|
|
72
|
-
- DDL is applied through `database.updateSchema(...)` (long-running operation).
|
|
73
|
-
- Upserts use `INSERT OR UPDATE`. Deletes use `DELETE WHERE TRUE` (Spanner has no
|
|
74
|
-
`TRUNCATE`).
|
|
75
|
-
- Identifiers are quoted with backticks.
|
|
76
|
-
- The adapter does not use named schemas. Use a dedicated database for isolation.
|
|
26
|
+
## Documentation
|
|
77
27
|
|
|
78
|
-
|
|
28
|
+
- [Google Cloud Spanner](https://mastra.ai/integrations/databases/spanner)
|
|
79
29
|
|
|
80
|
-
|
|
30
|
+
## Changelog
|
|
81
31
|
|
|
82
|
-
-
|
|
83
|
-
- `workflows`: workflow snapshots and run state
|
|
84
|
-
- `scores`: evaluation scores
|
|
85
|
-
- `backgroundTasks`: background tool execution state
|
|
86
|
-
- `agents`: thin agent records and versioned config snapshots
|
|
87
|
-
- `mcpClients`: MCP client configurations with version history
|
|
88
|
-
- `mcpServers`: MCP server configurations with version history
|
|
89
|
-
- `skills`: skill records and versioned skill snapshots
|
|
90
|
-
- `blobs`: content-addressable blob store (used by the skills domain)
|
|
91
|
-
- `promptBlocks`: prompt block records and versioned template/rules snapshots
|
|
92
|
-
- `scorerDefinitions`: scorer definition records and versioned scoring-config snapshots
|
|
93
|
-
- `schedules`: cron-driven workflow schedules and trigger history (consumed by `WorkflowScheduler`)
|
|
94
|
-
- `observability`: AI tracing spans (per-trace and per-span records) used by the Studio traces UI
|
|
32
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/stores/spanner/CHANGELOG.md) for version history and release notes.
|
|
95
33
|
|
|
96
|
-
##
|
|
34
|
+
## Support
|
|
97
35
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
docker compose up -d
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Then run the tests:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
ENABLE_TESTS=true pnpm test
|
|
108
|
-
```
|
|
36
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -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.6.4-alpha.
|
|
6
|
+
version: "1.6.4-alpha.2"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/spanner",
|
|
3
|
-
"version": "1.6.4-alpha.
|
|
3
|
+
"version": "1.6.4-alpha.2",
|
|
4
4
|
"description": "Google Cloud Spanner provider for Mastra - db storage capabilities (GoogleSQL dialect)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"typescript": "^7.0.2",
|
|
33
33
|
"vitest": "4.1.10",
|
|
34
34
|
"@internal/lint": "0.0.129",
|
|
35
|
-
"@mastra/core": "1.64.0-alpha.5",
|
|
36
35
|
"@internal/storage-test-utils": "0.0.125",
|
|
37
|
-
"@internal/types-builder": "0.0.104"
|
|
36
|
+
"@internal/types-builder": "0.0.104",
|
|
37
|
+
"@mastra/core": "1.64.0-alpha.7"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@mastra/core": ">=1.61.0-0 <2.0.0-0"
|