{"id":13795508,"url":"https://github.com/hemerajs/hemera-arango-store","last_synced_at":"2025-04-12T02:25:49.976Z","repository":{"id":57262744,"uuid":"114905919","full_name":"hemerajs/hemera-arango-store","owner":"hemerajs","description":"Use Arangodb with Hemera","archived":false,"fork":false,"pushed_at":"2018-04-11T10:56:43.000Z","size":32,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-09T21:39:51.380Z","etag":null,"topics":["arangodb","hemera","store"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hemerajs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-20T16:02:25.000Z","updated_at":"2021-12-27T02:16:49.000Z","dependencies_parsed_at":"2022-09-01T04:27:06.064Z","dependency_job_id":null,"html_url":"https://github.com/hemerajs/hemera-arango-store","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemerajs%2Fhemera-arango-store","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemerajs%2Fhemera-arango-store/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemerajs%2Fhemera-arango-store/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hemerajs%2Fhemera-arango-store/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hemerajs","download_url":"https://codeload.github.com/hemerajs/hemera-arango-store/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131320,"owners_count":21052819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arangodb","hemera","store"],"created_at":"2024-08-03T23:00:58.088Z","updated_at":"2025-04-12T02:25:49.951Z","avatar_url":"https://github.com/hemerajs.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# :avocado: Hemera-arango-store package\n\n[![Build Status](https://travis-ci.org/hemerajs/hemera-arango-store.svg?branch=master)](https://travis-ci.org/hemerajs/hemera-arango-store)\n[![npm](https://img.shields.io/npm/v/hemera-arango-store.svg?maxAge=3600)](https://www.npmjs.com/package/hemera-arango-store)\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](#badge)\n\nThis is a plugin to use [Arangodb](https://github.com/arangodb) with Hemera.\n\nExecute any AQL query from anywhere. For more details [ArangoDB Query Language](https://www.arangodb.com/why-arangodb/sql-aql-comparison/)\n\n## Start Arangodb with Docker\n\n```js\ndocker run -e ARANGO_NO_AUTH=1 -d --name arangodb-instance -d arangodb -p 8529:8529\n```\n\n### Running the tests\n\nInstall and start Arangodb before running the tests.\n\n**arangod.conf**\n\n```\nendpoint = tcp://127.0.0.1:8529\nauthentication = false\n```\n\n```\nnpm run test\n```\n\n## Install\n\n```\nnpm i hemera-arango-store --save\n```\n\n## Usage\n\n```js\nconst hemera = new Hemera(nats)\nhemera.use(require('hemera-joi'))\nhemera.use(require('hemera-arango-store'), {\n  database: {\n    url: 'http://127.0.0.1:8529',\n    name: 'test' // default database\n  }\n})\n```\n\n## Plugin decorators\n\n* hemera.arango\n* hemera.aql\n\n## API\n\nSee [Store](https://github.com/hemerajs/hemera/tree/master/packages/hemera-store) Interface.\n\n## Database specific interface\n\n* [Arango API](#arango-api)\n\n  * [Collection API](#collection-api)\n    * [createCollection](#createcollection)\n  * [Query API](#query-api)\n    * [executeAqlQuery](#executeaqlquery)\n  * [Transaction API](#transaction-api)\n    * [executeTransaction](#executetransaction)\n  * [Database API](#database-api)\n    * [createDatabase](#createdatabase)\n\n---\n\n### createCollection\n\nThe pattern is:\n\n* `topic`: is the store name to publish to `arango-store`\n* `cmd`: is the command to execute `createCollection`\n* `name`: the name of the collection `string`\n* `database`: the database to use against the query. `string` _(optional)_\n* `type`: the type of collection to create `edge` or `\"\"` _(optional)_\n\nExample:\n\n```js\nhemera.act(\n  {\n    topic: 'arango-store',\n    cmd: 'createCollection',\n    name: 'products'\n  },\n  function(err, resp) {}\n)\n```\n\n---\n\n### executeAqlQuery\n\nThe pattern is:\n\n* `topic`: is the store name to publish to `arango-store`\n* `cmd`: is the command to execute `executeAqlQuery`\n* `database`: the database to use against the query. `string` _(optional)_\n* `query`: the AQL query `string`\n* `type`: return one or multiple results `one` or `all`\n\nExample:\n\n```js\nhemera.act(\n  {\n    topic: 'arango-store',\n    cmd: 'executeAqlQuery',\n    type: 'one',\n    database: 'test',\n    query: aql`INSERT ${user} INTO testColl return NEW`\n  },\n  function(err, resp) {}\n)\n```\n\n---\n\n### executeTransaction\n\nThe pattern is:\n\n* `topic`: is the store name to publish to `arango-store`\n* `cmd`: is the command to execute `executeTransaction`\n* `database`: the database to use against the query. `string` _(optional)_\n* `action`: a string evaluating to a JavaScript function to be executed on the server. `string`\n* `params`: available as variable `params` when the _action_ function is being executed on server. Check the example below. `object`\n* `collection`: If _collections_ is an array or string, it will be treated as _collections.write_. `object` _(optional)_\n  * `read`: an array of names (or a single name) of collections that will be read from during the transaction. `Array\u003cstring\u003e` _(optional)_\n  * `write`: an array of names (or a single name) of collections that will be written from during the transaction. `Array\u003cstring\u003e` _(optional)_\n* `lockTimeout`: determines how long the database will wait while attemping to gain locks on collections used by the transaction before timing out.\n  `integer`\n\nExample:\n\n```js\nvar action = String(function() {\n  return true\n})\n\nhemera.act(\n  {\n    topic: 'arango-store',\n    cmd: 'executeTransaction',\n    database: 'test',\n    action,\n    params: {\n      age: 12\n    },\n    collections: {\n      read: 'users'\n    }\n  },\n  function(err, resp) {}\n)\n```\n\n---\n\n### createDatabase\n\nThe pattern is:\n\n* `topic`: is the store name to publish to `arango-store`\n* `cmd`: is the command to execute `executeAqlQuery`\n* `name`: the name of the database. `string`\n\nExample:\n\n```js\nhemera.act(\n  {\n    topic: 'arango-store',\n    cmd: 'createDatabase',\n    name: 'test'\n  },\n  function(err, resp) {}\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhemerajs%2Fhemera-arango-store","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhemerajs%2Fhemera-arango-store","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhemerajs%2Fhemera-arango-store/lists"}