New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

gremlin-serverless

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gremlin-serverless

A stateless Gremlin driver of Apache TinkerPop™ , optimized for serverless functions

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

gremlin-serverless

A stateless Gremlin driver of Apache TinkerPop™ , optimized for serverless functions.

Installation

npm install gremlin-serverless --save

Introduction

gremlin-serverless is a simple wrapper of Websocket using rxjs observable.
Socket will close on error and success, this way serverless functions could execute a statless query.

Usage

Socket endpoint address should be provided with protocol, port and path embedded. Note the /gremlin, see Revised URL for websockets in 3.2.2

import { createClient } from "gremlin-serverless";

/**
 * Microsoft Azure exmaple
 * Gremlin Endpoint
 * https://exmaple.gremlin.cosmosdb.azure.com:443/
 */
const execute = createClient({
    address: "wss://exmaple.gremlin.cosmosdb.azure.com:443/gremlin",
    username: "user",
    password: "pwd"
});

const testmsg = {
    requestId: uuid.v1(),
    processor: "",
    op: "eval",
    args: {
        gremlin: "g.V()",
        bindings: {},
        accept: "application/json",
        language: "gremlin-groovy"
    }
};
const result$ = execute(testmsg)
const disposable = result$.subscribe(
    ... //rxjs subscription
)

Error handling

Server response with statuscode other than success will be treated as error, a 'response' property will contain the response.

{ Error: Execution failed
        at ...
      response:
       { requestId: '4085bf30',
         status:
          { code: 597,
            attributes: [Object],
            message: '\r\n\nActivityId : 6cad836f-3c\nExceptionType :GraphCompileException\nExceptionMessage :\r\n\tGremlin Query Compilation Error: Script compileerror: Missing \')\' @ line 1, column 4.\nSource : Graphs\n\tGremlinRequestId : 6cad836f-\n\tContext : graphcompute\n\tScope : graphparse-translate-outer\n\tGraphStatusCode : ScriptEvaluationError\n\tHResult : 0x80131500\r\n' },
         result: { data: null, meta: {} } } }

Keywords

serverless

FAQs

Package last updated on 08 Apr 2018

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