axiodb 1.1.0 → 1.1.1

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.
@@ -1,10 +1,10 @@
1
+ import { ErrorInterface, SuccessInterface } from "../config/Interfaces/Helper/response.helper.interface";
1
2
  export default class Insertion {
2
- private readonly Operator;
3
3
  private readonly collectionName;
4
4
  private readonly data;
5
5
  private documentId;
6
6
  constructor(collectionName: string, data: object | any);
7
- Save(): Promise<any>;
7
+ Save(): Promise<SuccessInterface | ErrorInterface | undefined>;
8
8
  private generateUniqueDocumentId;
9
9
  private setDocumentID;
10
10
  }
@@ -17,7 +17,6 @@ const outers_1 = require("outers");
17
17
  const response_helper_1 = __importDefault(require("../Helper/response.helper"));
18
18
  class Insertion {
19
19
  constructor(collectionName, data) {
20
- this.Operator = new FileManager_1.default();
21
20
  this.collectionName = collectionName;
22
21
  this.data = data;
23
22
  this.documentId = null;
@@ -25,7 +24,7 @@ class Insertion {
25
24
  }
26
25
  Save() {
27
26
  return __awaiter(this, void 0, void 0, function* () {
28
- const response = yield this.Operator.WriteFile(`${this.collectionName}/${this.documentId}.json`, JSON.stringify(this.data));
27
+ const response = yield new FileManager_1.default().WriteFile(`${this.collectionName}/${this.documentId}.json`, JSON.stringify(this.data));
29
28
  if (response.status) {
30
29
  return yield new response_helper_1.default().Success({
31
30
  Message: "Data Inserted Successfully",
@@ -41,7 +40,7 @@ class Insertion {
41
40
  let ID;
42
41
  do {
43
42
  ID = new outers_1.ClassBased.UniqueGenerator(15).RandomWord(true);
44
- const response = yield this.Operator.FileExists(`${this.collectionName}/${ID}.json`);
43
+ const response = yield new FileManager_1.default().FileExists(`${this.collectionName}/${ID}.json`);
45
44
  response.status ? (isExist = true) : (isExist = false);
46
45
  } while (isExist == false);
47
46
  return ID;
@@ -1 +1 @@
1
- {"version":3,"file":"Create.operation.js","sourceRoot":"","sources":["../../source/Operation/Create.operation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,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AAO,IAAI,KAAK,EAAE;YAE3B,OAAO,EAAE,CAAC;QACZ,CAAC;KAAA;IAKO,aAAa;QACnB,IAAI,CAAC,wBAAwB,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;YAC1C,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAnED,4BAmEC"}
1
+ {"version":3,"file":"Create.operation.js","sourceRoot":"","sources":["../../source/Operation/Create.operation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,yEAAiD;AACjD,mCAAoC;AACpC,gFAAuD;AASvD,MAAqB,SAAS;IAU5B,YAAY,cAAsB,EAAE,IAAkB;QACpD,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IAMY,IAAI;;YACf,MAAM,QAAQ,GAAG,MAAM,IAAI,qBAAW,EAAE,CAAC,SAAS,CAChD,GAAG,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,UAAU,OAAO,EAChD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAC1B,CAAC;YAEF,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;gBACpB,OAAO,MAAM,IAAI,yBAAc,EAAE,CAAC,OAAO,CAAC;oBACxC,OAAO,EAAE,4BAA4B;oBACrC,UAAU,EAAE,IAAI,CAAC,UAAU;oBAC3B,IAAI,oBACC,IAAI,CAAC,IAAI,CACb;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;KAAA;IAMa,wBAAwB;;YACpC,IAAI,OAAO,CAAC;YACZ,IAAI,EAAE,CAAC;YACP,GAAG,CAAC;gBACF,EAAE,GAAG,IAAI,mBAAU,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;gBACzD,MAAM,QAAQ,GAAG,MAAM,IAAI,qBAAW,EAAE,CAAC,UAAU,CACjD,GAAG,IAAI,CAAC,cAAc,IAAI,EAAE,OAAO,CACpC,CAAC;gBAEF,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;YACzD,CAAC,QAAQ,OAAO,IAAI,KAAK,EAAE;YAE3B,OAAO,EAAE,CAAC;QACZ,CAAC;KAAA;IAKO,aAAa;QACnB,IAAI,CAAC,wBAAwB,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;YAC1C,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAjED,4BAiEC"}
@@ -1,20 +1,11 @@
1
- import { SuccessInterface, ErrorInterface } from "../config/Interfaces/Helper/response.helper.interface";
2
- export default class AxioDB {
3
- #private;
4
- private readonly collectionName;
1
+ export declare class AxioDB {
2
+ private readonly RootName;
5
3
  private readonly Schema;
6
- private isEncrypted;
7
- private readonly clusterName;
8
- private readonly currentPATH;
9
- private collectionPath;
10
- constructor(collectionName: string, Schema?: object | any, isEncrypted?: boolean, ClusterName?: string);
11
- getSchema(): object | any;
12
- EncryptionStatus(): boolean;
13
- getEncryptionKey(): string;
14
- setEncryptionKey(key: string): void;
15
- setEncryptionStatus(status: boolean): void;
16
- getConfiguration(): object | any;
17
- Insert(data: object | any): Promise<SuccessInterface | ErrorInterface>;
18
- CreateTreeRoot(): Promise<void>;
19
- private createCollection;
4
+ private currentPATH;
5
+ private DBNamePath;
6
+ private MetaData;
7
+ private MetaFileLocation;
8
+ constructor();
9
+ CreateTreeRoot(): Promise<AxioDB>;
10
+ createDatabase(DBName: string): Promise<AxioDB>;
20
11
  }
@@ -8,97 +8,44 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
12
- if (kind === "m") throw new TypeError("Private method is not writable");
13
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
14
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
15
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
16
- };
17
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
19
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
- };
22
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
23
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
13
  };
25
- var _AxioDB_encryptionKey;
26
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.AxioDB = void 0;
16
+ const FileManager_1 = __importDefault(require("../Storage/FileManager"));
27
17
  const FolderManager_1 = __importDefault(require("../Storage/FolderManager"));
28
18
  const Keys_1 = require("../config/Keys/Keys");
29
19
  const path_1 = __importDefault(require("path"));
30
- const Create_operation_1 = __importDefault(require("./Create.operation"));
31
- const response_helper_1 = __importDefault(require("../Helper/response.helper"));
32
20
  class AxioDB {
33
- constructor(collectionName, Schema, isEncrypted = false, ClusterName = Keys_1.General.DBMS_Name) {
34
- _AxioDB_encryptionKey.set(this, void 0);
35
- this.collectionName = collectionName;
36
- this.Schema = Schema;
37
- this.isEncrypted = isEncrypted;
38
- __classPrivateFieldSet(this, _AxioDB_encryptionKey, Keys_1.General.DBMS_Name, "f");
39
- this.clusterName = ClusterName;
21
+ constructor() {
22
+ this.RootName = Keys_1.General.DBMS_Name;
40
23
  this.currentPATH = path_1.default.resolve(".");
41
- this.collectionPath = `${this.currentPATH}/${this.clusterName}/${this.collectionName}`;
42
- }
43
- getSchema() {
44
- return this.Schema;
45
- }
46
- EncryptionStatus() {
47
- return this.isEncrypted;
48
- }
49
- getEncryptionKey() {
50
- return __classPrivateFieldGet(this, _AxioDB_encryptionKey, "f");
51
- }
52
- setEncryptionKey(key) {
53
- __classPrivateFieldSet(this, _AxioDB_encryptionKey, key, "f");
54
- }
55
- setEncryptionStatus(status) {
56
- this.isEncrypted = status;
57
- }
58
- getConfiguration() {
59
- return {
60
- Schema: this.getSchema(),
61
- Encryption: {
62
- Status: this.EncryptionStatus(),
63
- Key: this.getEncryptionKey(),
64
- },
65
- };
66
- }
67
- Insert(data) {
68
- return __awaiter(this, void 0, void 0, function* () {
69
- const response = yield new Create_operation_1.default(this.collectionName, data).Save();
70
- if (response.status) {
71
- return new response_helper_1.default().Success({
72
- Message: "Data Inserted Successfully",
73
- DocumentID: response.data.DocumentID,
74
- Data: Object.assign({}, response.data.Data),
75
- });
76
- }
77
- else {
78
- return new response_helper_1.default().Error({
79
- Message: "Failed to Insert Data",
80
- });
81
- }
82
- });
24
+ this.DBNamePath = "./";
25
+ this.MetaData = {};
26
+ this.MetaFileLocation = "";
83
27
  }
84
28
  CreateTreeRoot() {
85
29
  return __awaiter(this, void 0, void 0, function* () {
86
- yield new FolderManager_1.default().CreateDirectory(`${this.currentPATH}/${this.clusterName}`);
30
+ yield new FolderManager_1.default().CreateDirectory((this.currentPATH = `${this.currentPATH}/${this.RootName}`));
31
+ yield new FileManager_1.default().CreateFile((this.MetaFileLocation = `${this.currentPATH}/${this.RootName}.${Keys_1.General.DBMS_File_EXT}`));
32
+ return this;
87
33
  });
88
34
  }
89
- createCollection() {
35
+ createDatabase(DBName) {
90
36
  return __awaiter(this, void 0, void 0, function* () {
91
- if (this.isEncrypted) {
92
- yield new FolderManager_1.default().CreateDirectory(`${this.currentPATH}/${this.clusterName}/${this.collectionName}/Encrypted`);
93
- this.collectionPath = `${this.currentPATH}/${this.clusterName}/${this.collectionName}/Encrypted`;
37
+ if (DBName) {
38
+ yield new FolderManager_1.default().CreateDirectory(`${this.currentPATH}/${DBName}/`);
39
+ this.DBNamePath = `${this.currentPATH}/${DBName}/`;
40
+ this.currentPATH = `${this.currentPATH}/${DBName}/`;
41
+ console.log(`Collection Directory Created: ${this.currentPATH}`);
42
+ return this;
94
43
  }
95
44
  else {
96
- yield new FolderManager_1.default().CreateDirectory(`${this.currentPATH}/${this.clusterName}/${this.collectionName}`);
97
- this.collectionPath = `${this.currentPATH}/${this.clusterName}/${this.collectionName}`;
45
+ return this;
98
46
  }
99
47
  });
100
48
  }
101
49
  }
102
- _AxioDB_encryptionKey = new WeakMap();
103
- exports.default = AxioDB;
50
+ exports.AxioDB = AxioDB;
104
51
  //# sourceMappingURL=Indexation.operation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Indexation.operation.js","sourceRoot":"","sources":["../../source/Operation/Indexation.operation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,6EAAqD;AACrD,8CAA8C;AAC9C,gDAAwB;AACxB,0EAA2C;AAC3C,gFAAuD;AASvD,MAAqB,MAAM;IAiBzB,YACE,cAAsB,EACtB,MAAqB,EACrB,cAAuB,KAAK,EAC5B,cAAsB,cAAO,CAAC,SAAS;QAhBzC,wCAAuB;QAkBrB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,uBAAA,IAAI,yBAAkB,cAAO,CAAC,SAAS,MAAA,CAAC;QACxC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,GAAG,IAAI,C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,EAAE,CAAC,eAAe,CACvC,CAAC,IAAI,CAAC,WAAW,GAAG,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAC5D,CAAC;YACF,MAAM,IAAI,qBAAW,EAAE,CAAC,UAAU,CAChC,CAAC,IAAI,CAAC,gBAAgB,GAAG,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,QAAQ,IAAI,cAAO,CAAC,aAAa,EAAE,CAAC,CAC1F,CAAC;YACF,OAAO,IAAI,CAAC;QACd,CAAC;KAAA;IAMY,cAAc,CAAC,MAAc;;YACxC,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,IAAI,uBAAa,EAAE,CAAC,eAAe,CACvC,GAAG,IAAI,CAAC,WAAW,IAAI,MAAM,GAAG,CACjC,CAAC;gBAEF,IAAI,CAAC,UAAU,GAAG,GAAG,IAAI,CAAC,WAAW,IAAI,MAAM,GAAG,CAAC;gBACnD,IAAI,CAAC,WAAW,GAAG,GAAG,IAAI,CAAC,WAAW,IAAI,MAAM,GAAG,CAAC;gBAEpD,OAAO,CAAC,GAAG,CAAC,iCAAiC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;gBACjE,OAAO,IAAI,CAAC;YACd,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF;AAhED,wBAgEC"}
@@ -1,8 +1,5 @@
1
- import FileSystemSync from "fs";
2
1
  import { ErrorInterface, SuccessInterface } from "../config/Interfaces/Helper/response.helper.interface";
3
2
  export default class FileManager {
4
- private readonly fileSystem;
5
- private readonly fileSystemSync;
6
3
  private readonly responseHelper;
7
4
  constructor();
8
5
  WriteFile(path: string, data: string): Promise<SuccessInterface | ErrorInterface>;
@@ -14,6 +11,4 @@ export default class FileManager {
14
11
  UnlockFile(path: string): Promise<SuccessInterface | ErrorInterface>;
15
12
  MoveFile(oldPath: string, newPath: string): Promise<SuccessInterface | ErrorInterface>;
16
13
  IsFileLocked(path: string): Promise<SuccessInterface | ErrorInterface>;
17
- CreateReadStream(path: string): Promise<ErrorInterface | FileSystemSync.ReadStream>;
18
- CreateWriteStream(path: string): Promise<ErrorInterface | FileSystemSync.WriteStream>;
19
14
  }
@@ -13,41 +13,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const promises_1 = __importDefault(require("fs/promises"));
16
- const fs_1 = __importDefault(require("fs"));
17
16
  const response_helper_1 = __importDefault(require("../Helper/response.helper"));
18
17
  class FileManager {
19
18
  constructor() {
20
- this.fileSystem = promises_1.default;
21
- this.fileSystemSync = fs_1.default;
22
19
  this.responseHelper = new response_helper_1.default();
23
20
  }
24
21
  WriteFile(path, data) {
25
22
  return __awaiter(this, void 0, void 0, function* () {
26
23
  try {
27
- const SuccesResponse = yield this.fileSystem.writeFile(path, data);
28
- return yield this.responseHelper.Success(SuccesResponse);
24
+ yield promises_1.default.writeFile(path, data, "utf-8");
25
+ return this.responseHelper.Success("File written successfully.");
29
26
  }
30
27
  catch (error) {
31
- return yield this.responseHelper.Error(error);
28
+ return this.responseHelper.Error(error);
32
29
  }
33
30
  });
34
31
  }
35
32
  ReadFile(path) {
36
33
  return __awaiter(this, void 0, void 0, function* () {
37
34
  try {
38
- const ReadResponse = yield this.fileSystem.readFile(path, "utf-8");
39
- return yield this.responseHelper.Success(ReadResponse);
35
+ const data = yield promises_1.default.readFile(path, "utf-8");
36
+ return this.responseHelper.Success(data);
40
37
  }
41
38
  catch (error) {
42
- return yield this.responseHelper.Error(error);
39
+ return this.responseHelper.Error(error);
43
40
  }
44
41
  });
45
42
  }
46
43
  DeleteFile(path) {
47
44
  return __awaiter(this, void 0, void 0, function* () {
48
45
  try {
49
- const DeleteResponse = yield this.fileSystem.unlink(path);
50
- return this.responseHelper.Success(DeleteResponse);
46
+ yield promises_1.default.unlink(path);
47
+ return this.responseHelper.Success("File deleted successfully.");
51
48
  }
52
49
  catch (error) {
53
50
  return this.responseHelper.Error(error);
@@ -57,30 +54,24 @@ class FileManager {
57
54
  FileExists(path) {
58
55
  return __awaiter(this, void 0, void 0, function* () {
59
56
  try {
60
- const ExistsResponse = yield this.fileSystem.access(path);
61
- return this.responseHelper.Success(ExistsResponse);
57
+ yield promises_1.default.access(path);
58
+ return this.responseHelper.Success(true);
62
59
  }
63
- catch (error) {
64
- return this.responseHelper.Error(error);
60
+ catch (_a) {
61
+ return this.responseHelper.Success(false);
65
62
  }
66
63
  });
67
64
  }
68
65
  CreateFile(path) {
69
66
  return __awaiter(this, void 0, void 0, function* () {
70
- try {
71
- const CreateResponse = yield this.fileSystem.writeFile(path, "");
72
- return this.responseHelper.Success(CreateResponse);
73
- }
74
- catch (error) {
75
- return this.responseHelper.Error(error);
76
- }
67
+ return this.WriteFile(path, "");
77
68
  });
78
69
  }
79
70
  LockFile(path) {
80
71
  return __awaiter(this, void 0, void 0, function* () {
81
72
  try {
82
- const LockResponse = yield this.fileSystem.chmod(path, 0o400);
83
- return this.responseHelper.Success(LockResponse);
73
+ yield promises_1.default.chmod(path, 0o400);
74
+ return this.responseHelper.Success("File locked successfully.");
84
75
  }
85
76
  catch (error) {
86
77
  return this.responseHelper.Error(error);
@@ -90,8 +81,8 @@ class FileManager {
90
81
  UnlockFile(path) {
91
82
  return __awaiter(this, void 0, void 0, function* () {
92
83
  try {
93
- const UnlockResponse = yield this.fileSystem.chmod(path, 0o777);
94
- return this.responseHelper.Success(UnlockResponse);
84
+ yield promises_1.default.chmod(path, 0o777);
85
+ return this.responseHelper.Success("File unlocked successfully.");
95
86
  }
96
87
  catch (error) {
97
88
  return this.responseHelper.Error(error);
@@ -101,8 +92,8 @@ class FileManager {
101
92
  MoveFile(oldPath, newPath) {
102
93
  return __awaiter(this, void 0, void 0, function* () {
103
94
  try {
104
- const MoveResponse = yield this.fileSystem.rename(oldPath, newPath);
105
- return this.responseHelper.Success(MoveResponse);
95
+ yield promises_1.default.rename(oldPath, newPath);
96
+ return this.responseHelper.Success("File moved successfully.");
106
97
  }
107
98
  catch (error) {
108
99
  return this.responseHelper.Error(error);
@@ -112,34 +103,14 @@ class FileManager {
112
103
  IsFileLocked(path) {
113
104
  return __awaiter(this, void 0, void 0, function* () {
114
105
  try {
115
- const Stats = yield this.fileSystem.stat(path);
116
- return this.responseHelper.Success(Stats.mode.toString(8).slice(-3) === "400");
106
+ const stats = yield promises_1.default.stat(path);
107
+ return this.responseHelper.Success((stats.mode & 0o777) === 0o400);
117
108
  }
118
109
  catch (error) {
119
110
  return this.responseHelper.Error(error);
120
111
  }
121
112
  });
122
113
  }
123
- CreateReadStream(path) {
124
- return __awaiter(this, void 0, void 0, function* () {
125
- try {
126
- return this.fileSystemSync.createReadStream(path);
127
- }
128
- catch (error) {
129
- return yield this.responseHelper.Error(error);
130
- }
131
- });
132
- }
133
- CreateWriteStream(path) {
134
- return __awaiter(this, void 0, void 0, function* () {
135
- try {
136
- return this.fileSystemSync.createWriteStream(path);
137
- }
138
- catch (error) {
139
- return yield this.responseHelper.Error(error);
140
- }
141
- });
142
- }
143
114
  }
144
115
  exports.default = FileManager;
145
116
  //# sourceMappingURL=FileManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FileManager.js","sourceRoot":"","sources":["../../source/Storage/FileManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2DAAqC;AACrC,4CAAgC;AAGhC,gFAAuD;AASvD,MAAqB,WAAW;IAW9B;QACE,IAAI,CAAC,UAAU,GAAG,kBAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,YAAc,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,IAAI,yBAAc,EAAE,CAAC;IAC7C,CAAC;IASY,SAAS,CACpB,IAAY,EACZ,IAAY;;YAEZ,IAAI,CAAC;gBACH,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBACnE,OAAO,MAAM,I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,CAAC;QACH,CAAC;KAAA;IAEY,YAAY,CACvB,IAAY;;YAEZ,IAAI,CAAC;gBACH,MAAM,KAAK,GAAG,MAAM,kBAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAClC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC;YACrE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;KAAA;CACF;AAtGD,8BAsGC"}
@@ -24,89 +24,89 @@ class FolderManager {
24
24
  CreateDirectory(path) {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
26
  try {
27
- const CreateResponse = yield this.fileSystem.mkdir(path);
28
- return this.responseHelper.Success(CreateResponse);
27
+ yield this.fileSystem.mkdir(path, { recursive: true });
28
+ return this.responseHelper.Success(`Directory created at: ${path}`);
29
29
  }
30
30
  catch (error) {
31
- return this.responseHelper.Error(error);
31
+ return this.responseHelper.Error(`Failed to create directory: ${error}`);
32
32
  }
33
33
  });
34
34
  }
35
35
  DeleteDirectory(path) {
36
36
  return __awaiter(this, void 0, void 0, function* () {
37
37
  try {
38
- const DeleteResponse = yield this.fileSystem.rmdir(path);
39
- return this.responseHelper.Success(DeleteResponse);
38
+ yield this.fileSystem.rm(path, { recursive: true, force: true });
39
+ return this.responseHelper.Success(`Directory deleted: ${path}`);
40
40
  }
41
41
  catch (error) {
42
- return this.responseHelper.Error(error);
42
+ return this.responseHelper.Error(`Failed to delete directory: ${error}`);
43
43
  }
44
44
  });
45
45
  }
46
46
  DirectoryExists(path) {
47
47
  return __awaiter(this, void 0, void 0, function* () {
48
48
  try {
49
- const ExistsResponse = yield this.fileSystem.access(path);
50
- return this.responseHelper.Success(ExistsResponse);
49
+ yield this.fileSystem.access(path);
50
+ return this.responseHelper.Success(true);
51
51
  }
52
- catch (error) {
53
- return this.responseHelper.Error(error);
52
+ catch (_a) {
53
+ return this.responseHelper.Success(false);
54
54
  }
55
55
  });
56
56
  }
57
57
  ListDirectory(path) {
58
58
  return __awaiter(this, void 0, void 0, function* () {
59
59
  try {
60
- const ListResponse = yield this.fileSystem.readdir(path);
61
- return this.responseHelper.Success(ListResponse);
60
+ const contents = yield this.fileSystem.readdir(path);
61
+ return this.responseHelper.Success(contents);
62
62
  }
63
63
  catch (error) {
64
- return this.responseHelper.Error(error);
64
+ return this.responseHelper.Error(`Failed to list directory: ${error}`);
65
65
  }
66
66
  });
67
67
  }
68
68
  MoveDirectory(oldPath, newPath) {
69
69
  return __awaiter(this, void 0, void 0, function* () {
70
70
  try {
71
- const MoveResponse = yield this.fileSystem.rename(oldPath, newPath);
72
- return this.responseHelper.Success(MoveResponse);
71
+ yield this.fileSystem.rename(oldPath, newPath);
72
+ return this.responseHelper.Success(`Moved directory to: ${newPath}`);
73
73
  }
74
74
  catch (error) {
75
- return this.responseHelper.Error(error);
75
+ return this.responseHelper.Error(`Failed to move directory: ${error}`);
76
76
  }
77
77
  });
78
78
  }
79
79
  LockDirectory(path) {
80
80
  return __awaiter(this, void 0, void 0, function* () {
81
81
  try {
82
- const LockResponse = yield this.fileSystem.chmod(path, 0o400);
83
- return this.responseHelper.Success(LockResponse);
82
+ yield this.fileSystem.chmod(path, 0o400);
83
+ return this.responseHelper.Success(`Directory locked: ${path}`);
84
84
  }
85
85
  catch (error) {
86
- return this.responseHelper.Error(error);
86
+ return this.responseHelper.Error(`Failed to lock directory: ${error}`);
87
87
  }
88
88
  });
89
89
  }
90
90
  UnlockDirectory(path) {
91
91
  return __awaiter(this, void 0, void 0, function* () {
92
92
  try {
93
- const UnlockResponse = yield this.fileSystem.chmod(path, 0o777);
94
- return this.responseHelper.Success(UnlockResponse);
93
+ yield this.fileSystem.chmod(path, 0o777);
94
+ return this.responseHelper.Success(`Directory unlocked: ${path}`);
95
95
  }
96
96
  catch (error) {
97
- return this.responseHelper.Error(error);
97
+ return this.responseHelper.Error(`Failed to unlock directory: ${error}`);
98
98
  }
99
99
  });
100
100
  }
101
101
  IsDirectoryLocked(path) {
102
102
  return __awaiter(this, void 0, void 0, function* () {
103
103
  try {
104
- const Stats = yield this.fileSystem.stat(path);
105
- const IsLocked = Stats.mode.toString(8).slice(-3) === "400";
106
- return this.responseHelper.Success(IsLocked);
104
+ const stats = yield this.fileSystem.stat(path);
105
+ const isLocked = (stats.mode & 0o400) === 0o400;
106
+ return this.responseHelper.Success(isLocked);
107
107
  }
108
108
  catch (error) {
109
- return this.responseHelper.Error(error);
109
+ return this.responseHelper.Error(`Failed to check lock status: ${error}`);
110
110
  }
111
111
  });
112
112
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FolderManager.js","sourceRoot":"","sources":["../../source/Storage/FolderManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2DAAqC;AACrC,4CAAgC;AAGhC,gFAAuD;AAMvD,MAAqB,aAAa;IAKhC;QACE,IAAI,CAAC,UAAU,GAAG,kBAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,YAAc,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,IAAI,yBAAc,EAAE,CAAC;IAC7C,CAAC;IAQY,eAAe,CAC1B,IAAY;;YAEZ,IAAI,CAAC;gBACH,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBACzD,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;YACrD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;KAAA;IAQY,eAAe,CAC1B,IAAY;;YAEZ,IAAI,CAAC;gBACH,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CA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KAAA;IAKY,eAAe,CAC1B,IAAY;;YAEZ,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;gBACzC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;YACpE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,+BAA+B,KAAK,EAAE,CAAC,CAAC;YAC3E,CAAC;QACH,CAAC;KAAA;IAKY,iBAAiB,CAC5B,IAAY;;YAEZ,IAAI,CAAC;gBACH,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC/C,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,KAAK,KAAK,CAAC;gBAChD,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC/C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,gCAAgC,KAAK,EAAE,CAAC,CAAC;YAC5E,CAAC;QACH,CAAC;KAAA;CACF;AA5HD,gCA4HC"}
@@ -1,7 +1,7 @@
1
1
  import { SchemaTypes } from "../Models/DataTypes.models";
2
2
  import schemaValidate from "../Models/validator.models";
3
- import Configure from "../Operation/Indexation.operation";
4
- export { SchemaTypes, schemaValidate, Configure };
3
+ import { AxioDB } from "../Operation/Indexation.operation";
4
+ export { SchemaTypes, schemaValidate, AxioDB };
5
5
  declare const _default: {
6
6
  SchemaTypes: {
7
7
  string: <TSchema = string>() => import("joi").StringSchema<TSchema>;
@@ -29,6 +29,6 @@ declare const _default: {
29
29
  valid: (values: any[]) => import("joi").Schema<any>;
30
30
  };
31
31
  schemaValidate: typeof schemaValidate;
32
- Configure: typeof Configure;
32
+ AxioDB: typeof AxioDB;
33
33
  };
34
34
  export default _default;
package/lib/config/DB.js CHANGED
@@ -3,20 +3,18 @@ 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.schemaValidate = exports.SchemaTypes = void 0;
7
- const Keys_1 = require("./Keys/Keys");
6
+ exports.AxioDB = exports.schemaValidate = exports.SchemaTypes = void 0;
8
7
  const DataTypes_models_1 = require("../Models/DataTypes.models");
9
8
  Object.defineProperty(exports, "SchemaTypes", { enumerable: true, get: function () { return DataTypes_models_1.SchemaTypes; } });
10
9
  const validator_models_1 = __importDefault(require("../Models/validator.models"));
11
10
  exports.schemaValidate = validator_models_1.default;
12
- const Indexation_operation_1 = __importDefault(require("../Operation/Indexation.operation"));
13
- exports.Configure = Indexation_operation_1.default;
11
+ const Indexation_operation_1 = require("../Operation/Indexation.operation");
12
+ Object.defineProperty(exports, "AxioDB", { enumerable: true, get: function () { return Indexation_operation_1.AxioDB; } });
14
13
  const Fastify_1 = __importDefault(require("../server/Fastify"));
15
14
  (0, Fastify_1.default)();
16
- new Indexation_operation_1.default(Keys_1.General.DBMS_Name).CreateTreeRoot().then((r) => console.log(r));
17
15
  exports.default = {
18
16
  SchemaTypes: DataTypes_models_1.SchemaTypes,
19
17
  schemaValidate: validator_models_1.default,
20
- Configure: Indexation_operation_1.default,
18
+ AxioDB: Indexation_operation_1.AxioDB,
21
19
  };
22
20
  //# sourceMappingURL=DB.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DB.js","sourceRoot":"","sources":["../../source/config/DB.ts"],"names":[],"mappings":";;;;;;AACA,sCAAsC;AACtC,iEAAyD;AAWhD,4FAXA,8BAAW,OAWA;AAVpB,kFAAwD;AAUlC,yBAVf,0BAAc,CAUe;AATpC,6FAA0D;AASpB,oBAT/B,8BAAS,CAS+B;AAP/C,gEAA0C;AAG1C,IAAA,iBAAS,GAAE,CAAC;AACZ,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"}
1
+ {"version":3,"file":"DB.js","sourceRoot":"","sources":["../../source/config/DB.ts"],"names":[],"mappings":";;;;;;AACA,iEAAyD;AAUhD,4FAVA,8BAAW,OAUA;AATpB,kFAAwD;AASlC,yBATf,0BAAc,CASe;AARpC,4EAA2D;AAQrB,uFAR7B,6BAAM,OAQ6B;AAN5C,gEAA0C;AAG1C,IAAA,iBAAS,GAAE,CAAC;AAMZ,kBAAe;IACb,WAAW,EAAX,8BAAW;IACX,cAAc,EAAd,0BAAc;IACd,MAAM,EAAN,6BAAM;CACP,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axiodb",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
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",
@@ -52,4 +52,4 @@
52
52
  "typescript": "^5.6.2",
53
53
  "typescript-eslint": "^8.8.0"
54
54
  }
55
- }
55
+ }