1.3.2 • Published 10 months ago

@coffeeblackai/aperturedb-node v1.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

ApertureDB Node.js SDK

License: MIT TypeScript

A Node.js SDK for interacting with ApertureDB, providing a simple and intuitive interface for database operations.

Installation

To install directly from GitHub, add the following to your package.json dependencies:

{
  "dependencies": {
    "@coffeeblackai/aperturedb-node": "coffeeblackai/aperturedb-node"
  }
}

Or install using npm:

npm install github:coffeeblackai/aperturedb-node

Or using yarn:

yarn add github:coffeeblackai/aperturedb-node

Configuration

Ensure you have a .env file in the root of your project with the following variables:

APERTURE_HOST=<your-aperture-host>
APERTURE_USER=<your-aperture-username>
APERTURE_PASSWORD=<your-aperture-password>

Basic Usage

Raw Query

To execute a raw query, you can use the rawQuery method of the ApertureClient. Here is an example:

const query = [{
  "FindEntity": {
    "with_class": "test",
    "results": {
      "all_properties": true
    }
  }
}];

const [response, blobs] = await client.rawQuery(query);
console.log(response);

Entity Operations

You can perform various entity operations such as finding entities with specific constraints:

const query = [{
  "FindEntity": {
    "with_class": "test",
    "constraints": {
      "name": ["==", "test_entity"]
    },
    "results": {
      "all_properties": true
    }
  }
}];

const [response, blobs] = await client.rawQuery(query);
console.log(response);

Entity Operations

Creating a New Entity

To create a new entity, use the addEntity method:

const entity = await client.entities.addEntity('dataset', {
  name: 'test-dataset',
  description: 'A test dataset'
});

Finding an Entity by Name

To find an entity by name, use the findEntities method:

const entities = await client.entities.findEntities({ 
  with_class: 'dataset',
  constraints: { name: ['==', 'test-dataset'] }
});
console.log(entities);

Updating an Entity

To update an entity's properties, use the updateEntity method:

await client.entities.updateEntity({
  with_class: 'dataset',
  properties: { description: 'An updated test dataset' },
  constraints: { _uniqueid: ['==', testEntityId] }
});

Deleting an Entity

To delete an entity, use the deleteEntity method:

await client.entities.deleteEntity({
  class: 'dataset',
  constraints: { _uniqueid: ['==', testEntityId] }
});
1.3.2

10 months ago

1.3.1

10 months ago

1.3.0

10 months ago

1.2.1

10 months ago

1.2.0

10 months ago

1.1.10

10 months ago

1.1.9

10 months ago

1.1.8

10 months ago

1.1.7

10 months ago

1.1.6

10 months ago

1.1.5

10 months ago

1.1.4

10 months ago

1.1.0

10 months ago