axiodb
Version:
The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platfor
207 lines • 7.59 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuthorInfo = exports.AvailableRoutes = exports.staticPath = exports.CORS_CONFIG = exports.ServerKeys = void 0;
/* eslint-disable @typescript-eslint/no-explicit-any */
const path_1 = __importDefault(require("path"));
var ServerKeys;
(function (ServerKeys) {
ServerKeys[ServerKeys["PORT"] = 27018] = "PORT";
ServerKeys["LOCALHOST"] = "127.0.1";
ServerKeys["DEFAULT_KEY_EXPIRE"] = "24h";
ServerKeys["DEFAULT_KEY_ISSUER"] = "AxioDB Server";
ServerKeys["DEFAULT_KEY_AUDIENCE"] = "AxioDB Client";
ServerKeys["DEFAULT_KEY_REASON"] = "For Transacting with AxioDB Server";
ServerKeys[ServerKeys["DEFAULT_KEY_TIMESTAMP"] = Date.now()] = "DEFAULT_KEY_TIMESTAMP";
ServerKeys[ServerKeys["DEFAULT_KEY_ROUNDS"] = 1] = "DEFAULT_KEY_ROUNDS";
})(ServerKeys || (exports.ServerKeys = ServerKeys = {}));
// Config for CORS
exports.CORS_CONFIG = {
ORIGIN: "*",
METHODS: ["GET", "HEAD", "PUT", "PATCH", "POST", "DELETE"],
ALLOWED_HEADERS: ["Content-Type", "Authorization"],
EXPOSED_HEADERS: ["Content-Length", "X-Requested-With"],
MAX_AGE: 86400, // 24 hours in seconds
ALLOW_CREDENTIALS: true,
};
exports.staticPath = path_1.default.resolve(__dirname, "../public/AxioControl");
// Routes
exports.AvailableRoutes = [
{
groupName: "Information",
description: "Information Endpoints",
Paths: [
{
method: "GET",
path: "/api/info",
description: "To Get Internal Information about this DB",
},
{
method: "GET",
path: "/api/health",
description: "Health check endpoint to verify server status",
},
{
method: "GET",
path: "/api/routes",
description: "List all available API routes",
},
],
},
{
groupName: "Database",
description: "Database Management Endpoints",
Paths: [
{
method: "GET",
path: "/api/db/databases/",
description: "Get a list of all databases",
},
{
method: "POST",
path: "/api/db/create-database/",
description: "Create a new database",
payload: {
name: "string",
},
},
{
method: "DELETE",
path: "/api/db/delete-database/",
description: "Delete a database",
payload: {
name: "string",
},
},
{
method: "GET",
path: "/api/db/export-database/?dbName",
description: "Export a database as a compressed file",
},
{
method: "POST",
path: "/api/db/import-database/",
description: "Import a database from a compressed file",
payload: {
file: "file",
},
},
],
},
{
groupName: "Collection",
description: "Collection Management Endpoints",
Paths: [
{
method: "GET",
path: "/api/collection/all/?databaseName",
description: "Get a list of all collections",
},
{
method: "POST",
path: "/api/collection/create-collection/",
description: "Create a new collection",
payload: {
dbName: "string",
collectionName: "string",
crypto: "boolean",
key: "string",
},
},
{
method: "DELETE",
path: "/api/collection/delete-collection/?dbName&collectionName",
description: "Delete a collection",
},
],
},
{
groupName: "CRUD Operations",
description: "CRUD Operations Endpoints",
Paths: [
{
method: "GET",
description: "Get all documents from a collection",
path: "/api/operation/all/?dbName&collectionName&page",
},
{
method: "POST",
description: "Get all documents from a collection by query",
path: "/api/operation/all/by-query/?dbName&collectionName&page",
payload: {
query: "object",
},
},
{
method: "GET",
description: "Get specific documents from a collection by ID",
path: "/api/operation/all/by-id/?dbName&collectionName&documentId",
},
{
method: "POST",
description: "Create a new document in a collection",
path: "/api/operation/create/?dbName&collectionName",
payload: {
document: "full object with no key in body",
},
},
{
method: "POST",
description: "Create a new document in a collection",
path: "/api/operation/create-many/?dbName&collectionName",
payload: {
documents: "full array of object with no key in body",
},
},
{
method: "PUT",
description: "Update an existing document in a collection by ID",
path: "/api/operation/update/by-id/?dbName&collectionName&documentId",
payload: {
document: "full object with no key in body",
},
},
{
method: "PUT",
description: "Update an existing document in a collection by query",
path: "/api/operation/update/by-query/?dbName&isMany&collectionName",
payload: {
query: "object",
update: "object",
},
},
{
method: "DELETE",
description: "Delete an existing document in a collection by ID",
path: "/api/operation/delete/by-id/?dbName&collectionName&documentId",
},
{
method: "DELETE",
description: "Delete an existing document in a collection by query",
path: "/api/operation/delete/by-query/?dbName&collectionName&isMany&documentId",
payload: {
query: "object",
},
},
{
method: "POST",
description: "Perform aggregation on documents in a collection using an aggregation pipeline",
path: "/api/operation/aggregate/?dbName&collectionName",
payload: {
aggregation: "array",
},
},
],
},
];
exports.AuthorInfo = {
name: "Ankan Saha",
Designation: "Software Engineer",
Country: "India",
Email: "ankansahaofficial@gmail.com",
LinkedIn: "https://www.linkedin.com/in/theankansaha/",
github: "https://github.com/AnkanSaha",
};
//# sourceMappingURL=keys.js.map