synor/sdk/shared/schemas/database.json
Gulshan Yadav 59a7123535 feat(sdk): implement Phase 1 SDKs for Wallet, RPC, and Storage
Implements comprehensive SDK support for three core services across
four programming languages (JavaScript/TypeScript, Python, Go, Rust).

## New SDKs

### Wallet SDK
- Key management (create, import, export)
- Transaction signing
- Message signing and verification
- Balance and UTXO queries
- Stealth address support

### RPC SDK
- Block and transaction queries
- Chain state information
- Fee estimation
- Mempool information
- WebSocket subscriptions for real-time updates

### Storage SDK
- Content upload and download
- Pinning operations
- CAR file support
- Directory management
- Gateway URL generation

## Shared Infrastructure

- JSON Schema definitions for all 11 services
- Common type definitions (Address, Amount, UTXO, etc.)
- Unified error handling patterns
- Builder patterns for configuration

## Package Updates

- JavaScript: Updated to @synor/sdk with module exports
- Python: Updated to synor-sdk with websockets dependency
- Go: Added gorilla/websocket dependency
- Rust: Added base64, urlencoding, multipart support

## Fixes

- Fixed Tensor Default trait implementation
- Fixed ProcessorType enum casing
2026-01-27 00:46:24 +05:30

275 lines
7.1 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://synor.io/schemas/database.json",
"title": "Synor Database SDK",
"description": "Key-value, document, vector, and time-series database operations",
"$defs": {
"DatabaseConfig": {
"type": "object",
"allOf": [{ "$ref": "common.json#/$defs/SynorConfig" }],
"properties": {
"namespace": {
"type": "string",
"description": "Database namespace for isolation"
}
}
},
"Value": {
"oneOf": [
{ "type": "string" },
{ "type": "number" },
{ "type": "boolean" },
{ "type": "object" },
{ "type": "array" },
{ "type": "null" }
]
},
"KeyValue": {
"type": "object",
"properties": {
"key": { "type": "string" },
"value": { "$ref": "#/$defs/Value" },
"ttl": { "$ref": "common.json#/$defs/Duration" },
"createdAt": { "$ref": "common.json#/$defs/Timestamp" },
"updatedAt": { "$ref": "common.json#/$defs/Timestamp" }
},
"required": ["key", "value"]
},
"KvGetRequest": {
"type": "object",
"properties": {
"key": { "type": "string" }
},
"required": ["key"]
},
"KvSetRequest": {
"type": "object",
"properties": {
"key": { "type": "string" },
"value": { "$ref": "#/$defs/Value" },
"ttl": { "$ref": "common.json#/$defs/Duration" },
"nx": { "type": "boolean", "description": "Only set if key does not exist" },
"xx": { "type": "boolean", "description": "Only set if key exists" }
},
"required": ["key", "value"]
},
"KvListRequest": {
"type": "object",
"properties": {
"prefix": { "type": "string" },
"cursor": { "type": "string" },
"limit": { "type": "integer", "minimum": 1, "maximum": 1000, "default": 100 }
},
"required": ["prefix"]
},
"Document": {
"type": "object",
"properties": {
"_id": { "type": "string" },
"_rev": { "type": "string" },
"_createdAt": { "$ref": "common.json#/$defs/Timestamp" },
"_updatedAt": { "$ref": "common.json#/$defs/Timestamp" }
},
"additionalProperties": true,
"required": ["_id"]
},
"DocumentQuery": {
"type": "object",
"properties": {
"filter": { "type": "object" },
"sort": {
"type": "array",
"items": {
"type": "object",
"properties": {
"field": { "type": "string" },
"order": { "type": "string", "enum": ["asc", "desc"] }
}
}
},
"projection": {
"type": "array",
"items": { "type": "string" }
}
},
"allOf": [{ "$ref": "common.json#/$defs/PaginationParams" }]
},
"DocCreateRequest": {
"type": "object",
"properties": {
"collection": { "type": "string" },
"document": { "type": "object" }
},
"required": ["collection", "document"]
},
"DocGetRequest": {
"type": "object",
"properties": {
"collection": { "type": "string" },
"id": { "type": "string" }
},
"required": ["collection", "id"]
},
"DocUpdateRequest": {
"type": "object",
"properties": {
"collection": { "type": "string" },
"id": { "type": "string" },
"update": { "type": "object" },
"upsert": { "type": "boolean", "default": false }
},
"required": ["collection", "id", "update"]
},
"DocQueryRequest": {
"type": "object",
"properties": {
"collection": { "type": "string" },
"query": { "$ref": "#/$defs/DocumentQuery" }
},
"required": ["collection", "query"]
},
"VectorEntry": {
"type": "object",
"properties": {
"id": { "type": "string" },
"vector": {
"type": "array",
"items": { "type": "number" }
},
"metadata": { "type": "object" }
},
"required": ["id", "vector"]
},
"VectorUpsertRequest": {
"type": "object",
"properties": {
"collection": { "type": "string" },
"vectors": {
"type": "array",
"items": { "$ref": "#/$defs/VectorEntry" }
}
},
"required": ["collection", "vectors"]
},
"VectorSearchRequest": {
"type": "object",
"properties": {
"collection": { "type": "string" },
"vector": {
"type": "array",
"items": { "type": "number" }
},
"k": { "type": "integer", "minimum": 1, "maximum": 100, "default": 10 },
"filter": { "type": "object" },
"includeMetadata": { "type": "boolean", "default": true },
"includeVectors": { "type": "boolean", "default": false }
},
"required": ["collection", "vector"]
},
"VectorSearchResult": {
"type": "object",
"properties": {
"id": { "type": "string" },
"score": { "type": "number" },
"vector": {
"type": "array",
"items": { "type": "number" }
},
"metadata": { "type": "object" }
},
"required": ["id", "score"]
},
"DataPoint": {
"type": "object",
"properties": {
"timestamp": { "$ref": "common.json#/$defs/Timestamp" },
"value": { "type": "number" },
"tags": {
"type": "object",
"additionalProperties": { "type": "string" }
}
},
"required": ["timestamp", "value"]
},
"TimeRange": {
"type": "object",
"properties": {
"start": { "$ref": "common.json#/$defs/Timestamp" },
"end": { "$ref": "common.json#/$defs/Timestamp" }
},
"required": ["start", "end"]
},
"Aggregation": {
"type": "object",
"properties": {
"function": {
"type": "string",
"enum": ["avg", "sum", "min", "max", "count", "first", "last", "stddev"]
},
"interval": { "$ref": "common.json#/$defs/Duration" },
"groupBy": {
"type": "array",
"items": { "type": "string" }
}
},
"required": ["function"]
},
"TsWriteRequest": {
"type": "object",
"properties": {
"series": { "type": "string" },
"points": {
"type": "array",
"items": { "$ref": "#/$defs/DataPoint" }
}
},
"required": ["series", "points"]
},
"TsQueryRequest": {
"type": "object",
"properties": {
"series": { "type": "string" },
"range": { "$ref": "#/$defs/TimeRange" },
"aggregation": { "$ref": "#/$defs/Aggregation" },
"filter": {
"type": "object",
"additionalProperties": { "type": "string" }
}
},
"required": ["series", "range"]
},
"TsQueryResponse": {
"type": "object",
"properties": {
"series": { "type": "string" },
"points": {
"type": "array",
"items": { "$ref": "#/$defs/DataPoint" }
}
},
"required": ["series", "points"]
}
}
}