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

@opzlab/library

v1.6.12

Published

Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.

Downloads

32

Readme

opzlab/library

Documents

logger

function info(...args: any[])
function warn(...args: any[])
function error(...args: any[])
function log(...args: any[])

jsonfiles

set default caches_folder in the environment file '.env'

CACHES_FOLDER = 'caches'
const networks
const objectTemplate
const arrayTemplate

async function loadJson(template: any, filename: string)
async function storeJson(JsonObject: any, filename: string)
async function renameJson(srcfile: string, dscfile: string)
async function removeJson(filenames: string[])

dotenv

async function updateEnvVariable(key: string, value: any)
async function verifyEnvPath()

Use verifyEnvPath to add default '.env' as follows

SHUTDOWNTIMEOUT = 5000
AZURE_STORAGE_CONNECTION_STRING = "DefaultEndpointsProtocol=https;AccountName=opzlife;AccountKey=LOdony4b3rontTCRXyPh6Gna5aJhelonGSWitbbd3+8kSBe46ZAEbn2lL9Xsw3IwA5f/0xS3XhJp+AStUVBkxA==;EndpointSuffix=core.windows.net"
CACHES_FOLDER = caches

POSTGRES_USER= dev
POSTGRES_PASSWORD = dev
POSTGRES_DB = workermainnet
SERVER_PORT = 5432

AZ_CONTAINER = opzlab

storage

set default caches_folder in the environment file '.env'

AZURE_STORAGE_CONNECTION_STRING = "Def..."
AZ_CONTAINER = opzlab
class datastore {
    async removeFolder(){}
    async removeContainer(){}
    async block_push(files: string[]){}
    async block_pull(files: string[]){}
}

postgresql

connections there are 2 connections for [0] default postgres [1] current as '.env'

type connection = {
    name:string,
    db:any
}

const connections:connection[] =[2]

install

async function installPostgreSqlIfNotExist()
async function uninstallPostgreSQLUbuntu()

user

async function userCreate(username: string, passwd: string)
async function userDrop(userName: string)
async function userIsExist(username: string)
async function userArray()

database

async function dbCreate(dbname: string)
async function dbDrop(dbName: string)
async function dbIsExist(dbname: string)
async function dbNameArray()
async function dbGrantToUser(dbname: string, username: string)
async function dbRevokeToUser(dbname: string, username: string)
async function dbGrantee()

table

async function tableCommand(sqlcommand:string)
async function tableList()
async function tableDrop(tableName: string)
async function tableDetail(tableName: string)
async function tableRecords(tableName:string,offset:number,limit:number)
async function tableRecordsbyId(tableName:string,orderby:string,offset:number,limit:number)

block

async function createBlockTable()
async function insertBlock(model: Block)
async function updateBlock(model: Block)
async function deleteBlock(id: number)
async function detailBlockTable(tableName: string)

sample of use

const logger = require('@opzlab/library')
const {networks,objectTemplate,arrayTemplate,loadJson,storeJson} = require('@opzlab/library')
logger.info('Current working directory:', process.cwd())

console.log(networks)
console.log(objectTemplate)
console.log(arrayTemplate)

loadJson(arrayTemplate,'testfile').then((d)=>{
    logger.info(d)
    storeJson(d,'test2')
});

install prostgresql

sudo apt update
sudo apt install postgresql postgresql-contrib
psql --version
sudo service postgresql start
service postgresql status
```
start as 'postgres' and create password for postgres = 'password'
```
sudo -u postgres psql
postgres=# ALTER USER postgres PASSWORD 'password';
postgres=# \q
```
list all users and role
```
postgres=# \du
postgres=# \q
```
try create user name $USER
```
postgres=# CREATE ROLE chaiya LOGIN SUPERUSER CREATEDB CREATEROLE REPLICATION BYPASSRLS PASSWORD 'password';
postgres=# \du
postgres=# DROP ROLE chaiya;
postgres=# \du
postgres=# \q
sudo -u postgres psql -c "CREATE USER admin WITH PASSWORD 'password';"
```

# sample
```
cd ~
sudo -u postgres createdb workermainnet
cd ~
sudo -u postgres psql -c "CREATE USER dev WITH PASSWORD 'dev';"
cd ~
sudo -u postgres psql -c "grant all privileges on database workermainnet to dev;"
```