profile
viewpoint
Evan Weaver evan @fauna San Francisco https://fauna.com CTO @ Fauna

arthurnn/memcached 425

A Ruby interface to the libmemcached C client

evan/has_many_polymorphs 201

An ActiveRecord plugin for self-referential and double-sided polymorphic associations.

evan/bleak_house 188

A Ruby library for finding memory leaks

evan/echoe 82

A Rubygems packaging tool that provides Rake tasks for documentation, extension compiling, testing, and deployment

evan/interlock 76

A Rails plugin for maintainable and high-efficiency caching

evan/ccsv 64

A pure-C CSV parser for Ruby

emaland/zookeeper_client 30

Ruby wrapper for the ZooKeeper C client library

evan/allison 11

A modern, pretty RDoc template

evan/benchmark_unit 7

Machine-independent benchmark assertions for your Ruby unit tests

pull request commentfauna/faunadb-go

fix: clean module file.

BTW @ldez, I'm sorry for the late reply. As a side note, it looks like #126 also removes the unnecessary dependency.

ldez

comment created time in 5 hours

push eventfauna/faunadb-js

SZinkevych

commit sha 16a4bdfdb5b377ba98d56e1b27e3869e327ca899

DRV-376 Fix request timeout

view details

SZinkevych

commit sha f913e0c7ea908e2a60b624cfd239794cef7b9988

remove unnecessary anonymous function

view details

tigger9flow

commit sha b7ab42695b1115cbe8d84be566248dd97e60a3f7

Merge pull request #381 from fireridlle/fix/DRV-376_request_timeout DRV-376 Fix request timeout

view details

push time in 7 hours

PR merged fauna/faunadb-js

Reviewers
DRV-376 Fix request timeout

Notes

Jira Ticket Current driver pass a 60 seconds timeout down to the cross-fetch polyfill. However, neither whatwg-fetch of node-fetch are aware of it. They both support abort signals, though: https://github.com/node-fetch/node-fetch#request-cancellation-with-abortsignal.

Screenshots

image

+48 -12

0 comment

2 changed files

fireridlle

pr closed time in 7 hours

Pull request review commentfauna/fauna-shell

