Giter Club home page Giter Club logo

cli's People

Contributors

aboglioli avatar dtinth avatar fraxedas avatar jacoblee93 avatar jhult avatar keithwhor avatar louislarry avatar michaelrambeau avatar nemo avatar notoriaga avatar oehc avatar unional avatar watilde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cli's Issues

"no env.json detected message" appears when invoking f from a different directory

When invoking a service using f (example: f thisdavej/test) from a different directory than my microservice directory, a warning message appears indicating that "no env.json detected".

I recognize the intent of this message; however, I think the most common use case for f will be users invoking f from the command line to utilize various microservices—and this error message will not be meaningful to them, and will be a distraction.

I'm thinking the error message only makes sense when invoking microservices on the local machine using f . and thus the message should not appear otherwise. If there are other contexts where it is useful, perhaps you could include a --verbose flag that could be used by developers for troubleshooting purposes to help guide and notify them that the env.json file could not be found.

Error on `lib init`

I got this error. Looks probably because of node.js version, but how do I do for this?

 $ lib init
/Users/izumisy/.nvm/versions/node/v4.5.0/lib/node_modules/lib/cli/error_log.js:8
    let details = err.details[k];
    ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/izumisy/.nvm/versions/node/v4.5.0/lib/node_modules/lib/cli/commands/login.js:6:18)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
 $ node --version
v4.5.0

Do you use AWS Lambda?

Hello team!

Just curious, are you using AWS Lambda underneath? If so, I saw that you were supporting Node 6, do you use a shim like in Apex to make Lambda support it?

How to setup local development without internet

I would like to serve f in my localhost 8080 environment without using stdlib gateway eg. offline.
Do I need to setup nodejs hosting/gateway/bridge myself and call f functions or there is something already done ?

`414 Request-URI Too Large` on stdlib service page instead of readme.md

After using lib release to push a new version of the readme file for my stdlib project, I see a 414 Nginx error when viewing the service at https://stdlib.com/services/brozeph/chess.

screen shot 2016-11-22 at 4 26 25 pm

The contents of my readme are as follows (it is quite verbose...):

Chess Board Service

This service exists to validate and track board movements and provide a valid set of moves (in Algebraic Notation) for the consumer. The underlying functionality is provided by the open source NPM module, chess.

Parameters

Keyword arguments

  • stateCode - this is the identifer for the board at the current state (this value is returned as stateCode after each move)
  • notation - the notation for the next move to apply to the board

Usage

When an initial request is made to the API with no keyword arguments specified (stateCode or notation), a new game will be created and a response is returned highlighting available moves for the white side to make. The stateCode returned in the response represents that board at that state (for a new game, this value of stateCode is cWFtVUExd0hFUFBhd2RDSzFMMUtZQT09).

In order to make a subsequent move, the stateCode of the game along with the appropriate notation value must be supplied to the service. This will return a response with a new stateCode that must be used in conjunction with the next move to continue to move pieces on the game's board.

All requests to the service will result in either the creation of a new game board or continuation of an existing game board. Each response will contain the following top-level properties (in a JSON payload):

  • stateCode - the identifier required to resume the game at the current state (this value changes after each move)
  • notations
    • { algebraic notation of move } (i.e. a4, Nf3, etc.)
      • src
        • file - the file where the piece that can be moved currently sits (a, b, c, d, e, f or g)
        • rank - the rank where the piece that can be moved currently sites (1, 2, 3, 4, 5, 6, 7 or 8)
        • piece
          • moveCount - a number representing the number of times the piece has been moved
          • side
            • name - a string indicating the color of the piece: white or black
          • type - a string indicating the type of the piece: pawn, bishop, knight, rook, queen or king
      • dest
        • file - the file where the piece that can be moved would move to (a, b, c, d, e, f or g)
        • rank - the rank where the piece that can be moved would move to (1, 2, 3, 4, 5, 6, 7 or 8)
        • piece
          • moveCount - a number representing the number of times the piece has been moved
          • side
            • name - a string indicating the color of the piece: white or black
          • type - a string indicating the type of the piece: pawn, bishop, knight, rook, queen or king
  • history - an array of objects with the following properties:
    • capturedPiece - if a piece was captured, it would be noted here
    • hashCode - the identifier of the board piece position after this move
    • algebraic - the algebraic notation of the move
    • promotion - true or false depending on whether the move resulted in a promotion of a piece
    • piece
      • moveCount - a number representing the number of times the piece has been moved
      • side
        • name - a string indicating the color of the piece: white or black
      • type - a string indicating the type of the piece: pawn, bishop, knight, rook, queen or king
    • prevFile - the previous file where the piece once lived prior to the move
    • prevRank - the previous rank where the piece once lived prior to the move
    • postFile - the file where the piece lives after the move
    • postRank - the rank where the piece lives after the move
  • squares - an array of objects with the following properties
    • file - a lower case letter value that notes the column of the chess board: a, b, c, d, e, f or g, h
    • rank - a number that notes the row of chess board: 1, 2, 3, 4, 5, 6, 7 or 8
    • piece - an object that represents the piece
      • moveCount - a number representing the number of times the piece has been moved
      • side
        • name - a string indicating the color of the piece: white or black
      • type - a string indicating the type of the piece: pawn, bishop, knight, rook, queen or king
  • state
    • check - true or false indicating whether or not a King on the board is in check
    • mate - true or false indicating whether or not a King on the board is in check mate
    • repetition - true or false indicating whether a 3 fold repetition has occurred on the board
    • stalemate - true or false indicating whether or not the board is in stalemate

