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

@laboratoria/sdk-js

v8.1.0

Published

Laboratoria JavaScript (browser) SDK

Downloads

182

Readme

Laboratoria JavaScript (browser) SDK

Node.js CI

:warning: This tool is still in draft stage and is likely to change without notice.

Installation

npm i --save @laboratoria/sdk-js

Usage

import { createApp } from '@laboratoria/sdk-js';

const app = createApp();

With options:

const app = createApp({
  firebaseApiKey: '',
  firebaseProject: '',
  coreApiUrl: '',
});

API

Auth

app.auth.onChange(({ authUser, user }) => {
  // `authUser` is the Firebase Auth user
  // `user` is the user profile stored in Laboratoria Core
});

app.auth.signIn(email, password);
app.auth.signOut();

Models

The app object exposes data models used to access data. Each model represents a type of object, which is stored in a database table.

All models have the following methods and properties.

CRUD methods

  • create
  • delete
  • findById
  • findMany
  • update
  • upsert

Other methods

  • parse
  • stats
  • validate
  • validateAttr

Properties

  • relations
  • schema

Model Schema

Each model has a schema (model.schema) that describes the shape of the data, what properties (columns) it has, what data types these columns are, whether they are required or not, etc.

The model.schema is an object with the following properties:

  • inputProps: An array listing properties to be taken into account when building input UI or sending data (via model.create, model.update, etc).
  • primaryKey: Primary key in the underlying table.
  • properties: An object with the model properties. Each property is described by an object having the following keys:
    • type: It can be: boolean, integer, string, date o una referncia a un modelo, en cuyo caso el string será el nombre del modelo de prisma.
    • default
    • enum
    • format: date-time
    • $ref
    • anyOf
    • items
    • inputType
    • isRequired
    • isScalar
    • isRef
  • type: The schema for the whole model will always be of type object.

Users

app.user.findMany({
  where: { name: { contains: 'foo' } },
  include: { students: true },
  take: 10,
  skip: 0,
});

app.user.findById('some-firebase-uid', {
  include: { gigs: true },
});

app.user.update({
  where: { uid: 'some-firebase-uid' },
  data: {
    name: 'OMG',
  },
});

app.user.delete('some-firebase-uid');

app.user.create({
  data: {
    name: 'OMG',
    email: '[email protected]',
    password: 'secret',
  },
});

Cohorts

app.cohort.findMany({
  where: {
    end: { gt: new Date() },
    stage: { name: 'bootcamp' },
  },
  include: {
    program: true,
    stage: true,
    students: true,
    dropouts: true,
  },
})

Students

WIP

Dropouts

WIP

Projects

app.project.findMany();

app.project.findMany({ tag: 'v6.5.0' });

app.project.findMany({
  track: 'web-dev',
});

app.project.findById('cipher');

app.project.findById('cipher', { tag: 'v6.5.0' });

Topics

app.topic.findMany();

app.topic.findMany({ tag: 'v6.5.0' });

app.topic.findMany({
  track: 'web-dev',
});

app.topic.findById('javascript');

app.topic.findById('javascript', { tag: 'v6.5.0' });

Learning Objectives

app.learningObjective.findMany();

app.learningObjective.findMany({ tag: 'v6.5.0' });