@synapcores/sdk 0.2.1 → 0.3.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 +61 -0
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +81 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +81 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@synapcores/sdk` are documented here.
|
|
4
|
+
This project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
|
+
|
|
6
|
+
## 0.3.0 — 2026-05-18
|
|
7
|
+
|
|
8
|
+
Wire-alignment release for the v1.6.5.1-ce gateway. Brings the SDK back into sync
|
|
9
|
+
with the gateway response shapes and route prefixes that shipped in v1.6.x.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- `client.listCollections()` / `listCollectionsDetailed()` now correctly parse the
|
|
14
|
+
v1.6.x envelope `{ data: { items, total, page, page_size }, meta }`. Previously
|
|
15
|
+
the SDK looked for `data.collections` and threw
|
|
16
|
+
`Cannot read properties of undefined (reading 'map')`.
|
|
17
|
+
- `client.graph.graphs.{list,create,get,delete}()` now hit `/v1/graph/graphs`
|
|
18
|
+
(the actual mount point); the old `/v1/graphs` paths 404'd against the v1.6.x
|
|
19
|
+
gateway.
|
|
20
|
+
- `client.automl.listModels()` now tolerates the v1.6.x `{ data: [...], meta }`
|
|
21
|
+
envelope (was throwing `(data.models ?? data ?? []).map is not a function`
|
|
22
|
+
because `data` is an object, not an array).
|
|
23
|
+
- `client.automl.getModel(id)` no longer hard-fails when the gateway's model
|
|
24
|
+
registry returns 404 for an id whose `/predict` endpoint still works (the
|
|
25
|
+
registry and the predict path can be out of sync after a recipe-loaded model
|
|
26
|
+
is hot-swapped). It now returns a stub `AutoMLModel` so `.predict()` /
|
|
27
|
+
`.evaluate()` still flow through.
|
|
28
|
+
- `collection(name).vectorSearch({ vector, topK, filter? })` now posts to
|
|
29
|
+
`POST /v1/vectors/collections/{name}/search` with the gateway's `k` field
|
|
30
|
+
(was using the removed `/collections/{name}/vector_search` route with
|
|
31
|
+
`top_k`).
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- `client.collection(name)` — synchronous accessor returning a `Collection`
|
|
36
|
+
handle without round-tripping to the gateway. Enables one-liner
|
|
37
|
+
`client.collection('docs').vectorSearch({...})`.
|
|
38
|
+
- `tests/live-smoke.test.ts` — gated on `AIDB_LIVE_TEST=1`, runs the 9-test
|
|
39
|
+
validation suite against a live gateway so regressions in wire shapes are
|
|
40
|
+
caught in CI rather than at customer-install time.
|
|
41
|
+
|
|
42
|
+
### Process
|
|
43
|
+
|
|
44
|
+
- This is the first release where the public `SynapCores/nodejs-sdk` repository
|
|
45
|
+
reflects the code actually shipped to npm. Releases 0.1.0 / 0.2.0 / 0.2.1
|
|
46
|
+
were published directly from an internal workspace and the public repo
|
|
47
|
+
diverged by months. Going forward, all releases must be cut from this repo.
|
|
48
|
+
|
|
49
|
+
## 0.2.1 — 2026-05-13
|
|
50
|
+
|
|
51
|
+
- Internal release published from the workspace (not from this repo).
|
|
52
|
+
|
|
53
|
+
## 0.2.0 — 2026-05-07
|
|
54
|
+
|
|
55
|
+
- Internal release published from the workspace (not from this repo).
|
|
56
|
+
- Migrated `/ai/*` routes to `/automl/*`, added Graph / NL2SQL / Filesystem /
|
|
57
|
+
Chat / Multimodal / System / Transactions / MCP sub-clients.
|
|
58
|
+
|
|
59
|
+
## 0.1.0 — 2025-10-31
|
|
60
|
+
|
|
61
|
+
- Initial release.
|
package/dist/index.d.mts
CHANGED
|
@@ -2925,12 +2925,25 @@ declare class SynapCores {
|
|
|
2925
2925
|
*/
|
|
2926
2926
|
createCollectionWithSchema(request: CreateCollectionRequest): Promise<Collection>;
|
|
2927
2927
|
getCollection(name: string): Promise<Collection>;
|
|
2928
|
+
/**
|
|
2929
|
+
* Synchronous accessor that returns a Collection handle without round-tripping
|
|
2930
|
+
* to the gateway. Use this when you already know the collection exists and just
|
|
2931
|
+
* want to issue a vectorSearch / search / insert against it.
|
|
2932
|
+
*
|
|
2933
|
+
* v0.3.0: added so `client.collection(name).vectorSearch(...)` works without
|
|
2934
|
+
* a preceding await on getCollection().
|
|
2935
|
+
*/
|
|
2936
|
+
collection(name: string): Collection;
|
|
2928
2937
|
/**
|
|
2929
2938
|
* List collections (legacy method for backward compatibility)
|
|
2930
2939
|
*/
|
|
2931
2940
|
listCollections(): Promise<string[]>;
|
|
2932
2941
|
/**
|
|
2933
2942
|
* List collections with detailed information matching the database integration guide format
|
|
2943
|
+
*
|
|
2944
|
+
* v0.3.0: gateway returns an envelope { data: { items, total, page, page_size, ... }, meta }.
|
|
2945
|
+
* We normalise that into the SDK's { collections, total, page, pageSize } shape and also
|
|
2946
|
+
* accept legacy { collections: [...] } / bare arrays for forward-compat.
|
|
2934
2947
|
*/
|
|
2935
2948
|
listCollectionsDetailed(options?: {
|
|
2936
2949
|
page?: number;
|
|
@@ -3304,6 +3317,6 @@ declare class BatchOperationError extends SynapCoresError {
|
|
|
3304
3317
|
* Official SDK for SynapCores AI-Native Database Management System.
|
|
3305
3318
|
*/
|
|
3306
3319
|
|
|
3307
|
-
declare const VERSION = "0.
|
|
3320
|
+
declare const VERSION = "0.3.0";
|
|
3308
3321
|
|
|
3309
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -2925,12 +2925,25 @@ declare class SynapCores {
|
|
|
2925
2925
|
*/
|
|
2926
2926
|
createCollectionWithSchema(request: CreateCollectionRequest): Promise<Collection>;
|
|
2927
2927
|
getCollection(name: string): Promise<Collection>;
|
|
2928
|
+
/**
|
|
2929
|
+
* Synchronous accessor that returns a Collection handle without round-tripping
|
|
2930
|
+
* to the gateway. Use this when you already know the collection exists and just
|
|
2931
|
+
* want to issue a vectorSearch / search / insert against it.
|
|
2932
|
+
*
|
|
2933
|
+
* v0.3.0: added so `client.collection(name).vectorSearch(...)` works without
|
|
2934
|
+
* a preceding await on getCollection().
|
|
2935
|
+
*/
|
|
2936
|
+
collection(name: string): Collection;
|
|
2928
2937
|
/**
|
|
2929
2938
|
* List collections (legacy method for backward compatibility)
|
|
2930
2939
|
*/
|
|
2931
2940
|
listCollections(): Promise<string[]>;
|
|
2932
2941
|
/**
|
|
2933
2942
|
* List collections with detailed information matching the database integration guide format
|
|
2943
|
+
*
|
|
2944
|
+
* v0.3.0: gateway returns an envelope { data: { items, total, page, page_size, ... }, meta }.
|
|
2945
|
+
* We normalise that into the SDK's { collections, total, page, pageSize } shape and also
|
|
2946
|
+
* accept legacy { collections: [...] } / bare arrays for forward-compat.
|
|
2934
2947
|
*/
|
|
2935
2948
|
listCollectionsDetailed(options?: {
|
|
2936
2949
|
page?: number;
|
|
@@ -3304,6 +3317,6 @@ declare class BatchOperationError extends SynapCoresError {
|
|
|
3304
3317
|
* Official SDK for SynapCores AI-Native Database Management System.
|
|
3305
3318
|
*/
|
|
3306
3319
|
|
|
3307
|
-
declare const VERSION = "0.
|
|
3320
|
+
declare const VERSION = "0.3.0";
|
|
3308
3321
|
|
|
3309
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 };
|
package/dist/index.js
CHANGED
|
@@ -316,20 +316,20 @@ var Collection = class {
|
|
|
316
316
|
}
|
|
317
317
|
async vectorSearch(options) {
|
|
318
318
|
const { data } = await this.client._getHttpClient().post(
|
|
319
|
-
|
|
319
|
+
`/vectors/collections/${this.name}/search`,
|
|
320
320
|
{
|
|
321
321
|
vector: options.vector,
|
|
322
|
-
|
|
323
|
-
top_k: options.topK || 10,
|
|
322
|
+
k: options.topK || 10,
|
|
324
323
|
filter: options.filter,
|
|
325
|
-
|
|
326
|
-
include_metadata: options.includeMetadata
|
|
324
|
+
include_metadata: options.includeMetadata !== false
|
|
327
325
|
}
|
|
328
326
|
);
|
|
327
|
+
const inner = data?.data ?? data;
|
|
328
|
+
const matches = Array.isArray(inner) ? inner : inner?.matches ?? inner?.results ?? inner?.documents ?? data?.matches ?? data?.results ?? data?.documents ?? [];
|
|
329
329
|
return {
|
|
330
|
-
documents:
|
|
331
|
-
total:
|
|
332
|
-
tookMs:
|
|
330
|
+
documents: matches,
|
|
331
|
+
total: (inner && !Array.isArray(inner) ? inner.total : void 0) ?? matches.length,
|
|
332
|
+
tookMs: (inner && !Array.isArray(inner) ? inner.took_ms : void 0) ?? data?.took_ms
|
|
333
333
|
};
|
|
334
334
|
}
|
|
335
335
|
async query(options = {}) {
|
|
@@ -467,27 +467,48 @@ var AutoMLClient = class {
|
|
|
467
467
|
return new AutoMLModel(this, modelInfo);
|
|
468
468
|
}
|
|
469
469
|
async getModel(modelId) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
470
|
+
try {
|
|
471
|
+
const { data } = await this.synapCores._getHttpClient().get(
|
|
472
|
+
`/automl/models/${modelId}`
|
|
473
|
+
);
|
|
474
|
+
const m = data?.data ?? data;
|
|
475
|
+
const modelInfo = {
|
|
476
|
+
id: m.id ?? modelId,
|
|
477
|
+
name: m.name ?? modelId,
|
|
478
|
+
task: m.task,
|
|
479
|
+
status: m.status,
|
|
480
|
+
accuracy: m.accuracy,
|
|
481
|
+
createdAt: new Date(m.created_at ?? Date.now()),
|
|
482
|
+
updatedAt: m.updated_at ? new Date(m.updated_at) : void 0,
|
|
483
|
+
config: m.config ?? {}
|
|
484
|
+
};
|
|
485
|
+
return new AutoMLModel(this, modelInfo);
|
|
486
|
+
} catch (err) {
|
|
487
|
+
const status = err?.statusCode ?? err?.response?.status;
|
|
488
|
+
const code = err?.code;
|
|
489
|
+
if (status === 404 || code === "NOT_FOUND") {
|
|
490
|
+
const modelInfo = {
|
|
491
|
+
id: modelId,
|
|
492
|
+
name: modelId,
|
|
493
|
+
task: void 0,
|
|
494
|
+
status: "unknown",
|
|
495
|
+
accuracy: void 0,
|
|
496
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
497
|
+
updatedAt: void 0,
|
|
498
|
+
config: {}
|
|
499
|
+
};
|
|
500
|
+
return new AutoMLModel(this, modelInfo);
|
|
501
|
+
}
|
|
502
|
+
throw err;
|
|
503
|
+
}
|
|
484
504
|
}
|
|
485
505
|
async listModels(filters) {
|
|
486
506
|
const { data } = await this.synapCores._getHttpClient().get("/automl/models", {
|
|
487
507
|
params: filters
|
|
488
508
|
});
|
|
489
|
-
|
|
490
|
-
|
|
509
|
+
const list = Array.isArray(data) ? data : Array.isArray(data?.data) ? data.data : Array.isArray(data?.models) ? data.models : Array.isArray(data?.data?.items) ? data.data.items : [];
|
|
510
|
+
return list.map((model) => ({
|
|
511
|
+
id: model.id ?? model.name,
|
|
491
512
|
name: model.name,
|
|
492
513
|
task: model.task,
|
|
493
514
|
status: model.status,
|
|
@@ -1998,23 +2019,24 @@ var GraphsApi = class {
|
|
|
1998
2019
|
constructor(synapCores) {
|
|
1999
2020
|
this.synapCores = synapCores;
|
|
2000
2021
|
}
|
|
2022
|
+
// v0.3.0: gateway routes live under /graph/graphs, not /graphs.
|
|
2001
2023
|
async list() {
|
|
2002
|
-
const { data } = await this.synapCores._getHttpClient().get("/graphs");
|
|
2024
|
+
const { data } = await this.synapCores._getHttpClient().get("/graph/graphs");
|
|
2003
2025
|
return (data.graphs ?? data ?? []).map((g) => this.normalize(g));
|
|
2004
2026
|
}
|
|
2005
2027
|
async create(name, opts = {}) {
|
|
2006
|
-
const { data } = await this.synapCores._getHttpClient().post("/graphs", {
|
|
2028
|
+
const { data } = await this.synapCores._getHttpClient().post("/graph/graphs", {
|
|
2007
2029
|
name,
|
|
2008
2030
|
description: opts.description
|
|
2009
2031
|
});
|
|
2010
2032
|
return this.normalize(data);
|
|
2011
2033
|
}
|
|
2012
2034
|
async get(name) {
|
|
2013
|
-
const { data } = await this.synapCores._getHttpClient().get(`/graphs/${name}`);
|
|
2035
|
+
const { data } = await this.synapCores._getHttpClient().get(`/graph/graphs/${name}`);
|
|
2014
2036
|
return this.normalize(data);
|
|
2015
2037
|
}
|
|
2016
2038
|
async delete(name) {
|
|
2017
|
-
await this.synapCores._getHttpClient().delete(`/graphs/${name}`);
|
|
2039
|
+
await this.synapCores._getHttpClient().delete(`/graph/graphs/${name}`);
|
|
2018
2040
|
}
|
|
2019
2041
|
normalize(data) {
|
|
2020
2042
|
return {
|
|
@@ -2842,7 +2864,7 @@ var SynapCores = class {
|
|
|
2842
2864
|
timeout: this.config.timeout,
|
|
2843
2865
|
headers: {
|
|
2844
2866
|
"Content-Type": "application/json",
|
|
2845
|
-
"User-Agent": "synapcores-nodejs/0.
|
|
2867
|
+
"User-Agent": "synapcores-nodejs/0.3.0",
|
|
2846
2868
|
...authHeader
|
|
2847
2869
|
},
|
|
2848
2870
|
...httpsAgent && { httpsAgent }
|
|
@@ -3008,15 +3030,35 @@ var SynapCores = class {
|
|
|
3008
3030
|
this.collectionsCache.set(name, collection);
|
|
3009
3031
|
return collection;
|
|
3010
3032
|
}
|
|
3033
|
+
/**
|
|
3034
|
+
* Synchronous accessor that returns a Collection handle without round-tripping
|
|
3035
|
+
* to the gateway. Use this when you already know the collection exists and just
|
|
3036
|
+
* want to issue a vectorSearch / search / insert against it.
|
|
3037
|
+
*
|
|
3038
|
+
* v0.3.0: added so `client.collection(name).vectorSearch(...)` works without
|
|
3039
|
+
* a preceding await on getCollection().
|
|
3040
|
+
*/
|
|
3041
|
+
collection(name) {
|
|
3042
|
+
if (this.collectionsCache.has(name)) {
|
|
3043
|
+
return this.collectionsCache.get(name);
|
|
3044
|
+
}
|
|
3045
|
+
const c = new Collection(this, name);
|
|
3046
|
+
this.collectionsCache.set(name, c);
|
|
3047
|
+
return c;
|
|
3048
|
+
}
|
|
3011
3049
|
/**
|
|
3012
3050
|
* List collections (legacy method for backward compatibility)
|
|
3013
3051
|
*/
|
|
3014
3052
|
async listCollections() {
|
|
3015
3053
|
const result = await this.listCollectionsDetailed();
|
|
3016
|
-
return result.collections.map((c) => c.name);
|
|
3054
|
+
return (result.collections ?? []).map((c) => c.name);
|
|
3017
3055
|
}
|
|
3018
3056
|
/**
|
|
3019
3057
|
* List collections with detailed information matching the database integration guide format
|
|
3058
|
+
*
|
|
3059
|
+
* v0.3.0: gateway returns an envelope { data: { items, total, page, page_size, ... }, meta }.
|
|
3060
|
+
* We normalise that into the SDK's { collections, total, page, pageSize } shape and also
|
|
3061
|
+
* accept legacy { collections: [...] } / bare arrays for forward-compat.
|
|
3020
3062
|
*/
|
|
3021
3063
|
async listCollectionsDetailed(options) {
|
|
3022
3064
|
const params = new URLSearchParams();
|
|
@@ -3028,7 +3070,14 @@ var SynapCores = class {
|
|
|
3028
3070
|
const { data } = await this.httpClient.get(
|
|
3029
3071
|
`/collections${params.toString() ? `?${params.toString()}` : ""}`
|
|
3030
3072
|
);
|
|
3031
|
-
|
|
3073
|
+
const inner = data?.data ?? data;
|
|
3074
|
+
const items = Array.isArray(inner) ? inner : inner?.items ?? inner?.collections ?? [];
|
|
3075
|
+
return {
|
|
3076
|
+
collections: items,
|
|
3077
|
+
total: inner?.total ?? items.length,
|
|
3078
|
+
page: inner?.page ?? 1,
|
|
3079
|
+
pageSize: inner?.page_size ?? inner?.pageSize ?? items.length
|
|
3080
|
+
};
|
|
3032
3081
|
}
|
|
3033
3082
|
async getDocuments(collectionName, page, pageSize) {
|
|
3034
3083
|
const { data } = await this.httpClient.get(
|
|
@@ -3954,7 +4003,7 @@ var SynapCores = class {
|
|
|
3954
4003
|
|
|
3955
4004
|
// src/index.ts
|
|
3956
4005
|
var import_zod = require("zod");
|
|
3957
|
-
var VERSION = "0.
|
|
4006
|
+
var VERSION = "0.3.0";
|
|
3958
4007
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3959
4008
|
0 && (module.exports = {
|
|
3960
4009
|
AuthenticationError,
|