Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ayana/bento

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ayana/bento - npm Package Compare versions

Comparing version 1.0.0-alpha.13 to 1.0.0-alpha.14

100

build/Bento.d.ts

@@ -22,18 +22,118 @@ import { ApplicationState, Component, Plugin } from './interfaces';

createID(len?: number): string;
/**
* Alias for Bento.components.addComponent()
* @param component Component
*
* @see ComponentManager#addComponent
* @returns See Bento.components.addComponent()
*/
addComponent(component: Component): Promise<string>;
/**
* Alias for Bento.components.removeComponent()
* @param name Component name
*
* @see ComponentManager#removeComponent
* @returns See Bento.components.removeComponent()
*/
removeComponent(name: string): Promise<void>;
/**
* Alias for Bento.plugins.addPlugin()
* @param plugin Plugin
*
* @see PluginManager#addPlugin
* @returns See Bento.plugins.addPlugin()
*/
addPlugin(plugin: Plugin): Promise<string>;
/**
* Alias for Bento.plugins.removePlugin()
* @param name Plugin name
*
* @see PluginManager#removePlugin
* @returns See Bento.plugins.removePlugin()
*/
removePlugin(name: string): Promise<void>;
/**
* Alias for Bento.plugins.addPlugins()
* @param plugins Array of Plugins
*
* @see PluginManager#addPlugins
* @returns See Bento.plugins.addPlugins()
*/
addPlugins(plugins: Plugin[]): Promise<string[]>;
/**
* Alias for Bento.properties.hasProperty()
* @param name Property name
*
* @see PropertyManager#hasProperty
* @returns See Bento.properties.hasProperty()
*/
hasProperty(name: string): boolean;
/**
* Alias for Bento.properties.setProperty()
* @param name Property name
* @param value Property value
*
* @see PropertyManager#setProperty
* @returns See Bento.properties.setProperty()
*/
setProperty(name: string, value: any): void;
/**
* Alias for Bento.properties.getProperty()
* @param name Property name
*
* @see PropertyManager#getProperty
* @returns See Bento.properties.getProperty()
*/
getProperty(name: string): any;
/**
* Alias for Bento.properties.setProperties()
* @param properties Object with property key: value pairs
*
* @see PropertyManager#setProperties
* @returns See Bento.properties.setProperties()
*/
setProperties(properties: {
[key: string]: any;
}): void;
/**
* Alias for Bento.variables.hasVariable()
* @param name Variable name
*
* @see VariableManager#hasVariable
* @returns See Bento.variables.hasVariable()
*/
hasVariable(name: string): boolean;
/**
* Alias for Bento.variables.getVariable()
* @param name Variable name
*
* @see VariableManager#getVariable
* @returns See Bento.variables.getVariable()
*/
getVariable(name: string): any;
/**
* Alias for Bento.variables.setVariable()
* @param name Variable name
* @param value Variable value
*
* @see VariableManager#setVariable
* @returns See Bento.variables.setVariable()
*/
setVariable(name: string, value: any): void;
/**
* Alias for Bento.variables.deleteVariable()
* @param name Variable name
*
* @see VariableManager#deleteVariable
* @returns See Bento.variables.deleteVariable()
*/
deleteVariable(name: string): void;
/**
* Verifies the state of your Application, Will throw an error at anything
* "weird" looking. For example if any components are pending when this is
* called it will throw
*
* @returns Application state Object
*/
verify(): Promise<ApplicationState>;
}

108

build/Bento.js

