action-entity
v0.0.1
Published
## Table of Contents
Downloads
3
Readme
Action Entity Documentation
Table of Contents
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
- 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
- Require the module in your JavaScript file:
const ActionEntity = require("action-entity");
const ActionPlugin = require("action-plugin");
- 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
- 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
Require the module in your JavaScript file:
const ActionEntity = require("action-entity"); const ActionPlugin = require("action-plugin");
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
- Repository: Link to the Action Entity Repository
License
This project is licensed under the MIT License - see the LICENSE.md file for details.