Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .clang-format

This file was deleted.

22 changes: 0 additions & 22 deletions .cloud-repo-tools.json

This file was deleted.

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ system-test/secrets.js
system-test/*key.json
*.lock
.DS_Store
google-cloud-logging-winston-*.tgz
google-cloud-logging-bunyan-*.tgz
__pycache__
.vscode
package-lock.json
12 changes: 12 additions & 0 deletions .repo-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "datastore",
"name_pretty": "Google Cloud Datastore",
"product_documentation": "https://cloud.google.com/datastore",
"client_documentation": "https://cloud.google.com/nodejs/docs/reference/datastore/latest/",
"issue_tracker": "https://issuetracker.google.com/savedsearches/559768",
"release_level": "ga",
"language": "nodejs",
"repo": "googleapis/nodejs-datastore",
"distribution_name": "@google-cloud/datastore",
"api_id": "datastore.googleapis.com"
}
73 changes: 46 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,57 @@
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `npm run generate-scaffolding`."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>

# [Google Cloud Datastore: Node.js Client](https://github.com/googleapis/nodejs-datastore)

[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style&#x3D;flat)](https://cloud.google.com/terms/launch-stages)
[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
[![npm version](https://img.shields.io/npm/v/@google-cloud/datastore.svg)](https://www.npmjs.org/package/@google-cloud/datastore)
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-datastore/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-datastore)

[Cloud Datastore](https://cloud.google.com/datastore/docs) is a NoSQL document database built for automatic scaling, high performance, and ease of application development. While the Cloud Datastore interface has many of the same features as traditional databases, as a NoSQL database it differs from them in the way it describes relationships between data objects.


* [Using the client library](#using-the-client-library)

Cloud Datastore Client Library for Node.js


* [Google Cloud Datastore Node.js Client API Reference][client-docs]
* [Google Cloud Datastore Documentation][product-docs]
* [github.com/googleapis/nodejs-datastore](https://github.com/googleapis/nodejs-datastore)

Read more about the client libraries for Cloud APIs, including the older
Google APIs Client Libraries, in [Client Libraries Explained][explained].

[explained]: https://cloud.google.com/apis/docs/client-libraries-explained

**Table of contents:**


* [Quickstart](#quickstart)
* [Before you begin](#before-you-begin)
* [Installing the client library](#installing-the-client-library)
* [Using the client library](#using-the-client-library)
* [Samples](#samples)
* [Versioning](#versioning)
* [Contributing](#contributing)
* [License](#license)

## Using the client library
## Quickstart

1. [Select or create a Cloud Platform project][projects].

1. [Enable billing for your project][billing].
### Before you begin

1. [Select or create a Cloud Platform project][projects].
1. [Enable the Google Cloud Datastore API][enable_api].

1. [Set up authentication with a service account][auth] so you can access the
API from your local workstation.

1. Install the client library:
### Installing the client library

```bash
npm install @google-cloud/datastore
```

npm install --save @google-cloud/datastore

1. Try an example:
### Using the client library

```javascript
// Imports the Google Cloud client library
Expand Down Expand Up @@ -67,31 +86,42 @@ async function quickStart() {
console.log(`Saved ${task.key.name}: ${task.data.description}`);
}
quickStart().catch(console.error);

```



## Samples

Samples are in the [`samples/`](https://github.com/googleapis/nodejs-datastore/tree/master/samples) directory. The samples' `README.md`
has instructions for running the samples.

| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Tasks | [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/tasks.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/tasks.js,samples/README.md) |
| Concepts | [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/concepts.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/concepts.js,samples/README.md) |
| Quickstart | [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
| Tasks | [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/tasks.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/tasks.js,samples/README.md) |


The [Cloud Datastore Node.js Client API Reference][client-docs] documentation

The [Google Cloud Datastore Node.js Client API Reference][client-docs] documentation
also contains samples.

## Versioning

This library follows [Semantic Versioning](http://semver.org/).


This library is considered to be **General Availability (GA)**. This means it
is stable; the code surface will not change in backwards-incompatible ways
unless absolutely necessary (e.g. because of critical security issues) or with
an extensive deprecation period. Issues and requests against **GA** libraries
are addressed with the highest priority.





More Information: [Google Cloud Platform Launch Stages][launch_stages]

[launch_stages]: https://cloud.google.com/terms/launch-stages
Expand All @@ -106,21 +136,10 @@ Apache Version 2.0

See [LICENSE](https://github.com/googleapis/nodejs-datastore/blob/master/LICENSE)

## What's Next

* [Cloud Datastore Documentation][product-docs]
* [Cloud Datastore Node.js Client API Reference][client-docs]
* [github.com/googleapis/nodejs-datastore](https://github.com/googleapis/nodejs-datastore)

Read more about the client libraries for Cloud APIs, including the older
Google APIs Client Libraries, in [Client Libraries Explained][explained].

[explained]: https://cloud.google.com/apis/docs/client-libraries-explained

[client-docs]: https://cloud.google.com/nodejs/docs/reference/datastore/latest/
[product-docs]: https://cloud.google.com/datastore/docs
[product-docs]: https://cloud.google.com/datastore
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=datastore.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/getting-started
[auth]: https://cloud.google.com/docs/authentication/getting-started
44 changes: 21 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
],
"scripts": {
"docs": "jsdoc -c .jsdoc.js",
"generate-scaffolding": "repo-tools generate all && repo-tools generate lib_samples_readme -l samples/ --config ../.cloud-repo-tools.json",
"lint": "gts check && eslint '**/*.js'",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"test": "nyc mocha build/test",
Expand All @@ -51,49 +50,48 @@
"@grpc/grpc-js": "^0.4.0",
"@types/duplexify": "^3.6.0",
"@types/long": "^4.0.0",
"arrify": "^2.0.0",
"arrify": "^2.0.1",
"concat-stream": "^2.0.0",
"extend": "^3.0.1",
"extend": "^3.0.2",
"google-auth-library": "^4.0.0",
"google-gax": "^1.0.0",
"is": "^3.2.1",
"is": "^3.3.0",
"lodash.merge": "^4.6.1",
"split-array-stream": "^2.0.0",
"stream-events": "^1.0.4",
"through2": "^3.0.0"
"stream-events": "^1.0.5",
"through2": "^3.0.1"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.0.0",
"@types/extend": "^3.0.0",
"@types/extend": "^3.0.1",
"@types/is": "0.0.21",
"@types/mocha": "^5.2.5",
"@types/mocha": "^5.2.6",
"@types/mv": "^2.1.0",
"@types/ncp": "^2.0.1",
"@types/proxyquire": "^1.3.28",
"@types/sinon": "^7.0.2",
"@types/sinon": "^7.0.11",
"@types/through2": "^2.0.34",
"@types/tmp": "0.1.0",
"assert-rejects": "^1.0.0",
"codecov": "^3.0.2",
"eslint": "^5.0.0",
"eslint-config-prettier": "^4.0.0",
"eslint-plugin-node": "^9.0.0",
"eslint-plugin-prettier": "^3.0.0",
"codecov": "^3.5.0",
"eslint": "^5.16.0",
"eslint-config-prettier": "^4.2.0",
"eslint-plugin-node": "^9.0.1",
"eslint-plugin-prettier": "^3.1.0",
"google-proto-files": "^1.0.0",
"gts": "^1.0.0",
"intelli-espower-loader": "^1.0.1",
"jsdoc": "^3.6.2",
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",
"linkinator": "^1.1.2",
"mocha": "^6.0.0",
"linkinator": "^1.4.2",
"mocha": "^6.1.4",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"nyc": "^14.0.0",
"power-assert": "^1.5.0",
"prettier": "^1.13.5",
"proxyquire": "^2.0.1",
"sinon": "^7.0.0",
"nyc": "^14.1.1",
"power-assert": "^1.6.1",
"prettier": "^1.17.1",
"proxyquire": "^2.1.0",
"sinon": "^7.3.2",
"tmp": "0.1.0",
"typescript": "~3.4.0"
"typescript": "~3.4.5"
}
}
69 changes: 47 additions & 22 deletions samples/README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,80 @@
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `npm run generate-scaffolding`."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>

