action-entity

0.0.1 • Public • Published

Action Entity Documentation

Table of Contents

  1. Introduction
  2. Installation
  3. Getting Started
  4. Supported Operations
  5. Usage
  6. Sample Plugin
  7. Additional Information

Introduction

This documentation provides instructions for using the "Action Entity" class in your JavaScript project. "Action Entity" is a powerful utility for database/resource operations when coupled with a compatible plugin.

Installation

Before using "Action Entity," you need to include it in your project. You can install it via different methods.

Using script src

Include the "Action Entity" library in your HTML file using a <script> tag:

<script src="path/to/actionEntity.js"></script>
<script>
  // To create an instance of Action Entity, you need to provide a compatible plugin.
  // Example plugin initialization
  const plugin = new ActionPlugin();
  const ae = new ActionEntity(plugin);
</script>

Using script type="module

  1. Import the module in your HTML file using a <script type="module"> tag:
<script type="module">
  import ActionEntity from "/path/to/actionEntity.js";
  import ActionPlugin from "/path/to/actionPlugin.js";
  
  // Create an instance of the Action Plugin
  const plugin = new ActionPlugin();

  // Create an instance of Action Entity with the plugin
  const ae = new ActionEntity(plugin);
</script>

Using CommonJS

  1. Require the module in your JavaScript file:
   const ActionEntity = require("action-entity");
   const ActionPlugin = require("action-plugin");
  1. Ensure the plugin is correctly configured and available.
// Create an instance of the Action Plugin
const plugin = new ActionPlugin();

// Create an instance of Action Entity with the plugin
const ae = new ActionEntity(plugin);

Getting Started

Before you can use "Action Entity," you must configure and provide a compatible plugin.

Plugin Configuration

"Action Entity" relies on a plugin for database/resource interaction. Ensure that the plugin is correctly configured and available. You can create an instance of the plugin and pass it to the "Action Entity" constructor, as shown in the usage examples.

Supported Operations

The "Action Entity" class supports various database operations, including:

  • create: Create a new record in the database/resource.
  • insert: Insert data into the database/resource.
  • insertOne: Insert one data item into the database/resource.
  • get: Retrieve data from the database/resource.
  • getOne: Retrieve one data item from the database/resource.
  • update: Update data in the database/resource.
  • updateOne: Update one data item in the database/resource.
  • delete: Delete data from the database/resource.
  • deleteOne: Delete one data item from the database/resource.
  • append: Append data to a resource.

These operations require a correctly configured and available plugin for database/resource interaction. Without the plugin, "Action Entity" will not function as expected.

Usage

Once you have imported the "Action Entity" class and created an instance with a plugin, you can start using it for various database operations. Here are four usage cases:

Case 1: Using script src with Plugin Availability

Include the "Action Entity" library using a <script> tag and ensure the plugin is correctly configured and available.

<script src="path/to/actionEntity.js"></script>
<script src="path/to/actionPlugin.js"></script>
<script>
  // Create an instance of the Action Plugin
  const plugin = new ActionPlugin();
  
  // Create an instance of Action Entity with the plugin
  const ae = new ActionEntity(plugin);
</script>

Case 2: Using script type="module with Plugin Availability

  1. Import the module in your HTML file using a <script type="module"> tag:
<script type="module">
  import ActionEntity from "/path/to/actionEntity.js";
  import ActionPlugin from "/path/to/actionPlugin.js";
  
  // Create an instance of the Action Plugin
  const plugin = new ActionPlugin();

  // Create an instance of Action Entity with the plugin
  const ae = new ActionEntity(plugin);
</script>

Case 3: Using CommonJS with Plugin Availability

  1. Require the module in your JavaScript file:

    const ActionEntity = require("action-entity");
    const ActionPlugin = require("action-plugin");
  2. Ensure the plugin is correctly configured and available.

// Create an instance of the Action Plugin
const plugin = new ActionPlugin();

// Create an instance of Action Entity with the plugin
const ae = new ActionEntity(plugin);

Case 4: Using ESM without Plugin Availability

import ActionEntity from "action-entity";

// Create an 'ae' instance without a plugin
const ae = new ActionEntity();

// The 'ae' instance will not work for database operations without a compatible plugin

Sample Plugin

You can create a custom plugin for your specific database/resource. Below is an example of a simple plugin:

class ActionPlugin {
  constructor() {
    // Your plugin initialization logic here
  }

  // Define your plugin methods for create, insert, get, update, and delete
}

module.exports = ActionPlugin;

Additional Information

For more information and detailed documentation, please refer to the official repository or documentation provided with the "Action Entity" library.

Repository

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Readme

Keywords

none

Package Sidebar

Install

npm i action-entity

Weekly Downloads

2

Version

0.0.1

License

ISC

Unpacked Size

812 kB

Total Files

41

Last publish

Collaborators

  • brajesh825