@synapcores/sdk 0.3.0 → 0.4.1
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 +47 -0
- package/README.md +10 -0
- package/dist/index.d.mts +161 -2
- package/dist/index.d.ts +161 -2
- package/dist/index.js +203 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +202 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,53 @@
|
|
|
3
3
|
All notable changes to `@synapcores/sdk` are documented here.
|
|
4
4
|
This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
5
|
|
|
6
|
+
## 0.4.0 — 2026-05-18 — vector-subsystem + auth alignment with v1.6.5.2-ce gateway
|
|
7
|
+
|
|
8
|
+
Closes three wire-format gaps surfaced during the OpenClaw v0.1.0 integration.
|
|
9
|
+
Validation against `validate-nodejs-sdk-v04.ts` goes from **8/9** under 0.3.0
|
|
10
|
+
to **11/12** under 0.4.0 (#5 — Cypher `$param` — remains the documented
|
|
11
|
+
gateway-side blocker).
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- **Auth: `apiKey` now sends `Authorization: Bearer <key>` instead of
|
|
16
|
+
`X-API-Key`.** Gateway v1.6.5.2-ce only honours the `Authorization`
|
|
17
|
+
header for both JWTs and AIDB-issued API keys (`aidb_*` / `ak_*`);
|
|
18
|
+
the legacy `X-API-Key` shim was rejected with HTTP 401
|
|
19
|
+
`missing_authorization`, forcing callers to manually promote API keys
|
|
20
|
+
into `jwtToken`. The SDK now sends `Bearer` for every credential
|
|
21
|
+
type — `apiKey: 'aidb_...'` Just Works.
|
|
22
|
+
- **`Collection.vectorSearch` no longer crosses subsystems** (regression
|
|
23
|
+
guard for callers that relied on the 0.3.0 `client.collection(name)`
|
|
24
|
+
accessor with a vector collection: the search still hits the right
|
|
25
|
+
endpoint regardless of which accessor produced the handle).
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- **`client.createVectorCollection({name, dimensions, distance_metric})`** —
|
|
30
|
+
posts to `POST /v1/vectors/collections` with the gateway's expected
|
|
31
|
+
body shape. The legacy `createCollection({name, vector_size, ...})`
|
|
32
|
+
silently dropped `vector_size` and posted to the document-store
|
|
33
|
+
subsystem, leaving the collection invisible to vector search.
|
|
34
|
+
- **`client.vectorCollection(name)`** — synchronous typed handle for an
|
|
35
|
+
existing vector collection. Returns a `VectorCollection` wired to
|
|
36
|
+
`/v1/vectors/collections/{name}/...`, distinct from the document-store
|
|
37
|
+
`client.collection(name)` accessor.
|
|
38
|
+
- **`VectorCollection` class** (`src/vector_collection.ts`) — explicit
|
|
39
|
+
vector-subsystem API surface: `insert(records)`, `search({vector, k,
|
|
40
|
+
filter?, includeMetadata?})`, `get(id)`, `delete(id|ids)`, `count()`,
|
|
41
|
+
`info()`. Wire paths target `/v1/vectors/collections/{name}/vectors`
|
|
42
|
+
and `/search`; envelope unwrapping matches the rest of the 0.3.0 SDK.
|
|
43
|
+
- **`client.listVectorCollections()`** and
|
|
44
|
+
**`client.deleteVectorCollection(name)`** — sibling helpers for the
|
|
45
|
+
vector subsystem.
|
|
46
|
+
- **`tests/live-smoke-v04.test.ts`** — gated on `AIDB_LIVE_TEST=1`,
|
|
47
|
+
runs the 12-test v0.4.0 validation suite against a live gateway.
|
|
48
|
+
|
|
49
|
+
### Documentation
|
|
50
|
+
|
|
51
|
+
- README now lists v1.6.5.2-ce as the verified-against gateway version.
|
|
52
|
+
|
|
6
53
|
## 0.3.0 — 2026-05-18
|
|
7
54
|
|
|
8
55
|
Wire-alignment release for the v1.6.5.1-ce gateway. Brings the SDK back into sync
|
package/README.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
Official Node.js/TypeScript SDK for SynapCores AI-Native Database Management System - A SQL 2026-compliant database with native tenant isolation, AI/ML functions, and multimedia support.
|
|
4
4
|
|
|
5
|
+
> **0.4.0 — vector-subsystem + auth alignment with gateway v1.6.5.2-ce.**
|
|
6
|
+
> Closes three wire-format gaps the OpenClaw v0.1.0 integration hit:
|
|
7
|
+
> (a) `apiKey: 'aidb_...'` now sends `Authorization: Bearer` instead of the
|
|
8
|
+
> rejected `X-API-Key` header; (b) `client.createVectorCollection({name,
|
|
9
|
+
> dimensions, distance_metric})` provisions on the **vector subsystem**
|
|
10
|
+
> (not the document-store one); (c) the new
|
|
11
|
+
> `client.vectorCollection(name).insert(...)` / `.search(...)` round-trip
|
|
12
|
+
> hits `/v1/vectors/collections/{name}/...` end-to-end. See CHANGELOG.md.
|
|
13
|
+
> Verified against gateway v1.6.5.2-ce. Validation: 11/12 PASS.
|
|
14
|
+
|
|
5
15
|
> **0.2.0 — gateway v1.5.0-ce alignment.** This release rewires every
|
|
6
16
|
> module against the v1.5.0-ce route surface: AutoML moved from `/ai/*`
|
|
7
17
|
> to `/automl/*`, vector ops collapsed onto `/vector-algebra/operation`,
|
package/dist/index.d.mts
CHANGED
|
@@ -151,6 +151,124 @@ declare class Collection {
|
|
|
151
151
|
subscribe(options?: SubscriptionOptions): Promise<Subscription>;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* VectorCollection — thin wrapper around the gateway's
|
|
156
|
+
* `/v1/vectors/collections/{name}/...` API.
|
|
157
|
+
*
|
|
158
|
+
* v0.4.0: introduced so users have an explicit, typed handle for the
|
|
159
|
+
* **vector subsystem** (separate from `/v1/collections/{name}`, the
|
|
160
|
+
* document-store world that `Collection` wraps). Mirror of the Python
|
|
161
|
+
* SDK's `synapcores.vector_collection.VectorCollection`.
|
|
162
|
+
*
|
|
163
|
+
* Get one via `client.vectorCollection(name)` for an existing collection,
|
|
164
|
+
* or `client.createVectorCollection({name, dimensions, distance_metric})`
|
|
165
|
+
* to provision a new one.
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
type VectorDistanceMetric = 'cosine' | 'l2' | 'dot' | 'euclidean' | 'dot_product';
|
|
169
|
+
/** Wire shape of a single vector going into the gateway. */
|
|
170
|
+
interface VectorRecord {
|
|
171
|
+
id: string;
|
|
172
|
+
/** Embedding values. Length must match the collection's `dimensions`. */
|
|
173
|
+
values: number[];
|
|
174
|
+
/** Optional per-vector metadata returned on search hits. */
|
|
175
|
+
metadata?: Record<string, any>;
|
|
176
|
+
}
|
|
177
|
+
/** Options for `VectorCollection.search()`. */
|
|
178
|
+
interface VectorCollectionSearchOptions {
|
|
179
|
+
vector: number[];
|
|
180
|
+
/** Number of nearest neighbours. */
|
|
181
|
+
k?: number;
|
|
182
|
+
/** Alias for `k` (parity with the document-store API). */
|
|
183
|
+
topK?: number;
|
|
184
|
+
/** Optional metadata filter forwarded as `filter` on the wire. */
|
|
185
|
+
filter?: Record<string, any>;
|
|
186
|
+
/** Whether the gateway should include metadata in each hit (default: true). */
|
|
187
|
+
includeMetadata?: boolean;
|
|
188
|
+
}
|
|
189
|
+
/** One match returned from `VectorCollection.search()`. */
|
|
190
|
+
interface VectorHit {
|
|
191
|
+
id: string;
|
|
192
|
+
/** Cosine distance (lower = closer) for cosine metric; raw distance otherwise. */
|
|
193
|
+
score?: number;
|
|
194
|
+
distance?: number;
|
|
195
|
+
values?: number[];
|
|
196
|
+
metadata?: Record<string, any>;
|
|
197
|
+
[key: string]: any;
|
|
198
|
+
}
|
|
199
|
+
/** Shape returned by `VectorCollection.info()`. */
|
|
200
|
+
interface VectorCollectionInfo {
|
|
201
|
+
name: string;
|
|
202
|
+
dimensions: number;
|
|
203
|
+
vector_count?: number;
|
|
204
|
+
distance_metric?: string;
|
|
205
|
+
index_type?: string;
|
|
206
|
+
[key: string]: any;
|
|
207
|
+
}
|
|
208
|
+
/** Shape returned by `client.createVectorCollection()`. */
|
|
209
|
+
interface CreateVectorCollectionOptions {
|
|
210
|
+
name: string;
|
|
211
|
+
dimensions: number;
|
|
212
|
+
/** Distance metric. `cosine` is the gateway default. */
|
|
213
|
+
distance_metric?: VectorDistanceMetric;
|
|
214
|
+
}
|
|
215
|
+
declare class VectorCollection {
|
|
216
|
+
private readonly client;
|
|
217
|
+
readonly name: string;
|
|
218
|
+
constructor(client: SynapCores, name: string);
|
|
219
|
+
private get basePath();
|
|
220
|
+
/**
|
|
221
|
+
* Insert one or more vectors.
|
|
222
|
+
*
|
|
223
|
+
* Wire: `POST /v1/vectors/collections/{name}/vectors` with
|
|
224
|
+
* `{ vectors: [{ id, values, metadata }] }`.
|
|
225
|
+
*
|
|
226
|
+
* Accepts either a single record or an array — the SDK always sends
|
|
227
|
+
* the wrapped `{ vectors: [...] }` envelope the gateway expects.
|
|
228
|
+
*/
|
|
229
|
+
insert(records: VectorRecord | VectorRecord[]): Promise<any>;
|
|
230
|
+
/**
|
|
231
|
+
* k-NN search over the vector collection.
|
|
232
|
+
*
|
|
233
|
+
* Wire: `POST /v1/vectors/collections/{name}/search` with
|
|
234
|
+
* `{ vector, k, include_metadata, filter? }`.
|
|
235
|
+
*
|
|
236
|
+
* Returns the bare array of hits — gateway envelope (`{data: [...]}`) is
|
|
237
|
+
* unwrapped automatically for parity with `Collection.vectorSearch`.
|
|
238
|
+
*/
|
|
239
|
+
search(options: VectorCollectionSearchOptions): Promise<VectorHit[]>;
|
|
240
|
+
/**
|
|
241
|
+
* Fetch a single vector by id.
|
|
242
|
+
*
|
|
243
|
+
* Wire: `GET /v1/vectors/collections/{name}/vectors/{id}`. Returns the
|
|
244
|
+
* gateway payload `{ id, values, metadata }` (envelope unwrapped) or
|
|
245
|
+
* `null` on 404.
|
|
246
|
+
*/
|
|
247
|
+
get(id: string): Promise<VectorHit | null>;
|
|
248
|
+
/**
|
|
249
|
+
* Delete one or more vectors by id.
|
|
250
|
+
*
|
|
251
|
+
* Single-id wire: `DELETE /v1/vectors/collections/{name}/vectors/{id}`.
|
|
252
|
+
* Bulk wire: `DELETE /v1/vectors/collections/{name}/vectors` with
|
|
253
|
+
* `{ ids: [...] }` body.
|
|
254
|
+
*/
|
|
255
|
+
delete(ids: string | string[]): Promise<any>;
|
|
256
|
+
/**
|
|
257
|
+
* Vector count.
|
|
258
|
+
*
|
|
259
|
+
* Wire: `GET /v1/vectors/collections/{name}/count` if the gateway
|
|
260
|
+
* exposes it, otherwise falls back to `info().vector_count`.
|
|
261
|
+
*/
|
|
262
|
+
count(): Promise<number>;
|
|
263
|
+
/**
|
|
264
|
+
* Collection metadata.
|
|
265
|
+
*
|
|
266
|
+
* Wire: `GET /v1/vectors/collections/{name}` returning
|
|
267
|
+
* `{ name, dimensions, vector_count, distance_metric, index_type }`.
|
|
268
|
+
*/
|
|
269
|
+
info(): Promise<VectorCollectionInfo>;
|
|
270
|
+
}
|
|
271
|
+
|
|
154
272
|
/**
|
|
155
273
|
* Type definitions for AutoML
|
|
156
274
|
*/
|
|
@@ -1791,6 +1909,8 @@ declare class GraphEdgeApi {
|
|
|
1791
1909
|
private readonly synapCores;
|
|
1792
1910
|
constructor(synapCores: SynapCores);
|
|
1793
1911
|
create(from: string, to: string, type: string, props?: Record<string, any>): Promise<GraphEdge>;
|
|
1912
|
+
/** Delete an edge by id. Mirrors `graph.nodes.delete`. */
|
|
1913
|
+
delete(id: string): Promise<void>;
|
|
1794
1914
|
}
|
|
1795
1915
|
declare class GraphIndexesApi {
|
|
1796
1916
|
private readonly synapCores;
|
|
@@ -2954,6 +3074,45 @@ declare class SynapCores {
|
|
|
2954
3074
|
}): Promise<ListCollectionsResponse>;
|
|
2955
3075
|
getDocuments(collectionName: string, page: number, pageSize: number): Promise<Document[]>;
|
|
2956
3076
|
deleteCollection(name: string): Promise<void>;
|
|
3077
|
+
private readonly vectorCollectionsCache;
|
|
3078
|
+
/**
|
|
3079
|
+
* Create a vector collection.
|
|
3080
|
+
*
|
|
3081
|
+
* Wire: `POST /v1/vectors/collections` with
|
|
3082
|
+
* `{ name, dimensions, distance_metric }`. Distinct from
|
|
3083
|
+
* `createCollection`, which targets the document-store subsystem.
|
|
3084
|
+
*
|
|
3085
|
+
* @example
|
|
3086
|
+
* const coll = await client.createVectorCollection({
|
|
3087
|
+
* name: 'memory_v1', dimensions: 1536, distance_metric: 'cosine',
|
|
3088
|
+
* });
|
|
3089
|
+
* await coll.insert({ id: 'v1', values: [...], metadata: { ... } });
|
|
3090
|
+
*/
|
|
3091
|
+
createVectorCollection(options: CreateVectorCollectionOptions): Promise<VectorCollection>;
|
|
3092
|
+
/**
|
|
3093
|
+
* Synchronous accessor for an existing vector collection. Does not
|
|
3094
|
+
* round-trip to the gateway — use `createVectorCollection` if you
|
|
3095
|
+
* need to provision the collection first, or `listVectorCollections`
|
|
3096
|
+
* to confirm existence.
|
|
3097
|
+
*
|
|
3098
|
+
* v0.4.0 split: this targets the **vector subsystem**
|
|
3099
|
+
* (`/v1/vectors/collections/{name}`). `client.collection(name)` still
|
|
3100
|
+
* returns a document-store `Collection` for the legacy subsystem.
|
|
3101
|
+
*/
|
|
3102
|
+
vectorCollection(name: string): VectorCollection;
|
|
3103
|
+
/**
|
|
3104
|
+
* List vector collections.
|
|
3105
|
+
*
|
|
3106
|
+
* Wire: `GET /v1/vectors/collections`. Returns the bare array of
|
|
3107
|
+
* collection-info objects (envelope unwrapped).
|
|
3108
|
+
*/
|
|
3109
|
+
listVectorCollections(): Promise<VectorCollectionInfo[]>;
|
|
3110
|
+
/**
|
|
3111
|
+
* Delete a vector collection.
|
|
3112
|
+
*
|
|
3113
|
+
* Wire: `DELETE /v1/vectors/collections/{name}`.
|
|
3114
|
+
*/
|
|
3115
|
+
deleteVectorCollection(name: string): Promise<void>;
|
|
2957
3116
|
/**
|
|
2958
3117
|
* Execute SQL query (legacy method for backward compatibility)
|
|
2959
3118
|
* @deprecated Use executeQuery for new code
|
|
@@ -3317,6 +3476,6 @@ declare class BatchOperationError extends SynapCoresError {
|
|
|
3317
3476
|
* Official SDK for SynapCores AI-Native Database Management System.
|
|
3318
3477
|
*/
|
|
3319
3478
|
|
|
3320
|
-
declare const VERSION = "0.
|
|
3479
|
+
declare const VERSION = "0.4.0";
|
|
3321
3480
|
|
|
3322
|
-
export { type APIKeyInfo, type APIKeyStats, type AlterTableOptions, type AnalyzeOptions, type AsyncTrainOptions, type AuthConfig, AuthenticationError, AutoMLClient, AutoMLModel, type Backup, BackupClient, type BackupMetrics, type BackupOptions, type BackupSchedule, type BackupStatus, type BackupVerificationResult, type BatchDeleteOptions, type BatchInsertOptions, BatchOperationError, type BatchQueryRequest, type BatchQueryResponse, type BatchQueryResult, type BatchResult, type BatchUpdateOptions, type BeginTransactionOptions, type BulkImportOptions, type BulkImportResult, type CTEDefinition, type ChangeOperation, type ChatCacheStats, ChatClient, type ChatMessage, type ChatModelInfo, type ChatSession, type ChatStreamChunk, type ChatSuggestion, type ChatSuggestionsOptions, type ChatSystemPrompt, type ChatTool, Collection, type CollectionFieldDefinition, type CollectionIndexDefinition, type CollectionInfo, type CollectionSchema, type CollectionSchemaDefinition, type CollectionStats, type ColumnConstraint, type ColumnDefinition, type ColumnInfo, ConnectionError, type ConnectionPool, type ConstraintInfo, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateChatSessionOptions, type CreateCollectionRequest, type CreateCollectionResponse, type CreateFsCollectionOptions, type CreateIntegrationOptions, type CreateRecipeOptions, type CreateScheduleOptions, type CreateTableOptions, type CreateWebhookOptions, type CypherProfileResult, type CypherResult, type DataValidationOptions, type DataValidationResult, type Document, type EmbedOptions, type Entity, type EvaluationResult, type ExecuteIntegrationOptions, type ExecuteQueryRequest, type ExecuteRecipeOptions, type ExportJobStatus, type ExportOptions, type ExportResult, FilesystemCollectionsClient, type ForeignKeyReference, type FsCollection, type FsDocument, type FsProgressEvent, type GenerateRecipeOptions, type GeneratedRecipe, type GraphAlgorithmName, type GraphAlgorithmRequest, type GraphAlgorithmResult, GraphClient, type GraphEdge, type GraphExtractRequest, type GraphExtractResult, type GraphNode, type GraphSummary, type HybridSearchOptions, type ImportError, ImportExportClient, type ImportJobStatus, type ImportOptions, type ImportResult, type ValidationError$1 as ImportValidationError, type ValidationWarning as ImportValidationWarning, type IndexDefinition, type IndexInfo, type InsertResult, type Integration, IntegrationClient, type IntegrationConfig, type IntegrationEvent, type IntegrationExecutionResult, type IntegrationLog, type IntegrationStats, type IntegrationWebhook, type KNNSearchOptions, type ListAPIKeysResponse, type ListBackupsOptions, type ListCollectionsResponse, type ListIntegrationsOptions, type ListMultimediaResponse, type ListRecipesOptions, type ListTrainingJobsOptions, type LoginRequest, type LoginResponse, McpClient, type McpInfo, type McpRequest, type McpResponse, type ModelInfo, type MultimediaInfo, MultimodalClient, type MultimodalEmbedResult, type MultimodalInput, type MultimodalJoinOptions, type MultimodalJoinResult, type MultimodalSearchHit, type MultimodalSearchOptions, type MultimodalSimilarityOptions, type MultimodalSimilarityResult, NL2SqlClient, type NLPAnalysis, NLPClient, type Nl2SqlAskOptions, type Nl2SqlAskResult, type Nl2SqlHistoryEntry, type Nl2SqlSchemaContext, type Nl2SqlValidateResult, NotFoundError, type OAuth2Config, type PredictResult, type PreparedStatement, type PreparedStatementOptions, type QueryColumn, type QueryOptions, type QueryPerformance, type QueryResult, type RangeSearchOptions, RateLimitError, type Recipe, RecipeClient, type RecipeExecutionResult, type RecipeInfo, type RecipeParameter, type RefreshResponse, type RegisterRequest, type RegisterResponse, type RelationshipInfo, type RestoreOptions, type RestoreResult, type RestoreStatus, type RetryConfig, SQLError, SchemaClient, type SchemaStatistics, type ValidationError$2 as SchemaValidationError, type SearchOptions, type SearchResult, type SendChatOptions, type SendChatResult, type Sentiment, ServerError, type StorageConfig, Subscription, type SubscriptionEvent, type SubscriptionOptions, type SummarizeOptions, SynapCores, type SynapCoresConfig, SynapCoresError, SystemClient, type TableConstraint, type TableInfo, type TableSchema, type TestIntegrationOptions, type TestIntegrationResult, TimeoutError, type TrainOptions, type TrainingJob, type TrainingMetrics, type TransactionContext, TransactionError, type TransactionOptions, TransactionsClient, Tx, type TxHistoryEntry, type TxQueryResult, type UpdateOptions, type UploadMultimediaRequest, VERSION, ValidationError, type ValidationResult, type ValidationWarning$1 as ValidationWarning, type Vector, type VectorArithmeticResult, VectorError, type VectorSearchOptions, type VectorSearchResult, type VectorSimilarityResult, type VisionConfig, type VisionTestResult, type WindowFunctionOptions };
|
|
3481
|
+
export { type APIKeyInfo, type APIKeyStats, type AlterTableOptions, type AnalyzeOptions, type AsyncTrainOptions, type AuthConfig, AuthenticationError, AutoMLClient, AutoMLModel, type Backup, BackupClient, type BackupMetrics, type BackupOptions, type BackupSchedule, type BackupStatus, type BackupVerificationResult, type BatchDeleteOptions, type BatchInsertOptions, BatchOperationError, type BatchQueryRequest, type BatchQueryResponse, type BatchQueryResult, type BatchResult, type BatchUpdateOptions, type BeginTransactionOptions, type BulkImportOptions, type BulkImportResult, type CTEDefinition, type ChangeOperation, type ChatCacheStats, ChatClient, type ChatMessage, type ChatModelInfo, type ChatSession, type ChatStreamChunk, type ChatSuggestion, type ChatSuggestionsOptions, type ChatSystemPrompt, type ChatTool, Collection, type CollectionFieldDefinition, type CollectionIndexDefinition, type CollectionInfo, type CollectionSchema, type CollectionSchemaDefinition, type CollectionStats, type ColumnConstraint, type ColumnDefinition, type ColumnInfo, ConnectionError, type ConnectionPool, type ConstraintInfo, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateChatSessionOptions, type CreateCollectionRequest, type CreateCollectionResponse, type CreateFsCollectionOptions, type CreateIntegrationOptions, type CreateRecipeOptions, type CreateScheduleOptions, type CreateTableOptions, type CreateVectorCollectionOptions, type CreateWebhookOptions, type CypherProfileResult, type CypherResult, type DataValidationOptions, type DataValidationResult, type Document, type EmbedOptions, type Entity, type EvaluationResult, type ExecuteIntegrationOptions, type ExecuteQueryRequest, type ExecuteRecipeOptions, type ExportJobStatus, type ExportOptions, type ExportResult, FilesystemCollectionsClient, type ForeignKeyReference, type FsCollection, type FsDocument, type FsProgressEvent, type GenerateRecipeOptions, type GeneratedRecipe, type GraphAlgorithmName, type GraphAlgorithmRequest, type GraphAlgorithmResult, GraphClient, type GraphEdge, type GraphExtractRequest, type GraphExtractResult, type GraphNode, type GraphSummary, type HybridSearchOptions, type ImportError, ImportExportClient, type ImportJobStatus, type ImportOptions, type ImportResult, type ValidationError$1 as ImportValidationError, type ValidationWarning as ImportValidationWarning, type IndexDefinition, type IndexInfo, type InsertResult, type Integration, IntegrationClient, type IntegrationConfig, type IntegrationEvent, type IntegrationExecutionResult, type IntegrationLog, type IntegrationStats, type IntegrationWebhook, type KNNSearchOptions, type ListAPIKeysResponse, type ListBackupsOptions, type ListCollectionsResponse, type ListIntegrationsOptions, type ListMultimediaResponse, type ListRecipesOptions, type ListTrainingJobsOptions, type LoginRequest, type LoginResponse, McpClient, type McpInfo, type McpRequest, type McpResponse, type ModelInfo, type MultimediaInfo, MultimodalClient, type MultimodalEmbedResult, type MultimodalInput, type MultimodalJoinOptions, type MultimodalJoinResult, type MultimodalSearchHit, type MultimodalSearchOptions, type MultimodalSimilarityOptions, type MultimodalSimilarityResult, NL2SqlClient, type NLPAnalysis, NLPClient, type Nl2SqlAskOptions, type Nl2SqlAskResult, type Nl2SqlHistoryEntry, type Nl2SqlSchemaContext, type Nl2SqlValidateResult, NotFoundError, type OAuth2Config, type PredictResult, type PreparedStatement, type PreparedStatementOptions, type QueryColumn, type QueryOptions, type QueryPerformance, type QueryResult, type RangeSearchOptions, RateLimitError, type Recipe, RecipeClient, type RecipeExecutionResult, type RecipeInfo, type RecipeParameter, type RefreshResponse, type RegisterRequest, type RegisterResponse, type RelationshipInfo, type RestoreOptions, type RestoreResult, type RestoreStatus, type RetryConfig, SQLError, SchemaClient, type SchemaStatistics, type ValidationError$2 as SchemaValidationError, type SearchOptions, type SearchResult, type SendChatOptions, type SendChatResult, type Sentiment, ServerError, type StorageConfig, Subscription, type SubscriptionEvent, type SubscriptionOptions, type SummarizeOptions, SynapCores, type SynapCoresConfig, SynapCoresError, SystemClient, type TableConstraint, type TableInfo, type TableSchema, type TestIntegrationOptions, type TestIntegrationResult, TimeoutError, type TrainOptions, type TrainingJob, type TrainingMetrics, type TransactionContext, TransactionError, type TransactionOptions, TransactionsClient, Tx, type TxHistoryEntry, type TxQueryResult, type UpdateOptions, type UploadMultimediaRequest, VERSION, ValidationError, type ValidationResult, type ValidationWarning$1 as ValidationWarning, type Vector, type VectorArithmeticResult, VectorCollection, type VectorCollectionInfo, type VectorCollectionSearchOptions, type VectorDistanceMetric, VectorError, type VectorHit, type VectorRecord, type VectorSearchOptions, type VectorSearchResult, type VectorSimilarityResult, type VisionConfig, type VisionTestResult, type WindowFunctionOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -151,6 +151,124 @@ declare class Collection {
|
|
|
151
151
|
subscribe(options?: SubscriptionOptions): Promise<Subscription>;
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
+
/**
|
|
155
|
+
* VectorCollection — thin wrapper around the gateway's
|
|
156
|
+
* `/v1/vectors/collections/{name}/...` API.
|
|
157
|
+
*
|
|
158
|
+
* v0.4.0: introduced so users have an explicit, typed handle for the
|
|
159
|
+
* **vector subsystem** (separate from `/v1/collections/{name}`, the
|
|
160
|
+
* document-store world that `Collection` wraps). Mirror of the Python
|
|
161
|
+
* SDK's `synapcores.vector_collection.VectorCollection`.
|
|
162
|
+
*
|
|
163
|
+
* Get one via `client.vectorCollection(name)` for an existing collection,
|
|
164
|
+
* or `client.createVectorCollection({name, dimensions, distance_metric})`
|
|
165
|
+
* to provision a new one.
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
type VectorDistanceMetric = 'cosine' | 'l2' | 'dot' | 'euclidean' | 'dot_product';
|
|
169
|
+
/** Wire shape of a single vector going into the gateway. */
|
|
170
|
+
interface VectorRecord {
|
|
171
|
+
id: string;
|
|
172
|
+
/** Embedding values. Length must match the collection's `dimensions`. */
|
|
173
|
+
values: number[];
|
|
174
|
+
/** Optional per-vector metadata returned on search hits. */
|
|
175
|
+
metadata?: Record<string, any>;
|
|
176
|
+
}
|
|
177
|
+
/** Options for `VectorCollection.search()`. */
|
|
178
|
+
interface VectorCollectionSearchOptions {
|
|
179
|
+
vector: number[];
|
|
180
|
+
/** Number of nearest neighbours. */
|
|
181
|
+
k?: number;
|
|
182
|
+
/** Alias for `k` (parity with the document-store API). */
|
|
183
|
+
topK?: number;
|
|
184
|
+
/** Optional metadata filter forwarded as `filter` on the wire. */
|
|
185
|
+
filter?: Record<string, any>;
|
|
186
|
+
/** Whether the gateway should include metadata in each hit (default: true). */
|
|
187
|
+
includeMetadata?: boolean;
|
|
188
|
+
}
|
|
189
|
+
/** One match returned from `VectorCollection.search()`. */
|
|
190
|
+
interface VectorHit {
|
|
191
|
+
id: string;
|
|
192
|
+
/** Cosine distance (lower = closer) for cosine metric; raw distance otherwise. */
|
|
193
|
+
score?: number;
|
|
194
|
+
distance?: number;
|
|
195
|
+
values?: number[];
|
|
196
|
+
metadata?: Record<string, any>;
|
|
197
|
+
[key: string]: any;
|
|
198
|
+
}
|
|
199
|
+
/** Shape returned by `VectorCollection.info()`. */
|
|
200
|
+
interface VectorCollectionInfo {
|
|
201
|
+
name: string;
|
|
202
|
+
dimensions: number;
|
|
203
|
+
vector_count?: number;
|
|
204
|
+
distance_metric?: string;
|
|
205
|
+
index_type?: string;
|
|
206
|
+
[key: string]: any;
|
|
207
|
+
}
|
|
208
|
+
/** Shape returned by `client.createVectorCollection()`. */
|
|
209
|
+
interface CreateVectorCollectionOptions {
|
|
210
|
+
name: string;
|
|
211
|
+
dimensions: number;
|
|
212
|
+
/** Distance metric. `cosine` is the gateway default. */
|
|
213
|
+
distance_metric?: VectorDistanceMetric;
|
|
214
|
+
}
|
|
215
|
+
declare class VectorCollection {
|
|
216
|
+
private readonly client;
|
|
217
|
+
readonly name: string;
|
|
218
|
+
constructor(client: SynapCores, name: string);
|
|
219
|
+
private get basePath();
|
|
220
|
+
/**
|
|
221
|
+
* Insert one or more vectors.
|
|
222
|
+
*
|
|
223
|
+
* Wire: `POST /v1/vectors/collections/{name}/vectors` with
|
|
224
|
+
* `{ vectors: [{ id, values, metadata }] }`.
|
|
225
|
+
*
|
|
226
|
+
* Accepts either a single record or an array — the SDK always sends
|
|
227
|
+
* the wrapped `{ vectors: [...] }` envelope the gateway expects.
|
|
228
|
+
*/
|
|
229
|
+
insert(records: VectorRecord | VectorRecord[]): Promise<any>;
|
|
230
|
+
/**
|
|
231
|
+
* k-NN search over the vector collection.
|
|
232
|
+
*
|
|
233
|
+
* Wire: `POST /v1/vectors/collections/{name}/search` with
|
|
234
|
+
* `{ vector, k, include_metadata, filter? }`.
|
|
235
|
+
*
|
|
236
|
+
* Returns the bare array of hits — gateway envelope (`{data: [...]}`) is
|
|
237
|
+
* unwrapped automatically for parity with `Collection.vectorSearch`.
|
|
238
|
+
*/
|
|
239
|
+
search(options: VectorCollectionSearchOptions): Promise<VectorHit[]>;
|
|
240
|
+
/**
|
|
241
|
+
* Fetch a single vector by id.
|
|
242
|
+
*
|
|
243
|
+
* Wire: `GET /v1/vectors/collections/{name}/vectors/{id}`. Returns the
|
|
244
|
+
* gateway payload `{ id, values, metadata }` (envelope unwrapped) or
|
|
245
|
+
* `null` on 404.
|
|
246
|
+
*/
|
|
247
|
+
get(id: string): Promise<VectorHit | null>;
|
|
248
|
+
/**
|
|
249
|
+
* Delete one or more vectors by id.
|
|
250
|
+
*
|
|
251
|
+
* Single-id wire: `DELETE /v1/vectors/collections/{name}/vectors/{id}`.
|
|
252
|
+
* Bulk wire: `DELETE /v1/vectors/collections/{name}/vectors` with
|
|
253
|
+
* `{ ids: [...] }` body.
|
|
254
|
+
*/
|
|
255
|
+
delete(ids: string | string[]): Promise<any>;
|
|
256
|
+
/**
|
|
257
|
+
* Vector count.
|
|
258
|
+
*
|
|
259
|
+
* Wire: `GET /v1/vectors/collections/{name}/count` if the gateway
|
|
260
|
+
* exposes it, otherwise falls back to `info().vector_count`.
|
|
261
|
+
*/
|
|
262
|
+
count(): Promise<number>;
|
|
263
|
+
/**
|
|
264
|
+
* Collection metadata.
|
|
265
|
+
*
|
|
266
|
+
* Wire: `GET /v1/vectors/collections/{name}` returning
|
|
267
|
+
* `{ name, dimensions, vector_count, distance_metric, index_type }`.
|
|
268
|
+
*/
|
|
269
|
+
info(): Promise<VectorCollectionInfo>;
|
|
270
|
+
}
|
|
271
|
+
|
|
154
272
|
/**
|
|
155
273
|
* Type definitions for AutoML
|
|
156
274
|
*/
|
|
@@ -1791,6 +1909,8 @@ declare class GraphEdgeApi {
|
|
|
1791
1909
|
private readonly synapCores;
|
|
1792
1910
|
constructor(synapCores: SynapCores);
|
|
1793
1911
|
create(from: string, to: string, type: string, props?: Record<string, any>): Promise<GraphEdge>;
|
|
1912
|
+
/** Delete an edge by id. Mirrors `graph.nodes.delete`. */
|
|
1913
|
+
delete(id: string): Promise<void>;
|
|
1794
1914
|
}
|
|
1795
1915
|
declare class GraphIndexesApi {
|
|
1796
1916
|
private readonly synapCores;
|
|
@@ -2954,6 +3074,45 @@ declare class SynapCores {
|
|
|
2954
3074
|
}): Promise<ListCollectionsResponse>;
|
|
2955
3075
|
getDocuments(collectionName: string, page: number, pageSize: number): Promise<Document[]>;
|
|
2956
3076
|
deleteCollection(name: string): Promise<void>;
|
|
3077
|
+
private readonly vectorCollectionsCache;
|
|
3078
|
+
/**
|
|
3079
|
+
* Create a vector collection.
|
|
3080
|
+
*
|
|
3081
|
+
* Wire: `POST /v1/vectors/collections` with
|
|
3082
|
+
* `{ name, dimensions, distance_metric }`. Distinct from
|
|
3083
|
+
* `createCollection`, which targets the document-store subsystem.
|
|
3084
|
+
*
|
|
3085
|
+
* @example
|
|
3086
|
+
* const coll = await client.createVectorCollection({
|
|
3087
|
+
* name: 'memory_v1', dimensions: 1536, distance_metric: 'cosine',
|
|
3088
|
+
* });
|
|
3089
|
+
* await coll.insert({ id: 'v1', values: [...], metadata: { ... } });
|
|
3090
|
+
*/
|
|
3091
|
+
createVectorCollection(options: CreateVectorCollectionOptions): Promise<VectorCollection>;
|
|
3092
|
+
/**
|
|
3093
|
+
* Synchronous accessor for an existing vector collection. Does not
|
|
3094
|
+
* round-trip to the gateway — use `createVectorCollection` if you
|
|
3095
|
+
* need to provision the collection first, or `listVectorCollections`
|
|
3096
|
+
* to confirm existence.
|
|
3097
|
+
*
|
|
3098
|
+
* v0.4.0 split: this targets the **vector subsystem**
|
|
3099
|
+
* (`/v1/vectors/collections/{name}`). `client.collection(name)` still
|
|
3100
|
+
* returns a document-store `Collection` for the legacy subsystem.
|
|
3101
|
+
*/
|
|
3102
|
+
vectorCollection(name: string): VectorCollection;
|
|
3103
|
+
/**
|
|
3104
|
+
* List vector collections.
|
|
3105
|
+
*
|
|
3106
|
+
* Wire: `GET /v1/vectors/collections`. Returns the bare array of
|
|
3107
|
+
* collection-info objects (envelope unwrapped).
|
|
3108
|
+
*/
|
|
3109
|
+
listVectorCollections(): Promise<VectorCollectionInfo[]>;
|
|
3110
|
+
/**
|
|
3111
|
+
* Delete a vector collection.
|
|
3112
|
+
*
|
|
3113
|
+
* Wire: `DELETE /v1/vectors/collections/{name}`.
|
|
3114
|
+
*/
|
|
3115
|
+
deleteVectorCollection(name: string): Promise<void>;
|
|
2957
3116
|
/**
|
|
2958
3117
|
* Execute SQL query (legacy method for backward compatibility)
|
|
2959
3118
|
* @deprecated Use executeQuery for new code
|
|
@@ -3317,6 +3476,6 @@ declare class BatchOperationError extends SynapCoresError {
|
|
|
3317
3476
|
* Official SDK for SynapCores AI-Native Database Management System.
|
|
3318
3477
|
*/
|
|
3319
3478
|
|
|
3320
|
-
declare const VERSION = "0.
|
|
3479
|
+
declare const VERSION = "0.4.0";
|
|
3321
3480
|
|
|
3322
|
-
export { type APIKeyInfo, type APIKeyStats, type AlterTableOptions, type AnalyzeOptions, type AsyncTrainOptions, type AuthConfig, AuthenticationError, AutoMLClient, AutoMLModel, type Backup, BackupClient, type BackupMetrics, type BackupOptions, type BackupSchedule, type BackupStatus, type BackupVerificationResult, type BatchDeleteOptions, type BatchInsertOptions, BatchOperationError, type BatchQueryRequest, type BatchQueryResponse, type BatchQueryResult, type BatchResult, type BatchUpdateOptions, type BeginTransactionOptions, type BulkImportOptions, type BulkImportResult, type CTEDefinition, type ChangeOperation, type ChatCacheStats, ChatClient, type ChatMessage, type ChatModelInfo, type ChatSession, type ChatStreamChunk, type ChatSuggestion, type ChatSuggestionsOptions, type ChatSystemPrompt, type ChatTool, Collection, type CollectionFieldDefinition, type CollectionIndexDefinition, type CollectionInfo, type CollectionSchema, type CollectionSchemaDefinition, type CollectionStats, type ColumnConstraint, type ColumnDefinition, type ColumnInfo, ConnectionError, type ConnectionPool, type ConstraintInfo, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateChatSessionOptions, type CreateCollectionRequest, type CreateCollectionResponse, type CreateFsCollectionOptions, type CreateIntegrationOptions, type CreateRecipeOptions, type CreateScheduleOptions, type CreateTableOptions, type CreateWebhookOptions, type CypherProfileResult, type CypherResult, type DataValidationOptions, type DataValidationResult, type Document, type EmbedOptions, type Entity, type EvaluationResult, type ExecuteIntegrationOptions, type ExecuteQueryRequest, type ExecuteRecipeOptions, type ExportJobStatus, type ExportOptions, type ExportResult, FilesystemCollectionsClient, type ForeignKeyReference, type FsCollection, type FsDocument, type FsProgressEvent, type GenerateRecipeOptions, type GeneratedRecipe, type GraphAlgorithmName, type GraphAlgorithmRequest, type GraphAlgorithmResult, GraphClient, type GraphEdge, type GraphExtractRequest, type GraphExtractResult, type GraphNode, type GraphSummary, type HybridSearchOptions, type ImportError, ImportExportClient, type ImportJobStatus, type ImportOptions, type ImportResult, type ValidationError$1 as ImportValidationError, type ValidationWarning as ImportValidationWarning, type IndexDefinition, type IndexInfo, type InsertResult, type Integration, IntegrationClient, type IntegrationConfig, type IntegrationEvent, type IntegrationExecutionResult, type IntegrationLog, type IntegrationStats, type IntegrationWebhook, type KNNSearchOptions, type ListAPIKeysResponse, type ListBackupsOptions, type ListCollectionsResponse, type ListIntegrationsOptions, type ListMultimediaResponse, type ListRecipesOptions, type ListTrainingJobsOptions, type LoginRequest, type LoginResponse, McpClient, type McpInfo, type McpRequest, type McpResponse, type ModelInfo, type MultimediaInfo, MultimodalClient, type MultimodalEmbedResult, type MultimodalInput, type MultimodalJoinOptions, type MultimodalJoinResult, type MultimodalSearchHit, type MultimodalSearchOptions, type MultimodalSimilarityOptions, type MultimodalSimilarityResult, NL2SqlClient, type NLPAnalysis, NLPClient, type Nl2SqlAskOptions, type Nl2SqlAskResult, type Nl2SqlHistoryEntry, type Nl2SqlSchemaContext, type Nl2SqlValidateResult, NotFoundError, type OAuth2Config, type PredictResult, type PreparedStatement, type PreparedStatementOptions, type QueryColumn, type QueryOptions, type QueryPerformance, type QueryResult, type RangeSearchOptions, RateLimitError, type Recipe, RecipeClient, type RecipeExecutionResult, type RecipeInfo, type RecipeParameter, type RefreshResponse, type RegisterRequest, type RegisterResponse, type RelationshipInfo, type RestoreOptions, type RestoreResult, type RestoreStatus, type RetryConfig, SQLError, SchemaClient, type SchemaStatistics, type ValidationError$2 as SchemaValidationError, type SearchOptions, type SearchResult, type SendChatOptions, type SendChatResult, type Sentiment, ServerError, type StorageConfig, Subscription, type SubscriptionEvent, type SubscriptionOptions, type SummarizeOptions, SynapCores, type SynapCoresConfig, SynapCoresError, SystemClient, type TableConstraint, type TableInfo, type TableSchema, type TestIntegrationOptions, type TestIntegrationResult, TimeoutError, type TrainOptions, type TrainingJob, type TrainingMetrics, type TransactionContext, TransactionError, type TransactionOptions, TransactionsClient, Tx, type TxHistoryEntry, type TxQueryResult, type UpdateOptions, type UploadMultimediaRequest, VERSION, ValidationError, type ValidationResult, type ValidationWarning$1 as ValidationWarning, type Vector, type VectorArithmeticResult, VectorError, type VectorSearchOptions, type VectorSearchResult, type VectorSimilarityResult, type VisionConfig, type VisionTestResult, type WindowFunctionOptions };
|
|
3481
|
+
export { type APIKeyInfo, type APIKeyStats, type AlterTableOptions, type AnalyzeOptions, type AsyncTrainOptions, type AuthConfig, AuthenticationError, AutoMLClient, AutoMLModel, type Backup, BackupClient, type BackupMetrics, type BackupOptions, type BackupSchedule, type BackupStatus, type BackupVerificationResult, type BatchDeleteOptions, type BatchInsertOptions, BatchOperationError, type BatchQueryRequest, type BatchQueryResponse, type BatchQueryResult, type BatchResult, type BatchUpdateOptions, type BeginTransactionOptions, type BulkImportOptions, type BulkImportResult, type CTEDefinition, type ChangeOperation, type ChatCacheStats, ChatClient, type ChatMessage, type ChatModelInfo, type ChatSession, type ChatStreamChunk, type ChatSuggestion, type ChatSuggestionsOptions, type ChatSystemPrompt, type ChatTool, Collection, type CollectionFieldDefinition, type CollectionIndexDefinition, type CollectionInfo, type CollectionSchema, type CollectionSchemaDefinition, type CollectionStats, type ColumnConstraint, type ColumnDefinition, type ColumnInfo, ConnectionError, type ConnectionPool, type ConstraintInfo, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateChatSessionOptions, type CreateCollectionRequest, type CreateCollectionResponse, type CreateFsCollectionOptions, type CreateIntegrationOptions, type CreateRecipeOptions, type CreateScheduleOptions, type CreateTableOptions, type CreateVectorCollectionOptions, type CreateWebhookOptions, type CypherProfileResult, type CypherResult, type DataValidationOptions, type DataValidationResult, type Document, type EmbedOptions, type Entity, type EvaluationResult, type ExecuteIntegrationOptions, type ExecuteQueryRequest, type ExecuteRecipeOptions, type ExportJobStatus, type ExportOptions, type ExportResult, FilesystemCollectionsClient, type ForeignKeyReference, type FsCollection, type FsDocument, type FsProgressEvent, type GenerateRecipeOptions, type GeneratedRecipe, type GraphAlgorithmName, type GraphAlgorithmRequest, type GraphAlgorithmResult, GraphClient, type GraphEdge, type GraphExtractRequest, type GraphExtractResult, type GraphNode, type GraphSummary, type HybridSearchOptions, type ImportError, ImportExportClient, type ImportJobStatus, type ImportOptions, type ImportResult, type ValidationError$1 as ImportValidationError, type ValidationWarning as ImportValidationWarning, type IndexDefinition, type IndexInfo, type InsertResult, type Integration, IntegrationClient, type IntegrationConfig, type IntegrationEvent, type IntegrationExecutionResult, type IntegrationLog, type IntegrationStats, type IntegrationWebhook, type KNNSearchOptions, type ListAPIKeysResponse, type ListBackupsOptions, type ListCollectionsResponse, type ListIntegrationsOptions, type ListMultimediaResponse, type ListRecipesOptions, type ListTrainingJobsOptions, type LoginRequest, type LoginResponse, McpClient, type McpInfo, type McpRequest, type McpResponse, type ModelInfo, type MultimediaInfo, MultimodalClient, type MultimodalEmbedResult, type MultimodalInput, type MultimodalJoinOptions, type MultimodalJoinResult, type MultimodalSearchHit, type MultimodalSearchOptions, type MultimodalSimilarityOptions, type MultimodalSimilarityResult, NL2SqlClient, type NLPAnalysis, NLPClient, type Nl2SqlAskOptions, type Nl2SqlAskResult, type Nl2SqlHistoryEntry, type Nl2SqlSchemaContext, type Nl2SqlValidateResult, NotFoundError, type OAuth2Config, type PredictResult, type PreparedStatement, type PreparedStatementOptions, type QueryColumn, type QueryOptions, type QueryPerformance, type QueryResult, type RangeSearchOptions, RateLimitError, type Recipe, RecipeClient, type RecipeExecutionResult, type RecipeInfo, type RecipeParameter, type RefreshResponse, type RegisterRequest, type RegisterResponse, type RelationshipInfo, type RestoreOptions, type RestoreResult, type RestoreStatus, type RetryConfig, SQLError, SchemaClient, type SchemaStatistics, type ValidationError$2 as SchemaValidationError, type SearchOptions, type SearchResult, type SendChatOptions, type SendChatResult, type Sentiment, ServerError, type StorageConfig, Subscription, type SubscriptionEvent, type SubscriptionOptions, type SummarizeOptions, SynapCores, type SynapCoresConfig, SynapCoresError, SystemClient, type TableConstraint, type TableInfo, type TableSchema, type TestIntegrationOptions, type TestIntegrationResult, TimeoutError, type TrainOptions, type TrainingJob, type TrainingMetrics, type TransactionContext, TransactionError, type TransactionOptions, TransactionsClient, Tx, type TxHistoryEntry, type TxQueryResult, type UpdateOptions, type UploadMultimediaRequest, VERSION, ValidationError, type ValidationResult, type ValidationWarning$1 as ValidationWarning, type Vector, type VectorArithmeticResult, VectorCollection, type VectorCollectionInfo, type VectorCollectionSearchOptions, type VectorDistanceMetric, VectorError, type VectorHit, type VectorRecord, type VectorSearchOptions, type VectorSearchResult, type VectorSimilarityResult, type VisionConfig, type VisionTestResult, type WindowFunctionOptions };
|