@@ -26,45 +26,145 @@ 'use strict';

}
// COMPONENTS Proxy
// COMPONENTS Aliases
/**
* Alias for Bento.components.addComponent()
* @param component Component
*
* @see ComponentManager#addComponent
* @returns See Bento.components.addComponent()
*/
async addComponent(component) {
return this.components.addComponent(component);
}
/**
* Alias for Bento.components.removeComponent()
* @param name Component name
*
* @see ComponentManager#removeComponent
* @returns See Bento.components.removeComponent()
*/
async removeComponent(name) {
return this.components.removeComponent(name);
}
// PLUGINS Proxy
// PLUGINS Aliases
/**
* Alias for Bento.plugins.addPlugin()
* @param plugin Plugin
*
* @see PluginManager#addPlugin
* @returns See Bento.plugins.addPlugin()
*/
async addPlugin(plugin) {
return this.plugins.addPlugin(plugin);
}
/**
* Alias for Bento.plugins.removePlugin()
* @param name Plugin name
*
* @see PluginManager#removePlugin
* @returns See Bento.plugins.removePlugin()
*/
async removePlugin(name) {
return this.plugins.removePlugin(name);
}
/**
* Alias for Bento.plugins.addPlugins()
* @param plugins Array of Plugins
*
* @see PluginManager#addPlugins
* @returns See Bento.plugins.addPlugins()
*/
async addPlugins(plugins) {
return this.plugins.addPlugins(plugins);
}
// PROPERTIES Proxy
// PROPERTIES Aliases
/**
* Alias for Bento.properties.hasProperty()
* @param name Property name
*
* @see PropertyManager#hasProperty
* @returns See Bento.properties.hasProperty()
*/
hasProperty(name) {
return this.properties.hasProperty(name);
}
/**
* Alias for Bento.properties.setProperty()
* @param name Property name
* @param value Property value
*
* @see PropertyManager#setProperty
* @returns See Bento.properties.setProperty()
*/
setProperty(name, value) {
return this.properties.setProperty(name, value);
}
/**
* Alias for Bento.properties.getProperty()
* @param name Property name
*
* @see PropertyManager#getProperty
* @returns See Bento.properties.getProperty()
*/
getProperty(name) {
return this.properties.getProperty(name);
}
/**
* Alias for Bento.properties.setProperties()
* @param properties Object with property key: value pairs
*
* @see PropertyManager#setProperties
* @returns See Bento.properties.setProperties()
*/
setProperties(properties) {
return this.properties.setProperties(properties);
}
// VARIABLES Proxy
// VARIABLES Aliases
/**
* Alias for Bento.variables.hasVariable()
* @param name Variable name
*
* @see VariableManager#hasVariable
* @returns See Bento.variables.hasVariable()
*/
hasVariable(name) {
return this.variables.hasVariable(name);
}
/**
* Alias for Bento.variables.getVariable()
* @param name Variable name
*
* @see VariableManager#getVariable
* @returns See Bento.variables.getVariable()
*/
getVariable(name) {
return this.variables.getVariable(name);
}
/**
* Alias for Bento.variables.setVariable()
* @param name Variable name
* @param value Variable value
*
* @see VariableManager#setVariable
* @returns See Bento.variables.setVariable()
*/
setVariable(name, value) {
return this.variables.setVariable(name, value);
}
/**
* Alias for Bento.variables.deleteVariable()
* @param name Variable name
*
* @see VariableManager#deleteVariable
* @returns See Bento.variables.deleteVariable()
*/
deleteVariable(name) {
return this.variables.deleteVariable(name);
}
/**
* Verifies the state of your Application, Will throw an error at anything
* "weird" looking. For example if any components are pending when this is
* called it will throw
*
* @returns Application state Object
*/
async verify() {

@@ -71,0 +171,0 @@ // check for any pending components

2

package.json
{
"name": "@ayana/bento",
"version": "1.0.0-alpha.13",
"version": "1.0.0-alpha.14",
"description": "Modular runtime framework designed to solve complex tasks",

@@ -5,0 +5,0 @@ "repository": "https://gitlab.com/ayana/bento",

# Bento [![npm (scoped)](https://img.shields.io/npm/v/@ayana/bento.svg)](https://www.npmjs.com/package/@ayana/bento) [![Discord](https://discordapp.com/api/guilds/508903834853310474/embed.png)](https://discord.gg/eaa5pYf) [![install size](https://packagephobia.now.sh/badge?p=@ayana/bento)](https://packagephobia.now.sh/result?p=@ayana/bento)
[Documentation](https://docs.ayana.io/modules/bento.html)
[Documentation](https://docs.ayana.io/modules/bento.html) • [Examples](https://gitlab.com/ayana/bento/tree/master/examples)
Bento is a robust NodeJS application framework designed to make creating and maintaing complex projects a simple and fast process.
### What does Bento do:
## What does Bento do:
* Robust plugable application framework.

@@ -14,13 +14,41 @@ * Featuring: Components, Events, Plugins, Properties, Variables

### What is a Bento Component?
## What is a Bento Component?
Bento indroduces a concept of components. Components are logical chunks of code that all work together to provide your application to the world.
Components should not take on more then required. (IE: instead of having one component for connecting to Discord and processing messages. Have two, one for the connection and one that handles messages)
All components recieve their own ComponentAPI instance. The Component API is consistent across all components and provides a way for components to speak to eachother. As well as many other "Quality of life" features. Such as: variable injection and management, dependency management and injection, component event subscriptions, and more!
### How to use Bento (IN-PROGRESS)
Using bento is pretty simple. First import and initilize bento and any plugins you wish to use. Then simply add plugins to bento
As a rule of thumb, components should not take on more then required. (IE: instead of having one component for connecting to Discord and processing messages. Have two, one for the connection and emitting the message events, and one that handles messages)
Here is a very basic example of a Bento component:
```ts
'use strict';
import { Component, ComponentAPI } from '@ayana/bento';
export class ExampleComponent {
// this property becomes available after onLoad see ComponentAPI for more info
public api: ComponentAPI;
// required for all components, must be unique
public name: string = 'ExampleComponent';
// Optionally define other components we depend upon
// Some decorators auto append to this array such as @SubscribeEvent
public dependencies: Array<Component> = [];
// Lifecycle event, called right before component fully loaded
public async onLoad() {
console.log('Hello world!');
}
// Lifecycle event, called right before component is unloaded
public async onUnload() {
console.log('Goodbye world!');
}
}
```
A runnable version of this example is available on [Gitlab](https://gitlab.com/ayana/bento/tree/master/examples/src/bento-basic)
## How to use Bento (IN-PROGRESS)
Using Bento is pretty simple. First import and initilize Bento and any plugins you wish to use. Then simply add the plugins to Bento. The below example assumes you have a directory called "components" in the same directory (relative) to it.
```ts
import { Bento, FSComponentLoader } from '@ayana/bento';

@@ -35,3 +63,3 @@

// NOTE: Keep in mind all FSComponentLoader does is find components in a path
// Instantiates them and calls bento.addComponent
// Instantiates them and calls Bento.addComponent
// Behind the scenes

@@ -47,5 +75,7 @@ const fsloader = new FSComponentLoader();

})().catch(e => {
console.error(`Error while starting bento:\n${e}`);
console.error(`Error while starting Bento:\n${e}`);
process.exit(1);
});
```
```
More examples available [here](https://gitlab.com/ayana/bento/tree/master/examples)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc