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

service-entity-models

v3.0.1

Published

The Augmented.js Next Service - Entity Models Module.

Downloads

8

Readme

service-entity-models

The Augmented.js Next Service - Entity Models Module.

API

Table of Contents

ResourceCollection

Extends AbstractCollection

Collection class to handle REST

Parameters

  • models
  • options (optional, default {})

uri

Collection name for us in a datasource or an identifier

Properties

  • name string The name of the collection

uri

Properties

  • uri string The uri for the resource

url

Meta

  • deprecated: This is deprecated.

sync

Sync method to handle REST functions for the model

Parameters

  • method string the operation to perform
  • options object Any options to pass

fetch

Fetch the entity

Parameters

  • options object Any options to pass

save

Save the entity

Parameters

  • options object Any options to pass

update

Update the entity

Parameters

  • options object Any options to pass

destroy

Destroy the entity

Parameters

  • options object Any options to pass

EntityCollection

Extends AbstractCollection

Collection class to handle ORM to a datasource</br/> Note: Datasource property is required

Parameters

  • models
  • options

uri

Collection name for us in a datasource or an identifier

Properties

  • name string The name of the collection

uri

The query to use for the query - defaults to "id" selection

uri

Properties

  • uri string The uri for the datasource (if applicable)

uri

Returns (string | function) uri The URI or a function to retun a URI object

url

Meta

  • deprecated: This is deprecated.

initialize

Initialize the model with needed wireing

Parameters

  • options object Any options to pass

init

Custom init method for the model (called at initialize)

Parameters

  • options object Any options to pass

setDatasource

Parameters

  • datasource

Properties

  • datasource Augmented.Service.DataSource Datasource instance

setDatasource

Set the datasource for the Collection

Parameters

  • datasource object The datasource object

sync

Sync method to handle datasource functions for the Collection

Parameters

  • method string the operation to perform
  • options object Any options to pass

fetch

Fetch the entity

Parameters

  • options object Any options to pass

save

Save the entity

Parameters

  • options object Any options to pass

update

Update the entity

Parameters

  • options object Any options to pass

destroy

Destroy the entity

Parameters

  • options object Any options to pass

setDataSourceCollection

Set the DataSource Collection

Parameters

  • name string The name of the collection datasouce

PaginatedResourceCollection

Extends ResourceCollection

Collection class to handle ORM to a datasource with pagination</br/> Note: Datasource property is required

Parameters

  • models
  • options

setPageSize

Sets the number of items in a page

Parameters

  • size number Number of items in each page

setCurrentPage

Sets the current page

Parameters

  • page number Current page in collection

fetch

Fetch the entity

Parameters

  • options object Any options to pass

nextPage

Moves to the next page

previousPage

Moves to the previous page

goToPage

Goes to page

Parameters

firstPage

Moves to the first page

lastPage

Moves to the last page

refresh

Refreshes the collection

PaginationFactory

Pagination factory for returning pagination collections of an API type

getPaginatedCollection

Get a pagination collection of type

Parameters

  • Collection PAGINATION_API The collection class to enrich
  • apiType PAGINATION_API The API type to return an instance of
  • data
  • args object Collection arguments

Returns Collection Returns a new collection with pagination configured

PaginationFactory.type

Types of pagination API

Properties

Entity

Extends AbstractModel

Entity class to handle ORM to a datasource</br/> Note: Datasource property is required

Parameters

  • attributes attributes Any attributes to prefill the model
  • options object Any options to pass (optional, default {})
  • args ...any

initialize

The query to use for the query - defaults to "id" selection

Parameters

  • options

Properties

  • query object The query string to use for selection

initialize

Parameters

  • options

Properties

initialize

Parameters

  • options

Properties

  • collection string The collection for the datasource (if applicable)

initialize

Initialize the model with needed wiring

Parameters

  • options object Any options to pass

init

Custom init method for the model (called at inititlize)

Parameters

  • options object Any options to pass

sync

Parameters

  • method
  • options

Properties

  • datasource Augmented.Service.DataSource Datasource instance

sync

Sync method to handle datasource functions for the model

Parameters

  • method string the operation to perform
  • options object Any options to pass

fetch

Fetch the entity

Parameters

  • options object Any options to pass

save

Save the entity

Parameters

  • options object Any options to pass

update

Update the entity

Parameters

  • options object Any options to pass

destroy

Destroy the entity

Parameters

  • options object Any options to pass

Resource

Extends AbstractModel

Resource class to handle REST Note: URI property is required

Parameters

  • attributes attributes Any attributes to prefill the model
  • options object Any options to pass (optional, default {})
  • args ...any

initialize

Parameters

  • options

Properties

initialize

Parameters

  • options

Properties

  • uri string The uri for the REST Service

initialize

Initialize the model with needed wiring

Parameters

  • options object Any options to pass

init

Custom init method for the model (called at inititlize)

Parameters

  • options object Any options to pass

fetch

Fetch the Resource

Parameters

  • options object Any options to pass

sync

Sync method to handle REST functions for the model

Parameters

  • method string the operation to perform
  • options object Any options to pass