feat: Add Be and tbd skill, also added Roadmap file

This commit is contained in:
2026-05-10 16:32:12 -04:00
parent 3500ade13f
commit 0bb8885802
29587 changed files with 10611695 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
storage
node_modules

21
Skills/@be/be/node_modules/supersimplestorage/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Michiel van der Geest
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

102
Skills/@be/be/node_modules/supersimplestorage/README.md generated vendored Normal file
View File

@@ -0,0 +1,102 @@
#SuperSimpleStorage
##A simple persistance layer library to store and retrieve data in Node.js without using a full blown database.
###Introduction
Often in a Node.js application there is a need to store some pieces data. Nothing big to justify a full blown database.
For those cases SuperSimpleStorage is handy tool that allows you to easily store and retrieve data from the filesystem.
SuperSimpleStorage is able to store:
- strings
- integers
- javascript data objects (that are automatically converted to and from JSON)
###Instalation
Install SuperSimpleStorage through NPM
```
npm install supersimplestorage --save
```
This will install SuperSimpleStorage as a dependency and update your package.json automatically.
Next require SuperSimpleStorage in your Node.js script, like this:
```
var supersimplestorage = require('supersimplestorage');
```
###Usage
####Initializing the storage
Before we can store and retrieve storage items, we first need to initialize the storage. We do this by creating a new storage object. When creating a new object we can pass configuration options. When no configuration options are passed (or only partially), default values are used.
```
var storage = new SuperSimpleStorage({
storageFolder: 'my_storage_folder',
dotsToFolders: true,
fileExtension: 'txt'
});
```
The following configuration options are available:
- **storageFolder** - Folder where the storage items are stored. Defaults to '*storage*'
- **dotsToFolders** - Whether to translate a dots to slahes in order to store items in a file structure. Defaults to '*true*'
- **fileExtension** - The file extension used for the storage files. Defaults to '*data*'.
####Retrieving data from a storage item
Retrieving data from a storage item is done by calling the ```open``` method. The open-method accepts 3 parameters:
- **name** - The name of the storage item. When dotsToFolder is set to true, dots will translate to a file tree.
- **successCallback** - Function to call when the storage item has successfully been retrieved
- **errorCallback** - Function to call when an error has occurred while retrieving the item
It is important to realize that retrieving data from storage is *asynchronous*. That means that we can't assign the result of the open method directly to a variable. Instead we pass a success callback, which will receive the data as soon as it becomes available, where it can be processed further.
```
storage.open('foo', function(content) {
console.log('Successfully opened foo');
console.log(content);
}, function(error) {
console.log('An error has occured');
console.log(error);
});
```
####Saving data in a storage item
Storing data into a storage item is done by calling the ```save``` method. The save method accepts 4 parameters:
- **name** - The name of the storage item. When dotsToFolder is set to true, dots will translate to a file tree.
- **content** - The content to save in the storage item
- **successCallback** - Function to call when the storage item has successfully been saved
- **errorCallback** - Function to call when an error has occurred while storing the item
```
var data = {
'foo': 'bar',
'bar': 'foo'
}
// store JSON content
storage.save('foo.bar', data, function(content) {
console.log('The content has been saved')
}, function(error) {
console.log('An error has occured');
console.log(error);
});
```
It is important to realize that saving data in storage also is *asynchronous*. If we want to act upon successfully saving data, we have to pass a callback, which will be executed as soon as the item has been stored.

View File

@@ -0,0 +1,27 @@
var SuperSimpleStorage = require('../lib/supersimplestorage');
var storage = new SuperSimpleStorage();
var data = {
'foo': 'bar',
'bar': 'foo'
}
// store JSON content
storage.save('foo', data, function() {
// read data from foo
storage.open('foo', function(content) {
// modify content
content['foobar'] = 'foobar';
storage.save('foo.bar', content, function(result) {
console.log('saved!');
console.log(result);
})
}, function(error) {
console.log(error);
});
});

View File

