@anvailabs/proximadb-client 0.3.0 → 0.5.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.
Files changed (44) hide show
  1. package/dist/client.d.ts +4 -4
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +92 -5
  4. package/dist/client.js.map +1 -1
  5. package/dist/collection.d.ts +12 -1
  6. package/dist/collection.d.ts.map +1 -1
  7. package/dist/collection.js +33 -3
  8. package/dist/collection.js.map +1 -1
  9. package/dist/generated/schema.d.ts +7508 -2185
  10. package/dist/generated/schema.d.ts.map +1 -1
  11. package/dist/graph.d.ts +3 -3
  12. package/dist/graph.d.ts.map +1 -1
  13. package/dist/graph.js +15 -8
  14. package/dist/graph.js.map +1 -1
  15. package/dist/index.d.mts +3 -0
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +4 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +4 -0
  21. package/package.json +14 -9
  22. package/src/client.ts +195 -32
  23. package/src/collection.ts +38 -3
  24. package/src/generated/schema.ts +7508 -2185
  25. package/src/graph.ts +37 -13
  26. package/src/index.ts +4 -1
  27. package/dist/esm/client.js +0 -674
  28. package/dist/esm/client.js.map +0 -1
  29. package/dist/esm/collection.js +0 -428
  30. package/dist/esm/collection.js.map +0 -1
  31. package/dist/esm/filter.js +0 -228
  32. package/dist/esm/filter.js.map +0 -1
  33. package/dist/esm/generated/schema.js +0 -6
  34. package/dist/esm/generated/schema.js.map +0 -1
  35. package/dist/esm/graph.js +0 -678
  36. package/dist/esm/graph.js.map +0 -1
  37. package/dist/esm/index.js +0 -86
  38. package/dist/esm/index.js.map +0 -1
  39. package/dist/esm/search.js +0 -317
  40. package/dist/esm/search.js.map +0 -1
  41. package/dist/esm/transport.js +0 -33
  42. package/dist/esm/transport.js.map +0 -1
  43. package/dist/esm/types.js +0 -181
  44. package/dist/esm/types.js.map +0 -1
package/src/graph.ts CHANGED
@@ -35,15 +35,18 @@ export interface GraphHttpClient {
35
35
  url(): string;
36
36
  // Typed transport seams (route through the generated client).
37
37
  createGraphRequest(body: Record<string, unknown>): Promise<unknown>;
38
- getGraphRequest(graphId: string): Promise<unknown>;
38
+ getGraphRequest(graphId: string): Promise<GraphInfo>;
39
39
  getGraphStatsRequest(graphId: string): Promise<unknown>;
40
40
  createNodeRequest(graphId: string, body: Record<string, unknown>): Promise<unknown>;
41
41
  batchCreateNodesRequest(graphId: string, body: Record<string, unknown>): Promise<unknown>;
42
- getNodeRequest(graphId: string, nodeId: string): Promise<unknown>;
42
+ getNodeRequest(graphId: string, nodeId: string): Promise<GraphNode>;
43
43
  deleteNodeRequest(graphId: string, nodeId: string): Promise<void>;
44
44
  createEdgeRequest(graphId: string, body: Record<string, unknown>): Promise<unknown>;
45
45
  batchCreateEdgesRequest(graphId: string, body: Record<string, unknown>): Promise<unknown>;
46
- traverseGraphRequest(graphId: string, body: Record<string, unknown>): Promise<unknown>;
46
+ traverseGraphRequest(
47
+ graphId: string,
48
+ body: Record<string, unknown>,
49
+ ): Promise<TraversalResult>;
47
50
  }
48
51
 
49
52
  // ============================================================================
@@ -471,11 +474,10 @@ export class TraversalBuilder {
471
474
  void this.traversalDirection;
472
475
  void this.filterExpr;
473
476
 
474
- const data = await this.handle.getClient().traverseGraphRequest(
477
+ return this.handle.getClient().traverseGraphRequest(
475
478
  this.handle.getName(),
476
479
  request,
477
480
  );
478
- return data as TraversalResult;
479
481
  }
480
482
  }
481
483
 
@@ -549,8 +551,20 @@ export class GraphHandle {
549
551
  const response = (await this.client.batchCreateNodesRequest(
550
552
  this.graphName,
551
553
  request as unknown as Record<string, unknown>,
552
- )) as { data?: { count?: number }; count?: number } | null;
553
- return response?.data?.count ?? response?.count ?? normalized.length;
554
+ )) as {
555
+ data?: { created_count?: number; count?: number };
556
+ created_count?: number;
557
+ count?: number;
558
+ added_count?: number;
559
+ } | null;
560
+ return (
561
+ response?.data?.created_count ??
562
+ response?.data?.count ??
563
+ response?.created_count ??
564
+ response?.count ??
565
+ response?.added_count ??
566
+ 0
567
+ );
554
568
  }
555
569
 
556
570
  /**
@@ -574,8 +588,20 @@ export class GraphHandle {
574
588
  const response = (await this.client.batchCreateEdgesRequest(
575
589
  this.graphName,
576
590
  request as unknown as Record<string, unknown>,
577
- )) as { data?: { count?: number }; count?: number } | null;
578
- return response?.data?.count ?? response?.count ?? normalized.length;
591
+ )) as {
592
+ data?: { created_count?: number; count?: number };
593
+ created_count?: number;
594
+ count?: number;
595
+ added_count?: number;
596
+ } | null;
597
+ return (
598
+ response?.data?.created_count ??
599
+ response?.data?.count ??
600
+ response?.created_count ??
601
+ response?.count ??
602
+ response?.added_count ??
603
+ 0
604
+ );
579
605
  }
580
606
 
581
607
  /**
@@ -583,8 +609,7 @@ export class GraphHandle {
583
609
  */
584
610
  async getNode(nodeId: string): Promise<GraphNode | null> {
585
611
  try {
586
- const data = await this.client.getNodeRequest(this.graphName, nodeId);
587
- return data as GraphNode;
612
+ return await this.client.getNodeRequest(this.graphName, nodeId);
588
613
  } catch (e: unknown) {
589
614
  // The facade maps a 404 to a ProximaDBError (statusCode 404, message =
590
615
  // server body). Treat "not found" as a null result, preserving the
@@ -630,8 +655,7 @@ export class GraphHandle {
630
655
  * Wire endpoint: GET /api/v2/graphs/{graph_id} (getGraph)
631
656
  */
632
657
  async info(): Promise<GraphInfo> {
633
- const data = await this.client.getGraphRequest(this.graphName);
634
- return data as GraphInfo;
658
+ return this.client.getGraphRequest(this.graphName);
635
659
  }
636
660
  }
637
661
 
package/src/index.ts CHANGED
@@ -50,7 +50,10 @@
50
50
  // VERSION
51
51
  // ============================================================================
52
52
 
53
- export const VERSION = "1.0.0";
53
+ // The package version. Kept equal to package.json `version` by
54
+ // scripts/version-sync.sh (`set` rewrites it, `check` fails on drift) and by
55
+ // tests/package_entry.test.ts.
56
+ export const VERSION = "0.5.0";
54
57
 
55
58
  // ============================================================================
56
59
  // TYPES