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

@cobuildlab/8base-utils

v0.5.6

Published

This is package to deal with common scenarios working with 8base platform

Downloads

108

Readme

8base utils

This is a package for functions that are use full in common cases of working with the 8base.com platform.

Install

npm i --save @cobuildlab/8base-utils

API

| Function | Description | | ------ | ------ | | normalize8baseReferenceConnect | Updates an object to change a property with a 8base connect operation. | | normalize8baseDocumentCreate | Updates an object to change a property with a 8base create operation for a file object. | | normalize8baseDocumentsCreate | Updates an object to change a property with a 8base create operation for a list of files objects. | | normalize8baseDocumentDeleteAndUpdate | Updates an object to change a property with a 8base create and/or disconnect operation for a list of files objects. | | normalize8baseDocumentsDeleteAndUpdate | Updates an object to change a property with a 8base create and/or disconnect operation for a list of files objects. |

normalize8baseReferenceConnect(data, key)

  • Updates an object to change a property with a 8base connect operation.
  • If the value of the key is undefined or null, the property gets deleted from the object.
  • This function mutates the data object to reflect the change.
  • This function assumes that all 8base IDs are of type string.

Example:

import {normalize8baseReferenceConnect} from "@cobuildlab/8base-utils";

const issue = {name :"Issues Name", project: "<Project ID>"   };

normalize8baseReferenceConnect(issue, "project");

console.log(issue);
// {name :"Issues Name", project: {connect:{id: "<Project ID>"}}};

normalize8baseDocumentCreate(data, key)

  • Updates an object to change a property with a 8base create operation.
  • If the value of the key is undefined or null, the property gets deleted from the object.
  • This function mutates the data object to reflect the change.

Example:

import {normalize8baseDocumentCreate} from "@cobuildlab/8base-utils";

const issue = {name :"Issues Name", document: {fileId: "<FILE-ID>", filename:"<FILENAME>"}  };

normalize8baseDocumentCreate(issue, "document");

console.log(issue);
// {name :"Issues Name", document: {create:{fileId: "<FILE-ID>", filename:"<FILENAME>"}}};

normalize8baseDocumentsCreate(data, key)

  • Updates an object to change a property with a 8base create operation.
  • If the value of the key is undefined, null, or an empty array, the property gets deleted from the object.
  • This function mutates the data object to reflect the change.

Example:

import {normalize8baseDocumentsCreate} from "@cobuildlab/8base-utils";

const issue = {name :"Issues Name", document: [{fileId: "<FILE-ID1>", filename:"<FILENAME1>"},{fileId: "<FILE-ID2>", filename:"<FILENAME2>"}]  };

normalize8baseDocumentsCreate(issue, "document");

console.log(issue);
// {name :"Issues Name", document: {create:[{fileId: "<FILE-ID1>",, filename:"<FILENAME1>"},{fileId: "<FILE-ID2>",, filename:"<FILENAME2>"}]}};

normalize8baseDocumentDeleteAndUpdate(data, key, oldData)

  • Helper to update or delete one document key from an Object.
  • Updates an object to change a property with a 8base create and/or disconnect operation.
  • If the value of the key is undefined, null, or an empty array, the property gets deleted from the object.
  • This function mutates the data object to reflect the change.

Example:

import {normalize8baseDocumentDeleteAndUpdate} from "@cobuildlab/8base-utils";

const new12 = { a: { fileId: "FILE-ID1", filename:"<FILENAME>" } };
const old12 = {};
normalize8baseDocumentDeleteAndUpdate(new12, "a", old12);
expect(new12).toEqual({ a: { create: { fileId: "FILE-ID1", filename:"<FILENAME>" } } });

normalize8baseDocumentsDeleteAndUpdate(data, key, oldData)

  • Helper to change non null keys to 8base 'delete & create' reference for Documents Lists
  • Updates an object to change a property with a 8base create and/or disconnect operation.
  • If the value of the key is undefined, null, or an empty array, the property gets deleted from the object.
  • This function mutates the data object to reflect the change.

Example:

import {normalize8baseDocumentsDeleteAndUpdate} from "@cobuildlab/8base-utils";

const new15 = { a: [{ fileId: "FILE-ID1", filename:"<FILENAME1>" }, { id: "ID2", fileId: "FILE-ID2", filename:"<FILENAME2>" }] };
const old15 = { a: [{ id: "FILE-ID2" }, { id: "ID2" }] };
normalize8baseDocumentsDeleteAndUpdate(new15, "a", old15);
expect(new15).toEqual({ a: { create: [{ fileId: "FILE-ID1", filename:"<FILENAME1>" }], disconnect: [{ id: "FILE-ID2" }] } });