npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@valentine-stone/googleapi-utils

v1.9.2

Published

An assortment of Google Cloud utilities.

Downloads

20

Readme

googleapi-utils

An assortment of Google Cloud utilities.

Currently includes:

  1. Firebase custom claim setter
  2. Firebase Realtime Database manipulation cli
  3. Assortmet of Google Cloud network and utility middleware (adapters) for streaming data between endpoints
    • pubsub - Google Cloud Pub/Sub powered P2P tunnel (spawns necessary resources automatically)
    • google-iot - Google IoT Commands powered P2P tunnel (spawns necessary resources automatically)
    • google-iot-controlled - google-iot, but with TCP-like session managment
    • serialport - An adapter-wrapper for serialport
    • udp - Adapter-wrapper for UDP (dgram) server (listens on (owns) a given ip and port)
    • udp-proxy - Adapter-wrapper for UDP (dgram) client (talks to a given ip and port)
    • tcp - Adapter-wrapper for TCP server (listens on a given ip and port for any connections, reads from all writes to all)
    • chain - as the name implies, chain multiple adapters together, creating a data conveyor
    • measure - measure and log any adapter's input/output
    • throttle - Throttles the bytes sent by delaying send untill a given amount of bytes is ready to be sent
    • transform - Arbitrarily transform input and output (can be used for logging or sideeffects)
    • atcp - Abstract pure js TCP implementation (not finished, does not work)
  4. Assortmet of other little tools (see below)

Setup

  1. git clone https://github.com/ValentineStone/googleapi-utils
  2. cd googleapi-utils
  3. npm i
  4. cp .env.example .env and change it according to your setup

Usage

Claim

node claim <userId> <claim> <value> set custom claim
node claim <userId> <claim> --clear clear custom claims
node claim <userId> <claim> get custom claim
node claim <userId> get all custom claims
node claim <userId> --clear clear all custom claims

In all commands userId can be multiple ids, separated by a comma, like so:

node claim wejq7RynaVC2H3WK4toXxT3BHgWS,43f5xpVkCmXz22OdIlSshYMZANF2,7Y9nKfPY1JMMVEVE8Q4tSH9pwsGG admin true
# > wejq7RynaVC2H3WK4toXxT3BHgWS admin = true
# > 43f5xpVkCmXz22OdIlSshYMZANF2 admin = true
# > 7Y9nKfPY1JMMVEVE8Q4tSH9pwsGG admin = true
# set the claim 'admin' to true for 3 users

Random string

node rstr <length> <symbols> <firstsymbols>
Generate random string of length symbols consisting of symbols.
If firstsymbols is present the first symbol of the string will be selected from it.

Default length is 32, default symbols:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789~`!@#$%^&*()_-+={[}]|\:;"\'<,>.?/

Both symbols and firstsymbols can be one of the following shortcuts:
-alpha -num -alnum -other -url -any.

Random date

node rdate <from = 1990-01-01> <to = 1999-12-31>

node rdate
# > 1994-10-21 20:52:55
node rdate 0001-01-01 1000-01-01
# > 0396-01-05 00:02:07

UUID

node uuid <name> <namespace> to generate a UUID-5 (if name is not provided is it set to Date.now() + '-' + Math.random())

Connect

node adapters/connect <adapter1> <params1> <adapter2> <params2>

A quick and easy way to get some data from one source to another, a simple multitool for the ages.

For adapters types see above and for their parameters see in the code.

Example:

node adapters/connect tcp localhost,55757 serialport COM8,115200
# > [tcp]: localhost:55757
# > [serialport]: COM8:115200

Firebase Realtime Database

node rtdb mv [--push] <from> <to> move value
node rtdb cp [--push] <from> <to> copy value
node rtdb rm <path> remove value from path
node rtdb set [--push] <path> <value> set value
node rtdb get <path> get value, duh

None of the methods that change the database would override an existing path, you need to remove whatever is there before you can write anything new. If you want to just add an item to a collection with an auto generated Firebase key use --push, like so:

node rtdb set --push /badguys '{ "name": "Mare-do-well", "type": "pony" }'
# > setting...
# > set /badguys/-M_vA9s0ksgQHI54DUF9
# Whops, Mare-do-well is not a villan, she is a hero, lets fix that
node rtdb mv --push /badguys/-M_vA9s0ksgQHI54DUF9 /goodguys
# > moving...
# > moved /badguys/-M_vA9s0ksgQHI54DUF9 to /goodguys/-M_vAODTlncCrpePrYeZ
# But she has an evil invisible twin sister,
# lets copy the record and change it accordingly
node rtdb cp --push /goodguys/-M_vAODTlncCrpePrYeZ /badguys
# > copying...
# > copied /goodguys/-M_vAODTlncCrpePrYeZ to /badguys/-M_vAg7zsv3xie7bBlIU
# For security reasons there is no way to change a value in this cli,
# so lets remove the name and set the new one
node rtdb rm /badguys/-M_vAg7zsv3xie7bBlIU/name
# > removing...
# > removed /badguys/-M_vAg7zsv3xie7bBlIU/nam
node rtdb set /badguys/-M_vAg7zsv3xie7bBlIU/name "Ne'er-do-well"
# > setting...
# > set /badguys/-M_vAg7zsv3xie7bBlIU/name
# Lets check our handywork
node rtdb get /badguys
# > getting...
# > { '-M_vAg7zsv3xie7bBlIU': { name: "Ne'er-do-well" } }
node rtdb get /goodguys
# > getting...
# > { '-M_vAODTlncCrpePrYeZ': { name: 'Mare-do-well' } }
# Glorious work!