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

codemash

v1.21.5

Published

CodeMash tools for Node and javascript developers. Access codemash.io tools from npm

Downloads

126

Readme

CodeMash.Js

CodeMash for javascript developers. All the documentation can be found here

npm bundle size npm node-current npm

Installation

Use the package manager codemash to install codemash.

npm install codemash

Configuration

import {config} from 'codemash';

config.init(
	{
		secretKey: '<YOUR_SECRET_KEY>',
		projectId: '<YOUR_PROJECT_ID>',
	},
	process.env.NODE_ENV
);

See full documentation here

Database Module

Get Data:

import {db} from 'codemash';

// gets all first 100 employees
export async function getEmployees() {
	return await db.getRecords('emplpyees', 0, 100);
}

// gets all first 100 active employees
// get only first name and last name - projection
// sort out by created on date in DESC order.
export async function getActiveEmployees() {
	const filter = JSON.stringify({is_active: true});

	const response = await db.getRecords(
		'employees',
		0,
		100,
		{first_name: 1, last_name: 1},
		filter,
		{created_on: -1}
	);

	return response;
}

Pagination (by default page size is set to 10):

await db.getRecords('employees', 0, 100);

Sort:

await db.getRecords('employees', 0, 100, {created_on: -1});

Filter:

const filter = JSON.stringify({is_active: true});
await db.getRecords('employees', 0, 100, {created_on: -1}, filter);

See full documentation here

Get One Record:

import {db} from 'codemash';

// gets employee by id
export async function getEmployeeDetails(id) {
	const response = await db.getRecord('employees', id);
	return response;
}

// gets employee by custom filter
export async function getEmployeeByUserId(id) {
	const filter = {userId: id};
	return await db.getRecordWithFilter(collectionName, filter, null);
}

See full documentation here

TODO Projection:

Save Data:

import {db} from 'codemash';

const request = {
	start: '1588855312059', // Unix time stamp in miliseconds
	end: '1588855340191', // Unix time stamp in miliseconds
	employee: 'some_user_id',
	type: 'paid',
};

export async function saveHolidaysRequest(request) {
	const response = await db.saveRecord('holidays', request);
	return response;
}

See full documentation here

Replace Data:

import {db} from 'codemash';

export async function replaceEmployeeInformation(id, employee) {
	return await db.replaceRecord('employees', {_id: id}, employee);
}

Update Data:

import {db} from 'codemash';

export async function activateEmployee(id) {
	return await db.updateRecord('employees', {_id: id}, {$set: {is_active: 1}});
}

See full documentation here

Delete Data:

import {db} from 'codemash';

export async function deleteEmployee(id) {
	return await db.deleteRecord('employees', {_id: id});
}

See full documentation here

Get Taxonomy terms:

import {db} from 'codemash';

export async function getCountries() {
	return await db.getTaxonomyTerms('countries');
}

export async function getCities() {
	return await db.getTaxonomyTerms('cities');
}

Documentation about Terms module you can find here https://docs.codemash.io/microservices/database/taxonomies

TODO Files Module

Documentation about Files moduke you can find here

TODO IAM Module

Documentation about Membership module you can find here

Users Authentication

TODO Notifications Module

Documentation about Notifications you can find here

Emails Push