DRV-384 | fix: fauna list-keys throws an error when there are no keys

 function buildTable(res) {   const table = getTable()   res.data.sort(compareByDBName)   res.data.forEach(function (el) {-    table.push([el.ref.id, el.database.id, el.role])+    const dbName = el.name+    if (el.keys.data.length > 0) {+      el.keys.data.forEach(function (key) {+        table.push([key.id, dbName, key.role])+      })+    } else {+      table.push(['No keys created', dbName, '-'])+    }   })   return table }  /**-* Despite its name, returns the first 1000 keys defined on the Database.-* "1000 keys ought to be enough for anybody".-*/-function allKeysQuery(q) {-  return q.Map(q.Paginate(q.Keys(null), {size: 1000}), q.Lambda('x', q.Get(q.Var('x'))))+ * Returns the first 100 keys defined on the current Database.+ * "100 keys ought to be enough for anybody".+ */+function currentDbKeysQuery(q) {+  return q.Let(+    {},+    {+      name: '[current]',+      keys: q.Map(+        q.Paginate(q.Keys(), {size: 100}),+        q.Lambda('key',+          q.Let(+            {+              keyDoc: q.Get(q.Var('key')),+            },+            {+              id: q.Select(['ref', 'id'], q.Var('keyDoc')),+              role: q.Select(['role'], q.Var('keyDoc')),+            }+          )+        )+      ),+    }+  )+}++/**+ * Returns the first 100 keys defined per child Database within the current one.+ * "100 keys ought to be enough for anybody".+ * In a similar fashion a limit is set up for the first 100 children of the current Database.+ */+function childrenDbKeysQuery(q) {+  return q.Map(+    q.Paginate(q.Databases(), {size: 100}),+    q.Lambda('db',+      q.Let(+        {+          dbDoc: q.Get(q.Var('db')),+        },+        {+          name: q.Select(['name'], q.Var('dbDoc')),+          keys: q.Map(+            q.Paginate(q.Keys(q.Database(q.Select(['name'], q.Var('dbDoc')))), {size: 100}),+            q.Lambda('key',+              q.Let(+                {+                  keyDoc: q.Get(q.Var('key')),+                },+                {+                  id: q.Select(['ref', 'id'], q.Var('keyDoc')),+                  role: q.Select(['role'], q.Var('keyDoc')),+                }+              )+            )+          ),+        }+      )+    )+  ) }  class ListKeysCommand extends FaunaCommand {   async run() {     const log = this.log-    return this.withClient(function (client, _) {-      log('listing keys')-      return client.query(allKeysQuery(q))-      .then(function (res) {-        if (res.data.length > 0) {-          log(buildTable(res).toString())+    return this.withClient(async function (client, _) {+      try {+        // retrieving current db keys+        const currentDb = await client.query(currentDbKeysQuery(q))

Promise.all can be used to make it more efficient by running in parallel:

const [currentDb, childDbs] = await Promise.all([
  client.query(currentDbKeysQuery(q)),
  client.query(childrenDbKeysQuery(q)),
])
parkhomenko

comment created time in 8 hours

Pull request review commentfauna/faunadb-go

DRV-395: Add http/2 support to golang driver

 func NewFaunaClient(secret string, configs ...ClientConfig) *FaunaClient { 	}  	if client.http == nil {+		dial := func(network, addr string, cfg *tls.Config) (net.Conn, error) {+			return net.Dial(network, addr)+		}+		if len(client.endpoint) > 5 && client.endpoint[:5] == "https" {+			dial = nil+		}+		transport := &http2.Transport{+			DialTLS:   dial,+			AllowHTTP: true,+		}+ 		client.http = &http.Client{-			Timeout: requestTimeout,

I was thinking about streaming when removed this timeout. I will return timeout for all requests by default.

vadimLF

comment created time in 9 hours

pull request commentfauna/faunadb-go

fix: clean module file.

@erickpintor friendly ping.

ldez

comment created time in 19 hours

Pull request review commentfauna/faunadb-go

DRV-395: Add http/2 support to golang driver

 func NewFaunaClient(secret string, configs ...ClientConfig) *FaunaClient { 	}  	if client.http == nil {+		dial := func(network, addr string, cfg *tls.Config) (net.Conn, error) {+			return net.Dial(network, addr)+		}+		if len(client.endpoint) > 5 && client.endpoint[:5] == "https" {+			dial = nil+		}+		transport := &http2.Transport{+			DialTLS:   dial,+			AllowHTTP: true,+		}+ 		client.http = &http.Client{-			Timeout: requestTimeout,

Does this mean we're no longer enforcing requests timeout?

vadimLF

comment created time in a day

PR opened fauna/fauna-shell

DRV-384 | fix: fauna list-keys throws an error when there are no keys

Notes

Jira Ticket

How to test

  1. Go to /fauna-shell in your terminal
  2. Run bin/run cloud-login
  3. Run bin/run list-keys with appropriate options for your current database
  4. Confirm that you see information about keys for your current database and its children provided you have created some children databases and secret keys

Screenshots

image

+103 -24

0 comment

3 changed files

pr created time in a day

Pull request review commentfauna/faunadb-js

Fix for stringification to FQL which inserted nulls for zero-argument AND expose toFQL

 var exprToString = function(expr, caller) {   var fn = keys[0]   fn = convertToCamelCase(fn) -  var args = keys.map(function(k) {+  var args = []++  keys.forEach(function(k) {

Up to you, your approach is indeed cleaner and readability is important :)

fauna-brecht

comment created time in a day

Pull request review commentfauna/faunadb-go

DRV-182: Add access provider functions

 func TestSerializeCreateRole(t *testing.T) { 	) } +func TestSerializeCreateAccessProvider(t *testing.T) {+	assertJSON(t,+		CreateAccessProvider(Obj{+			"name":     "a_provider",+			"issuer":   "supported_issuer",+			"jwks_uri": "https://xxxx.auth0.com",+		}),+		`{"create_access_provider":{"object":{"name":"a_provider","issuer":`++			`"supported_issuer","jwks_uri":"https://xxxx.auth0.com"}}}`,+	)++	assertJSON(t,+		CreateAccessProvider(Obj{+			"name":                "a_provider",+			"issuer":              "supported_issuer",+			"jwks_uri":            "https://xxxx.auth0.com",+			"allowed_roles":       Arr{"roles"},+			"allowed_collections": Arr{Collection("col")},

allowed_roels and allowed_collections is not valid fields

trevorsibanda

comment created time in 2 days

pull request commentfauna/vscode

FE-938 Update extension to match new branding

@ryancharris thank you for the review. pushed fixes for all comments

fireridlle

comment created time in 2 days

issue closedfauna/faunadb-js

Fix example code typo in `README.md`

There appears to be a typo in README.md, under the 'Connecting from the browser' heading. client.query(...).then(...) is called, followed by a.catch. As far as I can tell, a is undefined. I believe the .catch should be chained to the aforementioned .then.

closed time in 2 days

JDDurrant

pull request commentfauna/vscode

FE-938 Update extension to match new branding

@fireridlle Would you mind adding a screenshot of the logo in the VS Code sidebar to the PR description? Thanks! sure, i also update screnshoots for readme

fireridlle

comment created time in 2 days

Pull request review commentfauna/vscode

FE-938 Update extension to match new branding

 {-  "name": "faunadb",-  "displayName": "FaunaDB",-  "description": "FaunaDB extension",-  "icon": "media/faunadb-extension-logo.png",+  "name": "fauna",

We should leave this as faunadb because this is the namespace we publish to on NPM. Unfortunately, there is another project currently using fauna, so we may be stick with this.

fireridlle

comment created time in 2 days

Pull request review commentfauna/vscode

FE-938 Update extension to match new branding

+<?xml version="1.0" encoding="utf-8"?>+<!-- Generator: Adobe Illustrator 24.3.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->

You can remove these lines 👍

fireridlle

comment created time in 2 days

pull request commentfauna/vscode

FE-938 Update extension to match new branding

I don't think we want to commit .DS_STORE to git here.

fireridlle

comment created time in 2 days

pull request commentfauna/vscode

FE-938 Update extension to match new branding

@fireridlle Would you mind adding a screenshot of the logo in the VS Code sidebar to the PR description? Thanks!

fireridlle

comment created time in 2 days

PR opened fauna/faunadb-js

DRV-365 handle stream end the same fashion as for browser

Notes

Stream termination due to core's one-hour limit does not cause an error event

stream throw end event for nodejs and error event for the browser (tested at chrome). i suppose it would be a good idea if the driver will silently reconnect when such a case raised.

however, i faced another issue, the server closed stream in case the subscribed document hasn’t been updated for about a minute.

to simulate the same behaviour as for browser, fix listen for end event and as soon as the event appears, fix convert it to an error event.

for future, i would suggest increasing server timeout for inactivity

How to test

const faunadb = require('./index')
const q = faunadb.query
const util = require('util')

var client = new faunadb.Client({
  secret: 'XXXXXX'
})

;(async () => {
  await client.query(
  q.Paginate(q.Collections())
  )
  .then(ret => console.log(ret))
  .catch(err => console.error('Error: %s', err))
})()

var stream
function startStream() {
  stream = client.stream.document(q.Ref(q.Collection('Status'),
  '278763355019149825'))
  .on('snapshot', snapshot => {
    const m = util.inspect(snapshot, { showHidden: false, depth: null })
    console.log(m)
  })
  .on('version', version => {
    const m = util.inspect(version, { showHidden: false, depth: null })
    console.log(m)
    console.log(stream._client._state)
  })
  .on('error', error => console.error('Error: %s', error))
  .start()
}

Screenshots

+12 -1

0 comment

1 changed file

pr created time in 2 days

PR opened fauna/faunadb-go

Reviewers
Added http/2 support
  • Adds golang.org/x/net/http2 module for HTTP/2 support
  • Switch to http2.Transport for all requests.
+24 -8

0 comment

3 changed files

pr created time in 2 days

push eventfauna/faunadb-js

Artyom Kurnikov

commit sha 630317d5063007061d12428347a000cd781d4401

DRV-369: get rid of util nodejs package

view details

tigger9flow

commit sha d640e876681ae668e405fba6e34f107b73a8a0ae

Merge pull request #382 from fauna/DRV-369/get-rid-of-util-package DRV-369: get rid of util nodejs package

view details

push time in 2 days

PR merged fauna/faunadb-js

Reviewers
DRV-369: get rid of util nodejs package

Notes

Jira Ticket NodeJS util package has been used for .inherits and .inspect functions. Current implementation supposes polyfilling .inherits function by created one in src/_util.js and optionally using .inspect only when we're running on NodeJS environment

How to test

No features / fixes have been introduced. Can be tested regression-wise

+45 -5

0 comment

4 changed files

tigger9flow

pr closed time in 2 days

Pull request review commentfauna/vscode

DRV-390 Can’t run multi line queries

 function baseEvalFQL(fql: string, q: typeof query) {   return fql.match(/^\s*{(.*\n*)*}\s*$/) ? eval(`(${fql})`) : eval(fql); } -function splitQueries(code: string): string[] {-  return code-    .split(new RegExp(/(?:;|\n)/g))-    .filter((item) => item.trim().length > 0)-    .map((item) => item.trim());++function parseQueries(code: string): string[] {+  const brackets: Record<string, string> = {+      '{': '}',+      '(': ')',+      '[': ']',+      '"': '"',+      '\'': '\'',+  }+  const openBrackets = new Set(Object.keys(brackets))+  const closeBrackets = new Set(Object.values(brackets))+  const queries = [];+  const stack = [];+  let start = 0;+  let isOpening;+  code = code.trim();++  for (let i = 0; i < code.length; i++) {+      if(openBrackets.has(code[i])){+          stack.push(code[i]);+          isOpening = true;+      }++      if(closeBrackets.has(code[i]) && brackets[stack.pop()!] !== code[i]){+          throw new Error(`Unexpected closing bracket ${code[i]} at position: ${i + 1}`)+      }++      if(stack.length === 0 && isOpening) {+        queries.push(code.slice(start, i + 1));+          start = i + 1;+          isOpening = false;+      }+  }+  return queries; }  export function runFQLQuery(code: string, client: Client) {-  if (!code.trim()) {-    return Promise.reject("Can not eval empty query.");-  }   try {-    const queriesArray = splitQueries(code)+    const queriesArray = parseQueries(code)+    if(queriesArray.length ===0){

Just a small one, there should be a space after the "===", and I notice there are spaces after "if"s as well. Don't think it should be corrected here, but in my opinion, it would be nice to have some style checker as a separate task/PR. No need to it right now though.

fireridlle

comment created time in 2 days

Pull request review commentfauna/faunadb-js

DRV-369: get rid of util nodejs package

 'use strict' +/**+ * Inherit the prototype methods from one constructor into another.+ * @param {function} ctor Constructor function which needs to inherit the prototype.+ * @param {function} superCtor Constructor function to inherit prototype from.+ * @private+ */+function inherits(ctor, superCtor) {

Added link to polyfill repo

tigger9flow

comment created time in 3 days

Pull request review commentfauna/faunadb-js

DRV-369: get rid of util nodejs package

 'use strict' +/**+ * Inherit the prototype methods from one constructor into another.+ * @param {function} ctor Constructor function which needs to inherit the prototype.+ * @param {function} superCtor Constructor function to inherit prototype from.+ * @private+ */+function inherits(ctor, superCtor) {+  if (ctor === undefined || ctor === null) {+    throw new TypeError(+      'The constructor to "inherits" must not be ' + 'null or undefined'

Thanks for pointing, removed unnecessary concatenation

tigger9flow

comment created time in 3 days

push eventfauna/faunadb-js

Artyom Kurnikov

commit sha 630317d5063007061d12428347a000cd781d4401

DRV-369: get rid of util nodejs package

view details

push time in 3 days

Pull request review commentfauna/faunadb-js

DRV-369: get rid of util nodejs package

 'use strict' +/**+ * Inherit the prototype methods from one constructor into another.+ * @param {function} ctor Constructor function which needs to inherit the prototype.+ * @param {function} superCtor Constructor function to inherit prototype from.+ * @private+ */+function inherits(ctor, superCtor) {

Was this polyfill copied from somewhere? If so, could you add a link to it in the function docs?

tigger9flow

comment created time in 3 days

Pull request review commentfauna/faunadb-js

DRV-369: get rid of util nodejs package

 'use strict' +/**+ * Inherit the prototype methods from one constructor into another.+ * @param {function} ctor Constructor function which needs to inherit the prototype.+ * @param {function} superCtor Constructor function to inherit prototype from.+ * @private+ */+function inherits(ctor, superCtor) {+  if (ctor === undefined || ctor === null) {+    throw new TypeError(+      'The constructor to "inherits" must not be ' + 'null or undefined'

(there's two more occurrences bellow)

tigger9flow

comment created time in 3 days

Pull request review commentfauna/faunadb-js

DRV-369: get rid of util nodejs package

 'use strict' +/**+ * Inherit the prototype methods from one constructor into another.+ * @param {function} ctor Constructor function which needs to inherit the prototype.+ * @param {function} superCtor Constructor function to inherit prototype from.+ * @private+ */+function inherits(ctor, superCtor) {+  if (ctor === undefined || ctor === null) {+    throw new TypeError(+      'The constructor to "inherits" must not be ' + 'null or undefined'

What's the reason for the concatenation here?

tigger9flow

comment created time in 3 days

PR opened fauna/vscode

DRV-390 Can’t run multi line queries

The issue here that the plugin support executing multiple queries by writing query per line or separate them using ; https://github.com/fauna/vscode/blob/master/src/fql.ts#L226

The fix is to remove \n as a query separator. the plugin still able to handle multiple queries with ; for example

Paginate(
  Collections()
);
Paginate(Indexes())
+4 -3

0 comment

1 changed file

pr created time in 3 days

more