Command line

Each call returns a JSON payload that provides insight into available moves (notations), the history of moves to this point (history), each square on the board (squares), the current state of the game (state) and an identifier necessary for making the next move (stateCode).

f brozeph/chess/game --stateCode "anBwRVB3RkdxVXR0L00wN3JFTmV2UT09OmIz" --notation a5

The above command returns the following:

{
  "stateCode": "dlNRWDhtalVSaUpiVnFWVnQzVDNndz09OmIzOmE1",
  "notations": {
    "Na3": {
      "src": {
        "file": "b",
        "rank": 1,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "knight",
          "notation": "N"
        }
      },
      "dest": {
        "file": "a",
        "rank": 3,
        "piece": null
      }
    },
    "Nc3": {
      "src": {
        "file": "b",
        "rank": 1,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "knight",
          "notation": "N"
        }
      },
      "dest": {
        "file": "c",
        "rank": 3,
        "piece": null
      }
    },
    "Bb2": {
      "src": {
        "file": "c",
        "rank": 1,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "bishop",
          "notation": "B"
        }
      },
      "dest": {
        "file": "b",
        "rank": 2,
        "piece": null
      }
    },
    "Ba3": {
      "src": {
        "file": "c",
        "rank": 1,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "bishop",
          "notation": "B"
        }
      },
      "dest": {
        "file": "a",
        "rank": 3,
        "piece": null
      }
    },
    "Nf3": {
      "src": {
        "file": "g",
        "rank": 1,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "knight",
          "notation": "N"
        }
      },
      "dest": {
        "file": "f",
        "rank": 3,
        "piece": null
      }
    },
    "Nh3": {
      "src": {
        "file": "g",
        "rank": 1,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "knight",
          "notation": "N"
        }
      },
      "dest": {
        "file": "h",
        "rank": 3,
        "piece": null
      }
    },
    "a3": {
      "src": {
        "file": "a",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "a",
        "rank": 3,
        "piece": null
      }
    },
    "a4": {
      "src": {
        "file": "a",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "a",
        "rank": 4,
        "piece": null
      }
    },
    "c3": {
      "src": {
        "file": "c",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "c",
        "rank": 3,
        "piece": null
      }
    },
    "c4": {
      "src": {
        "file": "c",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "c",
        "rank": 4,
        "piece": null
      }
    },
    "d3": {
      "src": {
        "file": "d",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "d",
        "rank": 3,
        "piece": null
      }
    },
    "d4": {
      "src": {
        "file": "d",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
          "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "d",
        "rank": 4,
        "piece": null
      }
    },
    "e3": {
      "src": {
        "file": "e",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "e",
        "rank": 3,
        "piece": null
      }
    },
    "e4": {
      "src": {
        "file": "e",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "e",
        "rank": 4,
        "piece": null
      }
    },
    "f3": {
      "src": {
        "file": "f",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "f",
        "rank": 3,
        "piece": null
      }
    },
    "f4": {
      "src": {
        "file": "f",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "f",
        "rank": 4,
        "piece": null
      }
    },
    "g3": {
      "src": {
        "file": "g",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
        "dest": {
        "file": "g",
        "rank": 3,
        "piece": null
      }
    },
    "g4": {
      "src": {
        "file": "g",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "g",
        "rank": 4,
        "piece": null
      }
    },
    "h3": {
      "src": {
        "file": "h",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "h",
        "rank": 3,
        "piece": null
      }
    },
    "h4": {
      "src": {
        "file": "h",
        "rank": 2,
        "piece": {
          "moveCount": 0,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "h",
        "rank": 4,
        "piece": null
      }
    },
    "b4": {
      "src": {
        "file": "b",
        "rank": 3,
        "piece": {
          "moveCount": 1,
          "side": {
            "name": "white"
          },
          "type": "pawn",
          "notation": ""
        }
      },
      "dest": {
        "file": "b",
        "rank": 4,
        "piece": null
      }
    }
  },
  "history": [
    {
      "capturedPiece": null,
      "hashCode": "jppEPwFGqUtt/M07rENevQ==",
      "algebraic": "b3",
      "promotion": false,
      "piece": {
        "moveCount": 1,
        "side": {
          "name": "white"
        },
        "type": "pawn",
        "notation": ""
      },
      "prevFile": "b",
      "prevRank": 2,
      "postFile": "b",
      "postRank": 3
    },
    {
      "capturedPiece": null,
      "hashCode": "vSQX8mjURiJbVqVVt3T3gw==",
      "algebraic": "a5",
      "promotion": false,
      "piece": {
        "moveCount": 1,
        "side": {
          "name": "black"
        },
        "type": "pawn",
        "notation": ""
      },
      "prevFile": "a",
      "prevRank": 7,
      "postFile": "a",
      "postRank": 5
    }
  ],
  "squares": [
    {
      "file": "a",
      "rank": 1,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "rook",
        "notation": "R"
      }
    },
    {
      "file": "b",
      "rank": 1,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "knight",
        "notation": "N"
      }
    },
    {
      "file": "c",
      "rank": 1,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "bishop",
        "notation": "B"
      }
    },
    {
      "file": "d",
      "rank": 1,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "queen",
        "notation": "Q"
      }
    },
    {
      "file": "e",
      "rank": 1,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "king",
        "notation": "K"
      }
    },
    {
      "file": "f",
      "rank": 1,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "bishop",
        "notation": "B"
      }
    },
    {
      "file": "g",
      "rank": 1,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "knight",
        "notation": "N"
      }
    },
    {
      "file": "h",
      "rank": 1,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "rook",
        "notation": "R"
      }
    },
    {
      "file": "a",
      "rank": 2,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "b",
      "rank": 2,
      "piece": null
    },
    {
      "file": "c",
      "rank": 2,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "d",
      "rank": 2,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "e",
      "rank": 2,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "f",
      "rank": 2,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "g",
      "rank": 2,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "h",
      "rank": 2,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "white"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "a",
      "rank": 3,
      "piece": null
    },
    {
      "file": "b",
      "rank": 3,
      "piece": {
        "moveCount": 1,
        "side": {
          "name": "white"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "c",
      "rank": 3,
      "piece": null
    },
    {
      "file": "d",
      "rank": 3,
      "piece": null
    },
    {
      "file": "e",
      "rank": 3,
      "piece": null
    },
    {
      "file": "f",
      "rank": 3,
      "piece": null
    },
    {
      "file": "g",
      "rank": 3,
      "piece": null
    },
    {
      "file": "h",
      "rank": 3,
      "piece": null
    },
    {
      "file": "a",
      "rank": 4,
      "piece": null
    },
    {
      "file": "b",
      "rank": 4,
      "piece": null
    },
    {
      "file": "c",
      "rank": 4,
      "piece": null
    },
    {
      "file": "d",
      "rank": 4,
      "piece": null
    },
    {
      "file": "e",
      "rank": 4,
      "piece": null
    },
    {
      "file": "f",
      "rank": 4,
      "piece": null
    },
    {
      "file": "g",
      "rank": 4,
      "piece": null
    },
    {
      "file": "h",
      "rank": 4,
      "piece": null
    },
    {
      "file": "a",
      "rank": 5,
      "piece": {
        "moveCount": 1,
        "side": {
          "name": "black"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "b",
      "rank": 5,
      "piece": null
    },
    {
      "file": "c",
      "rank": 5,
      "piece": null
    },
    {
      "file": "d",
      "rank": 5,
      "piece": null
    },
    {
      "file": "e",
      "rank": 5,
      "piece": null
    },
    {
      "file": "f",
      "rank": 5,
      "piece": null
    },
    {
      "file": "g",
      "rank": 5,
      "piece": null
    },
    {
      "file": "h",
      "rank": 5,
      "piece": null
    },
    {
      "file": "a",
      "rank": 6,
      "piece": null
    },
    {
      "file": "b",
      "rank": 6,
      "piece": null
    },
    {
      "file": "c",
      "rank": 6,
      "piece": null
    },
    {
      "file": "d",
      "rank": 6,
      "piece": null
    },
    {
      "file": "e",
      "rank": 6,
      "piece": null
    },
    {
      "file": "f",
      "rank": 6,
      "piece": null
    },
    {
      "file": "g",
      "rank": 6,
      "piece": null
    },
    {
      "file": "h",
      "rank": 6,
      "piece": null
    },
    {
      "file": "a",
      "rank": 7,
      "piece": null
    },
    {
      "file": "b",
      "rank": 7,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "c",
      "rank": 7,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "d",
      "rank": 7,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "e",
      "rank": 7,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "f",
      "rank": 7,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "g",
      "rank": 7,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "h",
      "rank": 7,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "pawn",
        "notation": ""
      }
    },
    {
      "file": "a",
      "rank": 8,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "rook",
        "notation": "R"
      }
    },
    {
      "file": "b",
      "rank": 8,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "knight",
        "notation": "N"
      }
    },
    {
      "file": "c",
      "rank": 8,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "bishop",
        "notation": "B"
      }
    },
    {
      "file": "d",
      "rank": 8,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "queen",
        "notation": "Q"
      }
    },
    {
      "file": "e",
      "rank": 8,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "king",
        "notation": "K"
      }
    },
    {
      "file": "f",
      "rank": 8,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "bishop",
        "notation": "B"
      }
    },
    {
      "file": "g",
      "rank": 8,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "knight",
        "notation": "N"
      }
    },
    {
      "file": "h",
      "rank": 8,
      "piece": {
        "moveCount": 0,
        "side": {
          "name": "black"
        },
        "type": "rook",
        "notation": "R"
      }
    }
  ],
  "state": {
    "check": false,
    "mate": false,
    "repetition": false,
    "stalemate": false
  }
}