@@ -0,0 +1,162 @@
/**
* SuperSimpleStorage
* A simple persistance layer library to store and retrieve data in Node.js without using a full blown database.
* version 0.0.2
* Copyright 2014 - Michiel van der Geest
*/
var fs = require('fs');
var mkdirp = require('mkdirp');
var config = require('configurazione');
module.exports = SuperSimpleStorage;
/**
* Constructor
*/
function SuperSimpleStorage(options) {
if (!(this instanceof SuperSimpleStorage)) {
return new SuperSimpleStorage(options);
}
var defaults = {
storageFolder: 'storage',
dotsToFolders: true,
fileExtension: 'data'
};
// set default and options
config.defaults(defaults);
config.options(options);
// create storage folder
mkdirp(config.get('storageFolder') , function(err) {
if(err) console.log(err);
});
}
/**
* Reads the content of a storage item and passes the content to a success callback
* @param {string} file Storage item filename. Uses dot-notation for path.
* @param {[type]} onSuccess Success callback
* @param {[type]} onError Error callback
*/
SuperSimpleStorage.prototype.open = function (file, onSuccess, onError) {
// replace dots with slashes
if(config.get('dotsToFolders'))
{
file = file.toString().replace('.', '/');
}
var fullPath = config.get('storageFolder') + '/' + file + '.' + config.get('fileExtension');
// check if the file path exists
fs.exists(fullPath, function(exists) {
if(exists)
{
fs.readFile(fullPath, 'utf-8', function(error, content) {
if(error)
{
if(typeof onError == 'function')
{
onError(error);
}
}
else
{
content = parseJsonContent(content);
if(typeof onSuccess == 'function')
{
onSuccess(content);
}
}
});
}
else {
if(typeof onError == 'function')
{
onError('Storage item not found.');
}
}
});
};
/**
* Saves content to a storage item. Create a new file if it doesn't exist yet. Overwrites an existing file if it already exists.
* @param {file} file Storage item filename. Uses dot-notation for path.
* @param {mixed} content Content to store. In case it's an object, will be transformed to JSON.
* @param {[type]} onSuccess Success callback
* @param {[type]} onError Error callback
*/
SuperSimpleStorage.prototype.save = function (file, content, onSuccess, onError) {
// replace dots with slashes
if(config.get('dotsToFolders'))
{
file = file.toString().replace('.', '/');
}
var fullPath = config.get('storageFolder') + '/' + file + '.' + config.get('fileExtension');
if(typeof content == 'object')
{
content = JSON.stringify(content);
}
// first make sure the path exists
var parts = fullPath.split('/');
delete parts[parts.length - 1];
path = parts.join('/');
mkdirp(path, function(err) {
if(err) console.log(err);
else
{
fs.writeFile(fullPath, content, function(error) {
if(error)
{
if(typeof onError == 'function')
{
onError(error);
}
}
else
{
if(typeof onSuccess == 'function')
{
onSuccess(content)
}
}
});
}
});
};
/**
* Checks if content is valid JSON format. Returns parsed JSON when it is, and the plain content when it isn't.
* @param {string} content Content
* @return {string|object} Returns an object when valid JSON. Returns a string when not.
*/
function parseJsonContent(content) {
try {
var output = JSON.parse(content);
if (output && typeof output === "object" && output !== null) {
return output;
}
}
catch (e) {}
return content;
}

View File

@@ -0,0 +1,33 @@
{
"name": "supersimplestorage",
"version": "0.0.2",
"description": "SuperSimpleStorage - A simple persistance layer library to store and retrieve data in Node.js without using a full blown database.",
"main": "lib/supersimplestorage.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git@github.com:michielvandergeest/node-supersimplestorage.git"
},
"keywords": [
"storage",
"database",
"saving",
"data",
"json",
"persistance",
"store",
"retrieve"
],
"author": "Michiel van der Geest",
"license": "MIT",
"bugs": {
"url": "https://github.com/michielvandergeest/node-supersimplestorage/issues"
},
"homepage": "https://github.com/michielvandergeest/node-supersimplestorage",
"dependencies": {
"configurazione": "0.0.1",
"mkdirp": "^0.5.0"
}
}