prorm API Reference
    Preparing search index...

    Class NeptuneStore

    NeptuneStore wraps the gremlin package's DriverRemoteConnection (fluent, bytecode-based traversals via a GraphTraversalSource, i.e. g) and Client (raw Gremlin script submission) to talk to Amazon Neptune, implementing the minimal NoSqlStore marker interface. Vertex/ edge CRUD helpers below are convenience wrappers built on top of real Gremlin steps (addV/addE/has/hasLabel/drop/...) — for anything they don't cover, use getClient() (the raw GraphTraversalSource), traversal() (build an arbitrary traversal against g), or submit() (raw parameterized Gremlin script text).

    Implements

    Index
    name: "neptune" = 'neptune'

    The name of the store (e.g. 'mongodb', 'redis', 'dynamodb')

    library: "gremlin" = 'gremlin'

    The client library being used

    • Access to the raw DriverRemoteConnection, e.g. to inspect isOpen directly.

      Returns unknown

    • Runs an arbitrary traversal built against g and Gremlin's anonymous traversal statics (gremlin.process.statics, e.g. statics.V(id) for nested traversals like .to(statics.V(id))), returning the fully materialized, normalized result list. This is the escape hatch for any Gremlin step this store doesn't wrap in a dedicated helper.

      Type Parameters

      • T = unknown

      Parameters

      • build: (g: unknown, statics: unknown) => unknown

      Returns Promise<T[]>

      const names = await store.traversal((g) => g.V().hasLabel('person').values('name'));
      
    • Submits a raw Gremlin script string via the driver's script-eval Client (as opposed to the fluent bytecode traversal g used elsewhere in this class), with bindings substituted server-side for named parameters in the script (e.g. 'g.V(id)' with { id: '1' }) — the standard way to parameterize Gremlin script text without string-concatenating untrusted values into it.

      Type Parameters

      • T = unknown

      Parameters

      • script: string
      • bindings: Record<string, unknown> = {}

      Returns Promise<T[]>

    • addV(label) + a property(key, value) step per entry in properties, returning the created vertex via elementMap().

      Type Parameters

      • P extends Record<string, unknown> = Record<string, unknown>

      Parameters

      • label: string
      • properties: Record<string, unknown> = {}

      Returns Promise<NeptuneVertex<P>>

    • g.V(id).elementMap().next() — returns undefined if no vertex with that ID exists.

      Type Parameters

      • P extends Record<string, unknown> = Record<string, unknown>

      Parameters

      Returns Promise<NeptuneVertex<P> | undefined>

    • g.V(id) + a property(key, value) step per entry in properties (existing properties keep their value unless overwritten here), returning the updated vertex.

      Type Parameters

      • P extends Record<string, unknown> = Record<string, unknown>

      Parameters

      • id: NeptuneId
      • properties: Record<string, unknown>

      Returns Promise<NeptuneVertex<P> | undefined>

    • g.V(id).drop().iterate() — also drops any incident edges (Neptune cascades edge drops when their vertex is dropped). No-op (does not throw) if the vertex doesn't exist.

      Parameters

      Returns Promise<void>

    • g.V(fromId).addE(label).to(statics.V(toId)) + a property(key, value) step per entry in properties, returning the created edge via elementMap(). Throws a NeptuneError if fromId/toId don't resolve to existing vertices (same as real Gremlin addE/to).

      Type Parameters

      • P extends Record<string, unknown> = Record<string, unknown>

      Parameters

      Returns Promise<NeptuneEdge<P>>

    • g.E(id).elementMap().next() — returns undefined if no edge with that ID exists.

      Type Parameters

      • P extends Record<string, unknown> = Record<string, unknown>

      Parameters

      Returns Promise<NeptuneEdge<P> | undefined>

    • g.V(id).out(edgeLabel) (or .in_()/.both() per options.direction, default 'out'), projected with elementMap(). The common "one-hop neighbors" query — for multi-hop traversals, path-finding, or anything else Gremlin's step library covers beyond one hop, use traversal() directly.

      Type Parameters

      • P extends Record<string, unknown> = Record<string, unknown>

      Parameters

      Returns Promise<NeptuneVertex<P>[]>