HTTP GET

To create a new game:

curl https://f.stdlib.com/brozeph/chess/game

To make a move:

curl https://f.stdlib.com/brozeph/chess/game?stateCode=anBwRVB3RkdxVXR0L00wN3JFTmV2UT09OmIz&notation=a5

Web and Node.js

Utilizing the f NPM module (npm install f --save):

const f = require('f');

f('brozeph/chess/game')({
  stateCode : 'anBwRVB3RkdxVXR0L00wN3JFTmV2UT09OmIz',
  notation : 'a5'
}, (err, response) => {
  // handle error or response...
});

Function Setup

Hi,

I'm trying to understand from the documentation what is the proper way to handle setup/initialization of a new function. For example: It needs to connect to an underlying service, which takes time and I want it to be done just once on init.
Maybe I missed it, but I can't find reference for that.
Is it possible?

Thanks,
DD.

lib init error

I have no idea why I'm getting this error or how to debug it:
image

Merging package.json

I'm not seeing my template dependencies getting merged in with the main app template's. Are there any known issues? Can you point me to the code that should be doing this?
I've had a hard time tracking it down but I'm going to take another wack at it this evening.

Request service via GET

Will it be possible to call my function via GET? Some apps, like podcasts agregators and rss readers, can only make get requests.

Alexa template does not include request validation.

