🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@inferagraph/cosmosdb-datasource

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inferagraph/cosmosdb-datasource

Azure Cosmos DB NoSQL datasource for InferaGraph

latest
Source
npmnpm
Version
0.1.4
Version published
Maintainers
1
Created
Source

@inferagraph/cosmosdb-datasource

Azure Cosmos DB NoSQL datasource plugin for @inferagraph/core.

Installation

pnpm add @inferagraph/cosmosdb-datasource @inferagraph/core @azure/cosmos

Usage

import { CosmosDbDatasource } from '@inferagraph/cosmosdb-datasource';

const datasource = new CosmosDbDatasource({
  endpoint: 'https://your-account.documents.azure.com:443/',
  key: 'your-key',
  database: 'my-database',
  container: 'my-container',
});

await datasource.connect();

const view = await datasource.getInitialView();
console.log(view.nodes, view.edges);

await datasource.disconnect();

Multi-hop neighbors

getNeighbors(nodeId, depth) supports depth > 1. Cosmos DB NoSQL has no native graph traversal, so the datasource does an application-level BFS — one 1-hop fan-out per level, deduping nodes and edges by id. Single-hop callers see no change.

Configuration

OptionRequiredDescription
endpointYesCosmos DB account endpoint URL
keyYesAccount key for authentication
databaseYesDatabase name
containerYesContainer name for nodes (and edges if not separated)
edgesContainerNoSeparate container for edge documents
partitionKeyPathNoPartition key path (default: /type)

Document Format

Nodes and edges are stored as JSON documents differentiated by a _docType field:

Node document:

{
  "id": "node-1",
  "_docType": "node",
  "name": "Example Node",
  "type": "person"
}

Edge document:

{
  "id": "edge-1",
  "_docType": "edge",
  "sourceId": "node-1",
  "targetId": "node-2",
  "type": "related_to"
}

License

MIT

FAQs

Package last updated on 06 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts