axiodb 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.idea/AxioDB.iml +12 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/lib/Operation/Create.operation.d.ts +7 -0
- package/lib/Operation/Create.operation.js +45 -0
- package/lib/Operation/Create.operation.js.map +1 -0
- package/lib/Operation/Indexation.operation.d.ts +6 -2
- package/lib/Operation/Indexation.operation.js +23 -4
- package/lib/Operation/Indexation.operation.js.map +1 -1
- package/lib/config/DB.d.ts +1 -5
- package/lib/config/DB.js +4 -8
- package/lib/config/DB.js.map +1 -1
- package/package.json +1 -1
package/.idea/AxioDB.iml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
package/.idea/vcs.xml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const FileManager_1 = __importDefault(require("../Storage/FileManager"));
|
|
16
|
+
const outers_1 = require("outers");
|
|
17
|
+
const response_helper_1 = __importDefault(require("../Helper/response.helper"));
|
|
18
|
+
class Insertion {
|
|
19
|
+
constructor(collectionName, data) {
|
|
20
|
+
this.Operator = new FileManager_1.default();
|
|
21
|
+
this.collectionName = collectionName;
|
|
22
|
+
this.data = data;
|
|
23
|
+
}
|
|
24
|
+
;
|
|
25
|
+
Save() {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
let isExist;
|
|
28
|
+
let ID;
|
|
29
|
+
do {
|
|
30
|
+
ID = new outers_1.ClassBased.UniqueGenerator(15).RandomWord(true);
|
|
31
|
+
const response = yield this.Operator.FileExists(`${this.collectionName}/${ID}.json`);
|
|
32
|
+
response.status ? isExist = true : isExist = false;
|
|
33
|
+
} while (isExist == false);
|
|
34
|
+
const response = yield this.Operator.WriteFile(`${this.collectionName}/${ID}.json`, JSON.stringify(this.data));
|
|
35
|
+
if (response.status) {
|
|
36
|
+
return yield new response_helper_1.default().Success(({
|
|
37
|
+
Message: "Data Saved Successfully",
|
|
38
|
+
Data: Object.assign({ ID }, this.data)
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.default = Insertion;
|
|
45
|
+
//# sourceMappingURL=Create.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
export default class AxioDB {
|
|
2
2
|
#private;
|
|
3
|
+
private readonly collectionName;
|
|
3
4
|
private readonly Schema;
|
|
4
5
|
private isEncrypted;
|
|
5
6
|
private readonly clusterName;
|
|
6
7
|
private readonly currentPATH;
|
|
7
|
-
|
|
8
|
+
private collectionPath;
|
|
9
|
+
constructor(collectionName: string, Schema?: object | any, isEncrypted?: boolean, ClusterName?: string);
|
|
8
10
|
getSchema(): object | any;
|
|
9
11
|
EncryptionStatus(): boolean;
|
|
10
12
|
getEncryptionKey(): string;
|
|
11
13
|
setEncryptionKey(key: string): void;
|
|
12
14
|
setEncryptionStatus(status: boolean): void;
|
|
13
15
|
getConfiguration(): object | any;
|
|
14
|
-
|
|
16
|
+
Insert(data: object | any): Promise<void>;
|
|
17
|
+
CreateTreeRoot(): Promise<void>;
|
|
18
|
+
private createCollection;
|
|
15
19
|
}
|
|
@@ -24,18 +24,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
var _AxioDB_encryptionKey;
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
const
|
|
27
|
+
const FolderManager_1 = __importDefault(require("../Storage/FolderManager"));
|
|
28
28
|
const Keys_1 = require("../config/Keys/Keys");
|
|
29
29
|
const path_1 = __importDefault(require("path"));
|
|
30
|
+
const Create_operation_1 = __importDefault(require("./Create.operation"));
|
|
30
31
|
class AxioDB {
|
|
31
|
-
constructor(Schema, isEncrypted = false, ClusterName = Keys_1.General.DBMS_Name) {
|
|
32
|
+
constructor(collectionName, Schema, isEncrypted = false, ClusterName = Keys_1.General.DBMS_Name) {
|
|
32
33
|
_AxioDB_encryptionKey.set(this, void 0);
|
|
34
|
+
this.collectionName = collectionName;
|
|
33
35
|
this.Schema = Schema;
|
|
34
36
|
this.isEncrypted = isEncrypted;
|
|
35
37
|
__classPrivateFieldSet(this, _AxioDB_encryptionKey, Keys_1.General.DBMS_Name, "f");
|
|
36
38
|
this.clusterName = ClusterName;
|
|
37
39
|
this.currentPATH = path_1.default.resolve(".");
|
|
38
|
-
this.
|
|
40
|
+
this.collectionPath = `${this.currentPATH}/${this.clusterName}/${this.collectionName}`;
|
|
39
41
|
}
|
|
40
42
|
getSchema() {
|
|
41
43
|
return this.Schema;
|
|
@@ -61,9 +63,26 @@ class AxioDB {
|
|
|
61
63
|
},
|
|
62
64
|
};
|
|
63
65
|
}
|
|
66
|
+
Insert(data) {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
yield new Create_operation_1.default(this.collectionName, data).Save();
|
|
69
|
+
});
|
|
70
|
+
}
|
|
64
71
|
CreateTreeRoot() {
|
|
65
72
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
-
yield new
|
|
73
|
+
yield new FolderManager_1.default().CreateDirectory(`${this.currentPATH}/${this.clusterName}`);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
createCollection() {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
if (this.isEncrypted) {
|
|
79
|
+
yield new FolderManager_1.default().CreateDirectory(`${this.currentPATH}/${this.clusterName}/${this.collectionName}/Encrypted`);
|
|
80
|
+
this.collectionPath = `${this.currentPATH}/${this.clusterName}/${this.collectionName}/Encrypted`;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
yield new FolderManager_1.default().CreateDirectory(`${this.currentPATH}/${this.clusterName}/${this.collectionName}`);
|
|
84
|
+
this.collectionPath = `${this.currentPATH}/${this.clusterName}/${this.collectionName}`;
|
|
85
|
+
}
|
|
67
86
|
});
|
|
68
87
|
}
|
|
69
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Indexation.operation.js","sourceRoot":"","sources":["../../source/Operation/Indexation.operation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,
|
|
1
|
+
{"version":3,"file":"Index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E;aAC7B;SACF,CAAC;IACJ,CAAC;IAGa,MAAM,CAAC,IAAkB;;YACrC,MAAM,IAAI,0BAAS,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QACxD,CAAC;KAAA;IAWY,cAAc;;YACzB,MAAM,IAAI,uBAAa,EAAE,CAAC,eAAe,CACvC,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,EAAE,CAC1C,CAAC;QACJ,CAAC;KAAA;IAEc,gBAAgB;;YAC7B,IAAG,IAAI,CAAC,WAAW,EAAC,CAAC;gBACnB,MAAM,IAAI,uBAAa,EAAE,CAAC,eAAe,CACnC,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,cAAc,YAAY,CAC7E,CAAC;gBACJ,IAAI,CAAC,cAAc,GAAG,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,cAAc,YAAY,CAAC;YACnG,CAAC;iBACI,CAAC;gBACJ,MAAM,IAAI,uBAAa,EAAE,CAAC,eAAe,CACrC,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,cAAc,EAAE,CACnE,CAAC;gBACA,IAAI,CAAC,cAAc,GAAG,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YAC3F,CAAC;QACH,CAAC;KAAA;CACF;;kBA1FoB,MAAM"}
|
package/lib/config/DB.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { SchemaTypes } from "../Models/DataTypes.models";
|
|
2
2
|
import schemaValidate from "../Models/validator.models";
|
|
3
|
-
import FileManager from "../Storage/FileManager";
|
|
4
|
-
import FolderManager from "../Storage/FolderManager";
|
|
5
3
|
import Configure from "../Operation/Indexation.operation";
|
|
6
|
-
export { SchemaTypes, schemaValidate,
|
|
4
|
+
export { SchemaTypes, schemaValidate, Configure };
|
|
7
5
|
declare const _default: {
|
|
8
6
|
SchemaTypes: {
|
|
9
7
|
string: <TSchema = string>() => import("joi").StringSchema<TSchema>;
|
|
@@ -31,8 +29,6 @@ declare const _default: {
|
|
|
31
29
|
valid: (values: any[]) => import("joi").Schema<any>;
|
|
32
30
|
};
|
|
33
31
|
schemaValidate: typeof schemaValidate;
|
|
34
|
-
FileManager: typeof FileManager;
|
|
35
32
|
Configure: typeof Configure;
|
|
36
|
-
FolderManager: typeof FolderManager;
|
|
37
33
|
};
|
|
38
34
|
export default _default;
|
package/lib/config/DB.js
CHANGED
|
@@ -3,24 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Configure = exports.
|
|
6
|
+
exports.Configure = exports.schemaValidate = exports.SchemaTypes = void 0;
|
|
7
|
+
const Keys_1 = require("./Keys/Keys");
|
|
7
8
|
const DataTypes_models_1 = require("../Models/DataTypes.models");
|
|
8
9
|
Object.defineProperty(exports, "SchemaTypes", { enumerable: true, get: function () { return DataTypes_models_1.SchemaTypes; } });
|
|
9
10
|
const validator_models_1 = __importDefault(require("../Models/validator.models"));
|
|
10
11
|
exports.schemaValidate = validator_models_1.default;
|
|
11
|
-
const FileManager_1 = __importDefault(require("../Storage/FileManager"));
|
|
12
|
-
exports.FileManager = FileManager_1.default;
|
|
13
|
-
const FolderManager_1 = __importDefault(require("../Storage/FolderManager"));
|
|
14
|
-
exports.FolderManager = FolderManager_1.default;
|
|
15
12
|
const Indexation_operation_1 = __importDefault(require("../Operation/Indexation.operation"));
|
|
16
13
|
exports.Configure = Indexation_operation_1.default;
|
|
17
14
|
const Fastify_1 = __importDefault(require("../Web/Fastify"));
|
|
18
|
-
(0, Fastify_1.default)();
|
|
15
|
+
(0, Fastify_1.default)().then((r) => console.log(r));
|
|
16
|
+
new Indexation_operation_1.default(Keys_1.General.DBMS_Name).CreateTreeRoot().then((r) => console.log(r));
|
|
19
17
|
exports.default = {
|
|
20
18
|
SchemaTypes: DataTypes_models_1.SchemaTypes,
|
|
21
19
|
schemaValidate: validator_models_1.default,
|
|
22
|
-
FileManager: FileManager_1.default,
|
|
23
20
|
Configure: Indexation_operation_1.default,
|
|
24
|
-
FolderManager: FolderManager_1.default,
|
|
25
21
|
};
|
|
26
22
|
//# sourceMappingURL=DB.js.map
|
package/lib/config/DB.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DB.js","sourceRoot":"","sources":["../../source/config/DB.ts"],"names":[],"mappings":";;;;;;AACA,iEAAyD;
|
|
1
|
+
{"version":3,"file":"DB.js","sourceRoot":"","sources":["../../source/config/DB.ts"],"names":[],"mappings":";;;;;;AACA,sCAAoC;AACpC,iEAAyD;AAYhD,4FAZA,8BAAW,OAYA;AAXpB,kFAAwD;AAWlC,yBAXf,0BAAc,CAWe;AAVpC,6FAA0D;AAUpB,oBAV/B,8BAAS,CAU+B;AAR/C,6DAAuC;AAIvC,IAAA,iBAAS,GAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACxC,IAAI,8BAAS,CAAC,cAAO,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAM9E,kBAAe;IACb,WAAW,EAAX,8BAAW;IACX,cAAc,EAAd,0BAAc;IACd,SAAS,EAAT,8BAAS;CACV,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "axiodb",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "A fast, lightweight, and scalable open-source DBMS for modern apps. Supports JSON-based data storage, simple APIs, and secure data management. Ideal for projects needing efficient and flexible database solutions.",
|
|
5
5
|
"main": "./lib/config/DB.js",
|
|
6
6
|
"types": "./lib/config/DB.d.ts",
|