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

oakdatastore

v0.4.0

Published

a gcloud node.js google datastore abstraction layer with promises

Downloads

10

Readme

oakdatastore

A partial gcloud-node (google cloud) datastore wrapper with bluebird promises in functional style. Only does minimally what we need, no guarantees expressed or implied. Pull Requests for expanded functions/features are welcome.

See tests for usage.

Tested with node v4 LTS

API Reference

oakdatastore module.

oakdatastore.getDataStore(options) ⇒ Object

Make a datastore object from gcloud-node options

Kind: static method of oakdatastore
Returns: Object - gcloud-node datastore object

| Param | Type | Description | | --- | --- | --- | | options | Object | gcloud-node options |

oakdatastore.makeKey(datastore, path_list) ⇒ Object

Make a datastore key

Kind: static method of oakdatastore
Returns: Object - datastore key

| Param | Type | Description | | --- | --- | --- | | datastore | Object | gcloud-node datastore object | | path_list | Array | the datastore path in array form: ['root', 'sub1', 'sub2', 'id'] |

oakdatastore.save_P(datastore, entities, method,) ⇒ Promise

Save multiple objects to datastore using the same method. nb if you "insert" 100 entities but 1 of them already exists, none of the entities will be written

Kind: static method of oakdatastore
Returns: Promise - resolving to apiResponse

| Param | Type | Description | | --- | --- | --- | | datastore | Object | gcloud-node datastore object | | entities | Array.<Object> | in form [{key, data}, ..] | | method, | string | one of: insert, update, upsert (default: insert) |

oakdatastore.get_P(datastore, keys) ⇒ Promise

Get multiple objects from datastore

Kind: static method of oakdatastore
Returns: Promise - resolving to apiResponse

| Param | Type | Description | | --- | --- | --- | | datastore | Object | gcloud-node datastore object | | keys | string | Array.<string> | |

oakdatastore.delete_P(datastore, keys) ⇒ Promise

Delete multiple objects from datastore

Kind: static method of oakdatastore
Returns: Promise - resolving to apiResponse

| Param | Type | Description | | --- | --- | --- | | datastore | Object | gcloud-node datastore object | | keys | string | Array.<string> | |

oakdatastore.deleteNamespace_P(datastore, namespace) ⇒ Promise

deletes all entities in a namespace

Kind: static method of oakdatastore
Returns: Promise - warning: this may take a long time to complete

| Param | Type | Description | | --- | --- | --- | | datastore | Object | gcloud-node datastore object | | namespace | string | to wipe |

oakdatastore.workOnQuery_P(datastore, gcloud-node, worker_P) ⇒ Promise

A helper function to process a query - warning: this may take a long time to complete

Kind: static method of oakdatastore
Returns: Promise - resolving to the final apiResponse

| Param | Type | Description | | --- | --- | --- | | datastore | Object | gcloud-node datastore object | | gcloud-node | Object | query object, as returned by createQuery() | | worker_P | function | callback worker function which takes args: (datastore, entities) and must return a promise - will be called serially for larger datasets |

oakdatastore.createQuery(datastore, kind, [namespace], [auto_paginate]) ⇒ Object

Create datastore query

Kind: static method of oakdatastore
Returns: Object - gcloud-node datastore/query object

| Param | Type | Description | | --- | --- | --- | | datastore | Object | gcloud-node datastore object | | kind | string | | | [namespace] | string | optional namespace | | [auto_paginate] | bool | set false to manually page through results (default: true) |

oakdatastore.runQuery(handle, query, [callback])

Run gcloud-node datastore query, a functional-style helper

Kind: static method of oakdatastore

| Param | Type | Description | | --- | --- | --- | | handle | Object | gcloud-node datastore or transaction object | | query | Object | created by createQuery() | | [callback] | function | optional callback to run with query results in form function(err, entities, nextQuery, apiResponse) |

oakdatastore.makeEntity(key, data) ⇒ Object

Make entity helper

Kind: static method of oakdatastore
Returns: Object - entity

| Param | Type | Description | | --- | --- | --- | | key | Object | gcloud-node datastore key | | data | Object | to be stored in entity value |

Update Docs

./doc/generate

Development

Either use the atom babel package, or use gulp and babel to transpile from src to build.

Test

npm test or npm run testwatch or npm test -- watch