# Google Cloud Datastore: Node.js Samples
# [Google Cloud Datastore: Node.js Samples](https://github.com/googleapis/nodejs-datastore)

[![Open in Cloud Shell][shell_img]][shell_link]

[Cloud Datastore](https://cloud.google.com/datastore/docs) is a NoSQL document database built for automatic scaling, high performance, and ease of application development. While the Cloud Datastore interface has many of the same features as traditional databases, as a NoSQL database it differs from them in the way it describes relationships between data objects.


## Table of Contents

* [Before you begin](#before-you-begin)
* [Samples](#samples)
* [Tasks](#tasks)
* [Concepts](#concepts)
* [Errors and Error Handling](#errors-and-error-handling)
* [Quickstart](#quickstart)
* [Tasks](#tasks)

## Before you begin

Before running the samples, make sure you've followed the steps in the
[Before you begin section](../README.md#before-you-begin) of the client
library's README.
Before running the samples, make sure you've followed the steps outlined in
[Using the client library](https://github.com/googleapis/nodejs-datastore#using-the-client-library).

## Samples



### Concepts

View the [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/concepts.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/concepts.js,samples/README.md)

__Usage:__


`node concepts.js`


-----




### Quickstart

View the [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/quickstart.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/quickstart.js,samples/README.md)

__Usage:__


`node quickstart.js`


-----




### Tasks

View the [source code][tasks_0_code].
View the [source code](https://github.com/googleapis/nodejs-datastore/blob/master/samples/tasks.js).

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/tasks.js,samples/README.md)

__Usage:__ `node tasks.js --help`
[tasks_0_docs]: https://cloud.google.com/datastore/docs/datastore-api-tutorial
[tasks_0_code]: tasks.js
__Usage:__

### Concepts

View the [source code][concepts_1_code].
`node tasks.js`

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/concepts.js,samples/README.md)[concepts_1_docs]: https://cloud.google.com/datastore/docs/concepts/entities
[concepts_1_code]: concepts.js

### Errors and Error Handling

View the [source code][error_2_code].

[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/error.js,samples/README.md)

__Usage:__ `node error.js`
[error_2_docs]: https://cloud.google.com/datastore/docs/concepts/errors
[error_2_code]: error.js

[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-datastore&page=editor&open_in_editor=samples/README.md
[product-docs]: https://cloud.google.com/datastore
1 change: 0 additions & 1 deletion samples/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "nodejs-docs-samples-datastore",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
"author": "Google Inc.",
Expand Down
6 changes: 3 additions & 3 deletions synth.metadata
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"updateTime": "2019-05-10T12:01:53.705538Z",
"updateTime": "2019-05-15T05:46:46.853335Z",
"sources": [
{
"generator": {
Expand All @@ -12,8 +12,8 @@
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "07883be5bf3c3233095e99d8e92b8094f5d7084a",
"internalRef": "247530843"
"sha": "275cdfcdc3188a60456f43acd139b8cc037379f4",
"internalRef": "248217300"
}
},
{
Expand Down