Skip to content

Commit 49685dc

Browse files
committed
feat: gremlin.js browser support
- Replace node APIs that have cross runtime equivalent - For those that can't be replaced, use `node:` prefix so that environment that does polyfill automatically can easily do so - Remove manual ping/pong logic, this is already handled internally by browser or `ws` library
1 parent a8f90ea commit 49685dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+655
-329
lines changed

gremlin-javascript/src/main/javascript/gremlin-javascript/.eslintrc.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,17 @@
2222
module.exports = {
2323
env: {
2424
commonjs: true,
25-
es6: true,
25+
es2022: true,
2626
node: true,
2727
},
2828
parserOptions: {
29-
ecmaVersion: 2021,
29+
ecmaVersion: 2022,
3030
},
3131
ignorePatterns: ['test/**/*.js', 'doc/**/*.js'],
3232
extends: ['eslint:recommended', 'prettier'],
3333
plugins: ['prettier'],
3434
rules: {
3535
'prettier/prettier': ['error', { endOfLine: 'auto' }],
36-
indent: ['error', 2, { SwitchCase: 1 }],
3736
'linebreak-style': 0,
3837
quotes: ['error', 'single'],
3938
semi: ['error', 'always'],
@@ -128,7 +127,7 @@ module.exports = {
128127
'require-atomic-updates': 'off',
129128
},
130129
globals: {
131-
Buffer: false,
130+
Buffer: 'off',
132131
Promise: true,
133132
Symbol: false,
134133
Uint16Array: false,

gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/auth/mechanisms/sasl-mechanism-plain.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
'use strict';
2020

21+
const { Buffer } = require('buffer');
2122
const SaslMechanismBase = require('./sasl-mechanism-base');
2223

2324
class SaslMechanismPlain extends SaslMechanismBase {

gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/client.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ class Client {
4343
* @param {Boolean} [options.enableUserAgentOnConnect] Determines if a user agent will be sent during connection handshake. Defaults to: true
4444
* @param {String} [options.processor] The name of the opProcessor to use, leave it undefined or set 'session' when session mode.
4545
* @param {String} [options.session] The sessionId of Client in session mode. Defaults to null means session-less Client.
46-
* @param {Boolean} [options.pingEnabled] Setup ping interval. Defaults to: true.
47-
* @param {Number} [options.pingInterval] Ping request interval in ms if ping enabled. Defaults to: 60000.
48-
* @param {Number} [options.pongTimeout] Timeout of pong response in ms after sending a ping. Defaults to: 30000.
4946
* @param {http.Agent} [options.agent] The http.Agent implementation to use.
5047
* @constructor
5148
*/

0 commit comments

Comments
 (0)