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

gnos

v2.5.1

Published

GNOS - Googleapi Now Over Simplificated - google api wrapper to make it easier to use !

Downloads

62

Readme

GNOS - Googleapi Now Over Simplificated

Google api wrapper to make it easier to use !

Features :

  • cache handling in read operations
  • api call delays & queue to stay in the range of google limitations
  • error management : will await until google API is available again in case of error, will throw an error if not available during 120s or if a single request takes more than 120s to be executed

Authentication and authorization using Service account credentials

Service accounts allow you to perform server to server, app-level authentication using a robot account. You will create a service account, download a keyfile, and use that to authenticate to Google APIs. To create a service account:

Save the service account credential file somewhere safe, and do not check this file into source control !

Enable spreadsheet API :

On the left menu go to APIs and services / Enabled APIs and services Click on the top button + ENABLE APIS AND SERVICES Type spreadsheet in the search bar Click on the result, then on the button ENABLE

https://www.googleapis.com/auth/spreadsheets

Installation :

install package npm i gnos

import library import { sheetAPI } from "gnos";

set your path to auth.json, include filename in the path (ex. "./auth.json") sheetAPI.setAuthJsonPath(<YOUR PATH TO AUTH.JSON>)

Usage :

READ operations :

  • getTabIds sheetAPI.getTabIds({sheetId:string, disableCache?: boolean}) => Promise<TabListItem[]> return list of sheet tabs with their respective IDs

  • getTabData sheetAPI.getTabData({sheetId:string, tabName:string, headerRowIndex?:number, tabList?:TabListItem[], disableCache?: boolean}) => Promise<TabDataItem[]> return tab data in the form of an array of objects built according to header values

  • getTabSize sheetAPI.getTabData({sheetId: string, tabName: string) => Promise<TabSize> return columns & rows count for a tab

  • clearCache sheetAPI.clearCache() => void clear all of the above operations cache

  • getProtectedRangeIds sheetAPI.getProtectedRangeIds({sheetId: string, tabName: string) => Promise<number[]> get all protectedRange ids of a defined tab

WRITE operations :

  • updateRange sheetAPI.updateRange({sheetId: string, tabName: string, startCoords: [number, number], data: any[][]}) => Promise<void> update a specific range

  • appendToSheet sheetAPI.appendToSheet({sheetId: string, tabName: string, data: Data[]}) => Promise<void> append a line of data to second line of a tab (matching headers)

  • addBatchProtectedRange sheetAPI.addBatchProtectedRange({sheetId: string, editors: string[], namedRangeId?: string, tabId: number, startColumnIndex: number, startRowIndex: number, endColumnIndex: number, endRowIndex: number}) => void add a request to batch buffer

  • runBatchProtectedRange sheetAPI.runBatchProtectedRange({sheetId: string, onTimeoutCallback:() => Promise<void>}) => Promise<void> run all requests in batch buffer, "onTimeoutCallback" will be run if request takes more than 120s to be executed

  • deleteProtectedRange sheetAPI.deleteProtectedRange({sheetId: string, protectedRangeIds:number[]}) => Promise<void> delete a list of protected range ids

  • clearTabData sheetAPI.runBatchProtectedRange({ sheetId: string, tabName: string, headerRowIndex?: number, tabList?: TabListItem[]}) => Promise<void> clear all values of a defined tab

MISC

  • enableConsoleLog sheetAPI.enableConsoleLog() => void turns on logs with detailed infos over cache usage & delay between requests

  • clearBuffer sheetAPI.clearBuffer() => void clear all requests batch buffer

  • getBatchProtectedRange sheetAPI.getBatchProtectedRange() => {[key: string]: sheets_v4.Schema$Request[];} return all requests in batch buffer