Amazon is no longer approving skills without request validation so it should be added to the template.

Where are the templates held? Possibly I could add support to it but I don't see anything related to Alexa in the lib cli.

stdlib f:compile fails

Is there any way to debug? I suppose timeout. I'm getting this response:
Error: Unexpected server response:

<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <style type="text/css">
    html, body, iframe { margin: 0; padding: 0; height: 100%; }
    iframe { display: block; width: 100%; border: none; }
  </style>
<title>Application Error</title>
</head>
<body>
  <iframe src="//s3.amazonaws.com/heroku_pages/error.html">
    <p>Application Error</p>
  </iframe>
</body>
</html>

Using Environment Variables to Deploy

I want to deploy my code to <stdlib> through TravisCI (or any CI service).

I would need to set the environment variables to do this because I have to set my user. I can do this using a build.sh script for example which can receive $USER and $PASSWD from outside, but it's insecure.

Is there any method to use an $ACCESS_TOKEN to Deploy?

How can I use node.js modules?

Hi, it might be a simple issue, but including dependencies in package.json just doesn't work for me. How can I do it? Thanks.

Where are all the services?

I'm interested in building and using services with f. But I can't find anywhere a list of already available examples. I would imagine there's a list of services that people have build or that you've built. Where is that list?

2FA

