Wondering what’s next for npm?Check out our public roadmap! »

This package has been deprecated

Author message:

"diaspora" was moved to "@diaspora/diaspora". Please consider running "npm un diaspora && npm i @diaspora/diaspora" to install new versions.

diaspora

0.2.0 • Public • Published

Diaspora

Multi-source ORM for NodeJS & the browser

Build status

Fancy badges: Build Status Dependency Status Maintainability Test Coverage npm npm version GitHub commit activity the past year license

Documentation & important notes

Welcome on the GitHub repository of Diaspora. Please visit the Manualwebsite, the Quick Code Review or the API Documentation

Important note: Diaspora is very young and under heavy development. You are totally free to use it or contribute, but be aware that some important features are incomplete or absent:

  • Relations: Not implemented
  • Query language: Supported up to Specification level 2.
  • Multi sources: not tested

Diaspora extensions

Available adapters

Adapter Links Maintainer Platform Other infos
In memory
In Memory
Built-in Node + Browser [QL] v2
Web API
WebApi
Browser storage
WebStorage
Browser
MongoDB
MongoDB
GitHub release npm yarn GitHub followers Node [QL] v2
Redis
Redis
GitHub release npm yarn GitHub followers Node [QL] v2

Other modules

Diaspora-Server: a package to easily create APIs for Diaspora models

Compatibility

Diaspora requires:

  • Node >= 6.4.0
  • Browsers:
    • Edge >= 12
    • Firefox >= 18
    • Chrome >= 49
    • Safari & iOS Safari >=10
    • Chrome for Android >= 61
    • Samsung Internet >= 5

More briefly, Diaspora runs on all browsers & JavaScript engines that supports Proxies.

Notable incompatible browsers are

  • Internet Explorer (all versions)
  • Opera Mini
  • UC Browser for Android

API Overview

Need help getting started? We have a page on how to get started in 5 minutes.

Here is a short API overview. For a detailed API documentation, check the Diaspora API Documentation

Model methods

spawn([object props]) => Entity

Create an entity, defining its properties with provided props. The returned entity should be persisted later.

spawnMany([object[] props]) => Set

See spawn.

insert([object props]) => Promise(Entity)

Create an entity, defining its properties with provided props, and persist it immediately.

insertMany([object[] props]) => Promise(Set)

See insertMany.

find(object || Any query, [object options], [string source]) => Promise(Entity)

Retrieve an entity matching query. If query isn't an object, it is considered as an ID.

findMany(object || Any query, [object options], [string source]) => Promise(Set)

See find

delete(object || Any query, [object options], [string source]) => Promise(Entity)

Delete an entity matching query. If query isn't an object, it is considered as an ID. options can contain allowEmptyQuery.

deleteMany(object || Any query, [object options], [string source]) => Promise(Entity)

See delete

update(object || Any query, object newAttrs, [object options], [string source]) => Promise(Entity)

Update a single entity matching querywith attributes in newAttrs. If query isn't an object, it is considered as an ID. options can contain allowEmptyQuery.

updateMany(object || Any query, object newAttrs, [object options], [string source]) => Promise(Set)

See update

Entity methods

destroy([string source]) => Promise(this)

Delete this entity from the specified source. Source hash object is set to undefined

persist([string source]) => Promise(this)

Save current entity to the specified source.

fetch([string source]) => Promise(this)

Reload entity from specified source.

Planned or unsure Diaspora behaviors/features

Manual change of properties

Unsure > Entity may change status to desync ?

P2P Adapter

Unsure > May be interesting... Check for possible problems about data modification, etc etc.

IndexedDB Adapter (browser)

Unsure > IndexedDB technology may be too immature. See MDN about IndexedDB. Note: Plan to show fallback implementations

Install

npm i diaspora

DownloadsWeekly Downloads

10

Version

0.2.0

License

GPL-3.0

Last publish

Collaborators

  • avatar