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

sgm

v0.0.26

Published

Sigma ORM

Downloads

22

Readme

Estructura de la Aplicacion

APP_NAME/
|	models/
|	|	personas.js
|	controls/
|	|	personas.js
|	routes/
|	|	personas.js
|	tests/
|	|	personas.js
|	node_modules/
|	app.js

Comandos del a APP

Generadores

|	sgm new APP_NAME	crea la estructura de la app en la carpeta APP_NAME, si no existe la crea, si existe la usa como base
|	sgm	generate NAME	crea un Model, Controller, Routes y Test con el nombre NAME dentro de las carpetas correspondiente. si existe te PUTEA

Debug y Start

|	sgm start			Inicia la APP en modo desarrollo (Como app)
|	sgm	start -t		Corre los Tests de la APP
|	sgm start -p		Inicia la APP en modo Produccion (Como un Servicio)
|	sgm stop			Detiene la APP en modo Produccion

Estructura del Controller

{
	'findAll': 					Adapter.FindAll
,	'findOne': 					Adapter.FindOne
,	'count':					Adapter.Count
,	'describe':					Adapter.Describe
,	'update':					Adapter.Update
,	'create':					Adapter.Create
,	'filter':					Adapter.FindAll
,	'find':						Adapter.FindOne
,	'delete': 					Adapter.Delete
,	'resolveAssoc':				Adapter.FindAll | Adapter.FindOne (Depende del Assoc)
,	'countAssoc':				Adapter.Count
,	'describeAssoc':			Adapter.Describe
,	'filterAssoc':				Adapter.Filter (Solo ocurre si el assoc es has-many, has-many:through o has-and-belongs-to-many)
,	'createAssoc':				Adapter.Create
,	'deleteAssoc': 				Adapter.Delete
}

Estructura Routes

{
//	Rutas del Modelo						Accion en el Control del Modelo
	'GET 	/personas':						'findAll'
,	'GET 	/personas/:id':					'findOne'
,	'GET 	/personas/count':				'count'
,	'GET 	/personas/describe':			'describe'
,	'PUT 	/personas/:id':					'update'
,	'PUT 	/personas':						'create'
,	'POST 	/personas/filter':				'filter'
,	'POST 	/personas/find':				'find'
,	'DELETE	/personas/:id':					'delete'

//	Rutas de sus Assocs (Si tiene)			Accion en el Control del Modelo
,	'GET	/personas/:id/:assoc':			'resolveAssoc'
,	'GET	/personas/:id/:assoc/count':	'countAssoc'
,	'GET	/personas/:id/:assoc/describe':	'describeAssoc'
,	'POST	/personas/:id/:assoc':			'filterAssoc'
,	'PUT	/personas/:id/:assoc':			'createAssoc'
,	'DELETE	/personas/:id/:assoc':			'deleteAssoc'
}

Estructura Modelo

{
	table_name: 'personas'
,	adapter: 'mongo'
,	content_type: 'hal'
,	beforeValidate: function() {}
,	beforeCreate: function() {}
,	afterCreate: function() {}
,	beforeUpdate: function() {}
,	afterUpdate: function() {}
,	beforeDestroy: function() {}
,	afterDestroy: function() {}
,	toJSON: function() {}
,	toHAL: function() {}
,	attributes:
	{
		//	Opcional
		id:
		{
			type: 'Primary Key'
		,	unique: true
		}
	,	nombre: 'String'
		//	No es Opcional
	,	Madre:
		{
			type: 'Foreing Key'
		,	model: 'Personas'
		}
	,	Padre:
		{
			type: 'Foreing Key'
		,	model: 'Personas'
		}
	,	Hijos:
		{
			type: 'Foreing Key'
		,	model: 'Personas'
		}
	}

,	associations:
	{
		Madre:
		{
			type: 'belongs-to'
		,	model: 'Personas'		//	Modelo con que se relaciona
		}
	,	Padre:
		{
			type: 'belongs-to'
		,	model: 'Personas'		//	Modelo con que se relaciona
		}
	,	Hijos:
		{
			type: 'has-many'
		,	model: 'Personas'		//	Modelo con que se relaciona
		}
	,	Nietos:
		{
			type: 'has-many:through'
		,	embedded: 'partial'
		,	model: 'Personas'		//	Modelo con que se relaciona
		,	through: 'Hijos'		//	Assoc de la Instancia
		,	association: 'Hijos'	//	Assoc de la/s Instancias del atributo Through de arriba
		}
	}
}

Otras Consideraciones

TipoEmbedded (String)

-	none	>	no sera embebido
-	partial	>	sera embebido pero sus embebidos no tendran embebidos
-	full	>	sera embebido pero sus embebidos definiran si tendran o no embebidos

TipoCollection (String[type] | Object)

-	type:	Tipo de Collection (String)
			Valor por defecto: list
			Posibles Valores: list - pageable - scrollable
-	ipp:	LIMIT (Integer)
			Limite de items por pagina
			Valor por defecto: 10
			Si 0 entonces no tiene limites
-	page:	OFFSET (Integer)
			Pagina de inicio
			Valor por defecto: 1
			Si 0 entonces: 1
-	sortBy	Tipo de Orden
			Valor por defecto: Atributo ID, Criterio menor a mayor (<)
			atribute: Atributo del Modelo	(String)
			criteria: Criterio de Comparacion	(String)
				-	<	Menor a Mayor
				-	>	Mayor a Menor

Otras propiedades de las Asociaciones

embedded:

-	TipoEmbedded

collection:

-	String (TipoCollection | Toma Valores por defecto)
-	Object (Detalles TipoCollection)