Users should be able to set up two factor authentication to protect their accounts.

How to secure a "function" ?

I use webtask.io that's part of auth0 and they use bearer token thats passed in the header.

What are your plans securing a call to endpoint?

use case:

person logs in with twitter , needs to process something specific to him/her , web app makes a call on his behalf.

I am hoping it won't be too complicated with enough developer control.

cheers

Logging and monitoring

I can't seem to find any documentation on how logging and monitoring works with lib. Can someone point me in the right direction there?

Error: No parser found for extension ".json"

Error produced on two computers with the following operating systems:

  • MacOS Sierra (w/ latest updates)
  • Ubuntu 16.04

Each computer has the same version of Node/npm/lib.cli installed:

  • lib.cli v3.0.0-rc9
  • Node v7.10.0
  • npm v4.6.1

Details

  • I gave the tutorial on the Medium Slack Platform Blog (Build a “Serverless” Slack Bot in 9 Minutes with Node.js and StdLib) a try.
  • I was able to get as far as Minute 5: StdLib Service Creation when I ran into the error.
    • Running lib create -t slack worked as expected.
    • However, inside my slack-app directory, running
      lib .commands --command /hello --text hey there --channel general
      produced the error Error: No parser found for extension ".json".
  • Identical error on both operating systems.

lib init error on macOS Sierra

macOS 10.12.1
node v5.1.1 (latest with Homebrew)

$ lib init
/usr/local/lib/node_modules/lib/cli/error_log.js:8
    let details = err.details[k];
    ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Looks like ES6 issue, but I'm not sure where to declare use strict.

Error: Cannot read property 'filename' of undefined

function runs fine locally but when I publish dev or release, I get an error.

f . => incubated cross-platform applications
f . 2 => mesh 24/7 programming, liberating orchestrated collaborative touchpoints

lib up dev

...
Functions available:

  antic/buzz@dev/buzz
    Function

      [0] iterations

f antic/buzz@dev/buzz

Error: Error: Cannot read property 'filename' of undefined
    at IncomingMessage.<anonymous> (/Users/antic/.nvm/versions/node/v6.9.1/lib/node_modules/lib/node_modules/f/lib/f.js:100:27)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

https://f.stdlib.com/antic/buzz

Error: Cannot read property 'filename' of undefined

Ability to use npm pkgs / what is the package.json for?

Hey there! I'm already diggin' this tool:
f james/twitter/hello sausage bacon eggs

When I saw package.json I thought I might be able to install packages from there by putting them in package.json, but that doesn't appear to be the case. If not, what should I be using package.json for?

How to set account information

The cli or other website documentation should describe how to set such account information as full_name and twitter_id

I've tried to setup twice but get this error

$ lib init

/home/ubuntu/.nvm/versions/node/v4.7.3/lib/node_modules/lib.cli/cli/commands/nomethod.js:96
lib({token: token, host: host, port: port})[params.name](...args, kwargs, cb);
^^^

SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at /home/ubuntu/.nvm/versions/node/v4.7.3/lib/node_modules/lib.cli/node_modules/cmnd/lib/command_line_interface.js:97:20
at Array.forEach (native)
at CommandLineInterface.load (/home/ubuntu/.nvm/versions/node/v4.7.3/lib/node_modules/lib.cli/node_modules/cmnd/lib/command_line_interface.js:80:44)

CORS options not set when returning an error.

When a service function returns an error, the stdlib servers return that response as a code 400 in text/plain without adding proper CORS headers. This causes browser libraries to fail to correctly receive any error responses. The issue seems to be entirely server-side.


Consider the following function that returns an error in some situations:
(Code is running at http://pras.stdlib.com/happy@dev/)

function.json

{
  "name": "happy",
  "description": "Returns the string 'happy'.",
  "kwargs": { "happy": "Set this to true." }
}

index.js

module.exports = (params, callback) => {
  // Return an error if happy is not true.
  if (!params.kwargs.happy) {
    return callback(new Error('Happy must be set to "true".'));
  }
  callback(null, 'happy');
};

Let's call this function from browser using the f library:

// Load f.js in the HTML HEAD.
f('pras/happy@dev')({
  happy: false   // intentionally cause an error
}, (err, result) => {
  console.log(err);
  console.log(result);
});

What we see is that when happy is set to true, the stdlib servers return a response that includes an Access-Control-Allow-Origin clause, which makes the response interpretable by the browser.

Access-Control-Allow-Origin:*
Access-Control-Expose-Headers:Access-Control-Allow-Origin
Connection:keep-alive
Content-Length:54
Content-Type:application/json
Date:Tue, 18 Apr 2017 05:14:45 GMT
X-Stdlib-Environment:dev
X-Stdlib-Time:100

When happy is set to false, however, the server responds without these headers when it returns the error:

Connection:keep-alive
Content-Length:28
Content-Type:text/plain
Date:Tue, 18 Apr 2017 05:15:12 GMT
X-Stdlib-Environment:dev
X-Stdlib-Time:100

Without the header, the browser rejects the response entirely as a security violation:

XMLHttpRequest cannot load http://f.stdlib.com/pras/happy@dev. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 400.

which means that f loses the server's error message and returns a generic one instead:

Error: Could not run function.

Pasting password for new user creation

I expected:

  1. The password to be starred
  2. The password to be recognized

What happened:

  1. The password was shown without stars
  2. The password was not recognized
  3. A validation error said I need a password greater than 5 characters.

This was on Mac Chrome

does not give option to create or change

>  stdlib up dev
Invalid namespace: "maer007"
Namespace must follow these guidelines:
  - Three (3) characters or more
  - Begin with a letter
  - Contain only alphanumeric (or -) characters
  - End with a letter or number

Error: Could not install template alexa

When attempting to create a service based on the alexa template, I'm getting an error message.

  • OS = Win 10 Pro
  • Node = 6.9.5

Error:

lib create -t alexa --write-over

Awesome! Let's create a stdlib service!
We'll use the template alexa to proceed.

? Service Name alexa
Fetching template alexa...

Error: Could not install template alexa

f:list - A command to list the functions under a namespace

Would be nice to have a command like f:list to list all the functions under a namespace. I'm not sure if it should only list under your own namespaces, for privacy.

$ stdlib f:list txgruppi/dev
txgruppi/dev/hello
txgruppi/dev/anotherfunction

f:new throw a SyntaxError

My envs:

  • node -v: v5.5.0
  • stdlib.com version: v0.1.3

Error log:

$ stdlib f:new
/usr/local/lib/node_modules/stdlib.com/index.js:4
let host = 'f.stdlib.com';
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/stdlib.com/cli/commands/f.js:6:16)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

--set password prompting for password

It would be nice if lib user --set password prompted for a password if one is not supplied on the command line. This would prevent the password from appearing in my shell history.

Cannot pass negative number as a command line parameter value

I created a simple adder function:

module.exports = (params, callback) => {
    const x1 = Number(params.kwargs.x1);
    const x2 = Number(params.kwargs.x2);
    console.log(`x2 = ${x2}`);

    callback(null, x1 + x2);
};

I can't figure out how to pass negative numbers in as parameter values. Here's what I'm trying:

c:\> lib . --x1 3 --x2 -2

The resulting output is:

x2 = 0
3

lib appears to be interpreting -2 as another parameter rather than as a parameter value for x2. Do I need to escape the -2 value somehow?

Change HTTP code in node.js

How to change the HTTP code in node function?

Example:

var requiredField = {
      statusCode: 422,
      body: 'CPF parameter is required'
};
callback(requiredField, null);

######

var redirectToSite = {
      statusCode: 302,
      body: 'www.uol.com.br'
};
callback(null, redirectToSite);

Can i help me?

lib create: Error Bad Request

Hi,

i just fresh install the cli yarn global add lib.cli, log in & try to create a project, then get error:

/tmp/stdlib-workspace $ lib create t

Awesome! Let's create a stdlib service!

Error: Bad Request

where can i get detail error info, or enable the verbose mode?

Installation issue due to "lib" executable name

When installing using npm i -g lib.cli on mac I got the following error:

npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "lib.cli" "-g"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.3
npm ERR! path ../lib/node_modules/lib.cli/cli/bin.js
npm ERR! code EEXIST
npm ERR! errno -17
npm ERR! syscall symlink

npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/lib.cli/cli/bin.js' -> '/usr/local/bin/lib'
npm ERR! File exists: ../lib/node_modules/lib.cli/cli/bin.js
npm ERR! Move it away, and try again.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/david/projects/npm-debug.log

I think that the name lib is to generic and this can happen on other machines as well

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.