axiodb 1.0.1 → 1.0.2

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,56 +1,8 @@
1
1
  import { ErrorInterface, SuccessInterface } from "../config/Interfaces/Helper/response.helper.interface";
2
- /**
3
- * @class ResponseHelper
4
- * @description A helper class to standardize API responses.
5
- *
6
- * @property {number} SucessCode - The HTTP status code for a successful response.
7
- * @property {number} ErrorCode - The HTTP status code for an error response.
8
- *
9
- * @constructor
10
- * Initializes the ResponseHelper with default status codes.
11
- *
12
- * @method Success
13
- * @async
14
- * @param {any} [data] - Optional data to include in the success response.
15
- * @returns {Promise<SuccessInterface>} A promise that resolves to a success response object.
16
- *
17
- * @method Error
18
- * @async
19
- * @param {string} [message] - Optional error message to include in the error response.
20
- * @returns {Promise<ErrorInterface>} A promise that resolves to an error response object.
21
- */
22
- /**
23
- * A helper class for generating standardized success and error response objects.
24
- *
25
- * @remarks
26
- * This class provides methods to generate success and error responses with predefined status codes.
27
- * It uses the `StatusCodes` enumeration to set the HTTP status codes for success and error responses.
28
- *
29
- * @example
30
- * ```typescript
31
- * const responseHelper = new ResponseHelper();
32
- * const successResponse = await responseHelper.Success({ key: 'value' });
33
- * const errorResponse = await responseHelper.Error('An error occurred');
34
- * ```
35
- *
36
- * @public
37
- */
38
2
  export default class ResponseHelper {
39
3
  private SucessCode;
40
4
  private ErrorCode;
41
5
  constructor();
42
- /**
43
- * Generates a success response object.
44
- *
45
- * @param data - Optional data to include in the success response.
46
- * @returns A promise that resolves to a success response object implementing the SuccessInterface.
47
- */
48
6
  Success(data?: any): Promise<SuccessInterface>;
49
- /**
50
- * Generates an error response object.
51
- *
52
- * @param {string} [message] - Optional error message to include in the response.
53
- * @returns {Promise<ErrorInterface>} A promise that resolves to an error response object.
54
- */
55
7
  Error(message?: any): Promise<ErrorInterface>;
56
8
  }
@@ -9,56 +9,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- // Purpose: Helper class for response.
13
12
  const outers_1 = require("outers");
14
- /* eslint-disable @typescript-eslint/no-explicit-any */
15
- /**
16
- * @class ResponseHelper
17
- * @description A helper class to standardize API responses.
18
- *
19
- * @property {number} SucessCode - The HTTP status code for a successful response.
20
- * @property {number} ErrorCode - The HTTP status code for an error response.
21
- *
22
- * @constructor
23
- * Initializes the ResponseHelper with default status codes.
24
- *
25
- * @method Success
26
- * @async
27
- * @param {any} [data] - Optional data to include in the success response.
28
- * @returns {Promise<SuccessInterface>} A promise that resolves to a success response object.
29
- *
30
- * @method Error
31
- * @async
32
- * @param {string} [message] - Optional error message to include in the error response.
33
- * @returns {Promise<ErrorInterface>} A promise that resolves to an error response object.
34
- */
35
- /**
36
- * A helper class for generating standardized success and error response objects.
37
- *
38
- * @remarks
39
- * This class provides methods to generate success and error responses with predefined status codes.
40
- * It uses the `StatusCodes` enumeration to set the HTTP status codes for success and error responses.
41
- *
42
- * @example
43
- * ```typescript
44
- * const responseHelper = new ResponseHelper();
45
- * const successResponse = await responseHelper.Success({ key: 'value' });
46
- * const errorResponse = await responseHelper.Error('An error occurred');
47
- * ```
48
- *
49
- * @public
50
- */
51
13
  class ResponseHelper {
52
14
  constructor() {
53
15
  this.SucessCode = outers_1.StatusCodes.OK;
54
16
  this.ErrorCode = outers_1.StatusCodes.INTERNAL_SERVER_ERROR;
55
17
  }
56
- /**
57
- * Generates a success response object.
58
- *
59
- * @param data - Optional data to include in the success response.
60
- * @returns A promise that resolves to a success response object implementing the SuccessInterface.
61
- */
62
18
  Success(data) {
63
19
  return __awaiter(this, void 0, void 0, function* () {
64
20
  return {
@@ -68,12 +24,6 @@ class ResponseHelper {
68
24
  };
69
25
  });
70
26
  }
71
- /**
72
- * Generates an error response object.
73
- *
74
- * @param {string} [message] - Optional error message to include in the response.
75
- * @returns {Promise<ErrorInterface>} A promise that resolves to an error response object.
76
- */
77
27
  Error(message) {
78
28
  return __awaiter(this, void 0, void 0, function* () {
79
29
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"response.helper.js","sourceRoot":"","sources":["../../source/Helper/response.helper.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,sCAAsC;AACtC,mCAAqC;AAQrC,uDAAuD;AACvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH;;;;;;;;;;;;;;;GAeG;AACH,MAAqB,cAAc;IAKjC;QACE,IAAI,CAAC,UAAU,GAAG,oBAAW,CAAC,EAAE,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,oBAAW,CAAC,qBAAqB,CAAC;IACrD,CAAC;IAED;;;;;OAKG;IACU,OAAO,CAAC,IAAU;;YAC7B,OAAO;gBACL,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,IAAI;aACX,CAAC;QACJ,CAAC;KAAA;IAED;;;;;OAKG;IACU,KAAK,CAAC,OAAa;;YAC9B,OAAO;gBACL,UAAU,EAAE,IAAI,CAAC,SAAS;gBAC1B,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,OAAO;aACjB,CAAC;QACJ,CAAC;KAAA;CACF;AArCD,iCAqCC"}
1
+ {"version":3,"file":"response.helper.js","sourceRoot":"","sources":["../../source/Helper/response.helper.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,mCAAqC;AA6CrC,MAAqB,cAAc;IAKjC;QACE,IAAI,CAAC,UAAU,GAAG,oBAAW,CAAC,EAAE,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,oBAAW,CAAC,qBAAqB,CAAC;IACrD,CAAC;IAQY,OAAO,CAAC,IAAU;;YAC7B,OAAO;gBACL,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,IAAI;aACX,CAAC;QACJ,CAAC;KAAA;IAQY,KAAK,CAAC,OAAa;;YAC9B,OAAO;gBACL,UAAU,EAAE,IAAI,CAAC,SAAS;gBAC1B,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE,OAAO;aACjB,CAAC;QACJ,CAAC;KAAA;CACF;AArCD,iCAqCC"}
@@ -4,9 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.SchemaTypes = void 0;
7
- /* eslint-disable @typescript-eslint/no-explicit-any */
8
7
  const joi_1 = __importDefault(require("joi"));
9
- // Create an object to hold all Joi types under the name SchemaTypes
10
8
  exports.SchemaTypes = {
11
9
  string: joi_1.default.string,
12
10
  number: joi_1.default.number,
@@ -18,7 +16,6 @@ exports.SchemaTypes = {
18
16
  func: joi_1.default.func,
19
17
  ref: joi_1.default.ref,
20
18
  any: joi_1.default.any,
21
- // Add additional types from Joi if needed
22
19
  alphanum: joi_1.default.string().alphanum,
23
20
  email: joi_1.default.string().email,
24
21
  guid: joi_1.default.string().guid,
@@ -1 +1 @@
1
- {"version":3,"file":"DataTypes.models.js","sourceRoot":"","sources":["../../source/Models/DataTypes.models.ts"],"names":[],"mappings":";;;;;;AAAA,uDAAuD;AACvD,8CAAsB;AAEtB,oEAAoE;AACvD,QAAA,WAAW,GAAG;IACzB,MAAM,EAAE,aAAG,CAAC,MAAM;IAClB,MAAM,EAAE,aAAG,CAAC,MAAM;IAClB,OAAO,EAAE,aAAG,CAAC,OAAO;IACpB,MAAM,EAAE,aAAG,CAAC,MAAM;IAClB,KAAK,EAAE,aAAG,CAAC,KAAK;IAChB,IAAI,EAAE,aAAG,CAAC,IAAI;IACd,MAAM,EAAE,aAAG,CAAC,MAAM;IAClB,IAAI,EAAE,aAAG,CAAC,IAAI;IACd,GAAG,EAAE,aAAG,CAAC,GAAG;IACZ,GAAG,EAAE,aAAG,CAAC,GAAG;IACZ,0CAA0C;IAC1C,QAAQ,EAAE,aAAG,CAAC,MAAM,EAAE,CAAC,QAAQ;IAC/B,KAAK,EAAE,aAAG,CAAC,MAAM,E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
4
- *
5
- * @param dataSchema - The Joi schema to validate against.
6
- * @param data - The data to be validated.
7
- * @returns A promise that resolves with the validated data if validation is successful, or rejects with a validation error.
8
- */
9
2
  export default function schemaValidate(dataSchema: Schema, data: any): Promise<any>;
@@ -13,21 +13,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.default = schemaValidate;
16
- /* eslint-disable @typescript-eslint/no-explicit-any */
17
- const joi_1 = __importDefault(require("joi")); // Ensure to import Joi correctly
18
- /**
19
- * Validates the provided data against the given Joi schema.
20
- *
21
- * @param dataSchema - The Joi schema to validate against.
22
- * @param data - The data to be validated.
23
- * @returns A promise that resolves with the validated data if validation is successful, or rejects with a validation error.
24
- */
16
+ const joi_1 = __importDefault(require("joi"));
25
17
  function schemaValidate(dataSchema, data) {
26
18
  return __awaiter(this, void 0, void 0, function* () {
27
19
  try {
28
- // Use Joi.object() correctly to wrap the schema and validate data.
29
- const joiSchema = joi_1.default.object(dataSchema); // Converts the provided schema to a Joi object
30
- return yield joiSchema.validateAsync(data); // Validate the actual data against the schema
20
+ const joiSchema = joi_1.default.object(dataSchema);
21
+ return yield joiSchema.validateAsync(data);
31
22
  }
32
23
  catch (error) {
33
24
  return error;
@@ -1 +1 @@
1
- {"version":3,"file":"validator.models.js","sourceRoot":"","sources":["../../source/Models/validator.models.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAUA,iCAQC;AAlBD,uDAAuD;AACvD,8CAAkC,CAAC,iCAAiC;AAEpE;;;;;;GAMG;AACH,SAA8B,cAAc,CAAC,UAAkB,EAAE,IAAS;;QACxE,IAAI,CAAC;YACH,mEAAmE;YACnE,MAAM,SAAS,GAAG,aAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,+CAA+C;YACzF,OAAO,MAAM,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,8CAA8C;QAC5F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CAAA"}
1
+ {"version":3,"file":"validator.models.js","sourceRoot":"","sources":["../../source/Models/validator.models.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAUA,iCAQC;AAjBD,8CAAkC;AASlC,SAA8B,cAAc,CAAC,UAAkB,EAAE,IAAS;;QACxE,IAAI,CAAC;YAEH,MAAM,SAAS,GAAG,aAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACzC,OAAO,MAAM,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CAAA"}
@@ -11,13 +11,5 @@ export default class Configure {
11
11
  setEncryptionKey(key: string): void;
12
12
  setEncryptionStatus(status: boolean): void;
13
13
  getConfiguration(): object | any;
14
- /**
15
- * Creates the root directory for the tree structure.
16
- *
17
- * This method initializes the root directory using the cluster name.
18
- * It utilizes the FolderManager to create the directory asynchronously.
19
- *
20
- * @returns {Promise<void>} A promise that resolves when the directory is created.
21
- */
22
14
  private CreateTreeRoot;
23
15
  }
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -25,20 +24,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
25
24
  };
26
25
  var _Configure_encryptionKey;
27
26
  Object.defineProperty(exports, "__esModule", { value: true });
28
- // Import Libraries
29
27
  const DB_1 = require("../config/DB");
30
28
  const path_1 = __importDefault(require("path"));
31
29
  class Configure {
32
30
  constructor(Schema, isEncrypted = false, ClusterName = DB_1.DBMS_Name) {
33
- _Configure_encryptionKey.set(this, void 0); // Private Property
31
+ _Configure_encryptionKey.set(this, void 0);
34
32
  this.Schema = Schema;
35
33
  this.isEncrypted = isEncrypted;
36
34
  __classPrivateFieldSet(this, _Configure_encryptionKey, DB_1.DBMS_Name, "f");
37
35
  this.clusterName = ClusterName;
38
36
  this.currentPATH = path_1.default.resolve(".");
39
- this.CreateTreeRoot(); // Create
37
+ this.CreateTreeRoot();
40
38
  }
41
- // Configure Method
42
39
  getSchema() {
43
40
  return this.Schema;
44
41
  }
@@ -63,15 +60,6 @@ class Configure {
63
60
  },
64
61
  };
65
62
  }
66
- // Internal Functions
67
- /**
68
- * Creates the root directory for the tree structure.
69
- *
70
- * This method initializes the root directory using the cluster name.
71
- * It utilizes the FolderManager to create the directory asynchronously.
72
- *
73
- * @returns {Promise<void>} A promise that resolves when the directory is created.
74
- */
75
63
  CreateTreeRoot() {
76
64
  return __awaiter(this, void 0, void 0, function* () {
77
65
  yield new DB_1.FolderManager().CreateDirectory(`${this.currentPATH}/${this.clusterName}`);
@@ -1 +1 @@
1
- {"version":3,"file":"Indexation.operation.js","sourceRoot":"","sources":["../../source/Operation/Indexation.operation.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;;;;;;;;;;;;;;;;;;;;;;;;AAEvD,mBAAmB;AACnB,qCAAwD;AACxD,gDAAwB;AAExB,MAAqB,SAAS;IAQ5B,YACE,MAAoB,EACpB,WAAW,GAAG,KAAK,EACnB,cAAsB,cAAS;QAPjC,2CAAuB,CAAC,mBAAmB;QASzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,uBAAA,IAAI,4BAAkB,cAAS,MAAA,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,SAAS;IAClC,CAAC;IAED,mBAAmB;IACZ,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEM,gBAAgB;QACrB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAEM,gBAAgB;QACrB,OAAO,uBAAA,IAAI,gCAAe,CAAC;IAC7B,CAAC;IAEM,gBAAgB,CAAC,GAAW;QACjC,uBAAA,IAAI,4BAAkB,GAAG,MAAA,CAAC;IAC5B,CAAC;IAEM,mBAAmB,CAAC,MAAe;QACxC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;IAC5B,CAAC;IAEM,gBAAgB;QACrB,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE;YACxB,UAAU,EAAE;gBACV,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE;gBAC/B,GAAG,EAAE,IAAI,CAAC,gBAAgB,EAAE;aAC7B;SACF,CAAC;IACJ,CAAC;IAED,qBAAqB;IACrB;;;;;;;OAOG;IACW,cAAc;;YAC1B,MAAM,IAAI,kBAAa,EAAE,CAAC,eAAe,CACvC,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,EAAE,CAC1C,CAAC;QACJ,CAAC;KAAA;CACF;;kBAlEoB,SAAS"}
1
+ {"version":3,"file":"Indexation.operation.js","sourceRoot":"","sources":["../../source/Operation/Indexation.operation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,qCAAwD;AACxD,gDAAwB;AAExB,MAAqB,SAAS;IAQ5B,YACE,MAAoB,EACpB,WAAW,GAAG,KAAK,EACnB,cAAsB,cAAS;QAPjC,2CAAuB;QASrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,uBAAA,IAAI,4BAAkB,cAAS,MAAA,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACrC,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAGM,SAAS;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAEM,gBAAgB;QACrB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAEM,gBAAgB;QACrB,OAAO,uBAAA,IAAI,gCAAe,CAAC;IAC7B,CAAC;IAEM,gBAAgB,CAAC,GAAW;QACjC,uBAAA,IAAI,4BAAkB,GAAG,MAAA,CAAC;IAC5B,CAAC;IAEM,mBAAmB,CAAC,MAAe;QACxC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;IAC5B,CAAC;IAEM,gBAAgB;QACrB,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE;YACxB,UAAU,EAAE;gBACV,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE;gBAC/B,GAAG,EAAE,IAAI,CAAC,gBAAgB,EAAE;aAC7B;SACF,CAAC;IACJ,CAAC;IAWa,cAAc;;YAC1B,MAAM,IAAI,kBAAa,EAAE,CAAC,eAAe,CACvC,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,EAAE,CAC1C,CAAC;QACJ,CAAC;KAAA;CACF;;kBAlEoB,SAAS"}
@@ -1,100 +1,19 @@
1
1
  import FileSystemSync from "fs";
2
2
  import { ErrorInterface, SuccessInterface } from "../config/Interfaces/Helper/response.helper.interface";
3
- /**
4
- * Class responsible for managing file operations.
5
- */
6
3
  export default class FileManager {
7
- /**
8
- * Reference to the file system module.
9
- */
10
4
  private readonly fileSystem;
11
5
  private readonly fileSystemSync;
12
6
  private readonly responseHelper;
13
- /**
14
- * Initializes a new instance of the FileManager class.
15
- */
16
7
  constructor();
17
- /**
18
- * Writes data to a file at the specified path.
19
- *
20
- * @param path - The path where the file will be written.
21
- * @param data - The data to write to the file.
22
- * @returns A promise that resolves when the file has been written.
23
- */
24
8
  WriteFile(path: string, data: string): Promise<SuccessInterface | ErrorInterface>;
25
- /**
26
- * Reads data from a file at the specified path.
27
- *
28
- * @param path - The path of the file to read.
29
- * @returns A promise that resolves with the data read from the file.
30
- */
31
9
  ReadFile(path: string): Promise<SuccessInterface | ErrorInterface>;
32
- /**
33
- * Deletes a file at the specified path.
34
- *
35
- * @param path - The path of the file to delete.
36
- * @returns A promise that resolves when the file has been deleted.
37
- */
38
10
  DeleteFile(path: string): Promise<SuccessInterface | ErrorInterface>;
39
- /**
40
- * Checks if a file exists at the specified path.
41
- *
42
- * @param path - The path of the file to check.
43
- * @returns A promise that resolves with a boolean indicating if the file exists.
44
- */
45
11
  FileExists(path: string): Promise<SuccessInterface | ErrorInterface>;
46
- /**
47
- * Creates a new file at the specified path.
48
- *
49
- * @param path - The path of the file to create.
50
- * @returns A promise that resolves when the file has been created.
51
- */
52
12
  CreateFile(path: string): Promise<SuccessInterface | ErrorInterface>;
53
- /**
54
- * Locks a file at the specified path.
55
- *
56
- * @param path - The path of the file to lock.
57
- * @returns A promise that resolves when the file has been locked.
58
- */
59
13
  LockFile(path: string): Promise<SuccessInterface | ErrorInterface>;
60
- /**
61
- * Unlocks a file at the specified path.
62
- *
63
- * @param path - The path of the file to unlock.
64
- * @returns A promise that resolves when the file has been unlocked.
65
- */
66
14
  UnlockFile(path: string): Promise<SuccessInterface | ErrorInterface>;
67
- /**
68
- * Moves a file from the specified old path to the new path.
69
- *
70
- * @param oldPath - The current path of the file to be moved.
71
- * @param newPath - The destination path where the file should be moved.
72
- * @returns A promise that resolves to a SuccessInterface if the file is moved successfully,
73
- * or an ErrorInterface if an error occurs during the move operation.
74
- */
75
15
  MoveFile(oldPath: string, newPath: string): Promise<SuccessInterface | ErrorInterface>;
76
- /**
77
- * Checks if a file is locked by examining its file mode.
78
- *
79
- * @param path - The path to the file to check.
80
- * @returns A promise that resolves to a `SuccessInterface` if the file is locked,
81
- * or an `ErrorInterface` if an error occurs.
82
- *
83
- * The file is considered locked if its mode (permissions) ends with "400".
84
- */
85
16
  IsFileLocked(path: string): Promise<SuccessInterface | ErrorInterface>;
86
- /**
87
- * Creates a read stream for the file at the specified path.
88
- *
89
- * @param path - The path of the file to read.
90
- * @returns A read stream for the file.
91
- */
92
17
  CreateReadStream(path: string): Promise<ErrorInterface | FileSystemSync.ReadStream>;
93
- /**
94
- * Creates a write stream for the file at the specified path.
95
- *
96
- * @param path - The path of the file to write.
97
- * @returns A write stream for the file.
98
- */
99
18
  CreateWriteStream(path: string): Promise<ErrorInterface | FileSystemSync.WriteStream>;
100
19
  }
@@ -14,27 +14,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const promises_1 = __importDefault(require("fs/promises"));
16
16
  const fs_1 = __importDefault(require("fs"));
17
- // Import Helpers
18
17
  const response_helper_1 = __importDefault(require("../Helper/response.helper"));
19
- /**
20
- * Class responsible for managing file operations.
21
- */
22
18
  class FileManager {
23
- /**
24
- * Initializes a new instance of the FileManager class.
25
- */
26
19
  constructor() {
27
20
  this.fileSystem = promises_1.default;
28
21
  this.fileSystemSync = fs_1.default;
29
22
  this.responseHelper = new response_helper_1.default();
30
23
  }
31
- /**
32
- * Writes data to a file at the specified path.
33
- *
34
- * @param path - The path where the file will be written.
35
- * @param data - The data to write to the file.
36
- * @returns A promise that resolves when the file has been written.
37
- */
38
24
  WriteFile(path, data) {
39
25
  return __awaiter(this, void 0, void 0, function* () {
40
26
  try {
@@ -46,12 +32,6 @@ class FileManager {
46
32
  }
47
33
  });
48
34
  }
49
- /**
50
- * Reads data from a file at the specified path.
51
- *
52
- * @param path - The path of the file to read.
53
- * @returns A promise that resolves with the data read from the file.
54
- */
55
35
  ReadFile(path) {
56
36
  return __awaiter(this, void 0, void 0, function* () {
57
37
  try {
@@ -63,12 +43,6 @@ class FileManager {
63
43
  }
64
44
  });
65
45
  }
66
- /**
67
- * Deletes a file at the specified path.
68
- *
69
- * @param path - The path of the file to delete.
70
- * @returns A promise that resolves when the file has been deleted.
71
- */
72
46
  DeleteFile(path) {
73
47
  return __awaiter(this, void 0, void 0, function* () {
74
48
  try {
@@ -80,12 +54,6 @@ class FileManager {
80
54
  }
81
55
  });
82
56
  }
83
- /**
84
- * Checks if a file exists at the specified path.
85
- *
86
- * @param path - The path of the file to check.
87
- * @returns A promise that resolves with a boolean indicating if the file exists.
88
- */
89
57
  FileExists(path) {
90
58
  return __awaiter(this, void 0, void 0, function* () {
91
59
  try {
@@ -97,12 +65,6 @@ class FileManager {
97
65
  }
98
66
  });
99
67
  }
100
- /**
101
- * Creates a new file at the specified path.
102
- *
103
- * @param path - The path of the file to create.
104
- * @returns A promise that resolves when the file has been created.
105
- */
106
68
  CreateFile(path) {
107
69
  return __awaiter(this, void 0, void 0, function* () {
108
70
  try {
@@ -114,13 +76,6 @@ class FileManager {
114
76
  }
115
77
  });
116
78
  }
117
- // Lock/Unlock Operations
118
- /**
119
- * Locks a file at the specified path.
120
- *
121
- * @param path - The path of the file to lock.
122
- * @returns A promise that resolves when the file has been locked.
123
- */
124
79
  LockFile(path) {
125
80
  return __awaiter(this, void 0, void 0, function* () {
126
81
  try {
@@ -132,12 +87,6 @@ class FileManager {
132
87
  }
133
88
  });
134
89
  }
135
- /**
136
- * Unlocks a file at the specified path.
137
- *
138
- * @param path - The path of the file to unlock.
139
- * @returns A promise that resolves when the file has been unlocked.
140
- */
141
90
  UnlockFile(path) {
142
91
  return __awaiter(this, void 0, void 0, function* () {
143
92
  try {
@@ -149,14 +98,6 @@ class FileManager {
149
98
  }
150
99
  });
151
100
  }
152
- /**
153
- * Moves a file from the specified old path to the new path.
154
- *
155
- * @param oldPath - The current path of the file to be moved.
156
- * @param newPath - The destination path where the file should be moved.
157
- * @returns A promise that resolves to a SuccessInterface if the file is moved successfully,
158
- * or an ErrorInterface if an error occurs during the move operation.
159
- */
160
101
  MoveFile(oldPath, newPath) {
161
102
  return __awaiter(this, void 0, void 0, function* () {
162
103
  try {
@@ -168,15 +109,6 @@ class FileManager {
168
109
  }
169
110
  });
170
111
  }
171
- /**
172
- * Checks if a file is locked by examining its file mode.
173
- *
174
- * @param path - The path to the file to check.
175
- * @returns A promise that resolves to a `SuccessInterface` if the file is locked,
176
- * or an `ErrorInterface` if an error occurs.
177
- *
178
- * The file is considered locked if its mode (permissions) ends with "400".
179
- */
180
112
  IsFileLocked(path) {
181
113
  return __awaiter(this, void 0, void 0, function* () {
182
114
  try {
@@ -188,13 +120,6 @@ class FileManager {
188
120
  }
189
121
  });
190
122
  }
191
- // Stream Operations
192
- /**
193
- * Creates a read stream for the file at the specified path.
194
- *
195
- * @param path - The path of the file to read.
196
- * @returns A read stream for the file.
197
- */
198
123
  CreateReadStream(path) {
199
124
  return __awaiter(this, void 0, void 0, function* () {
200
125
  try {
@@ -205,12 +130,6 @@ class FileManager {
205
130
  }
206
131
  });
207
132
  }
208
- /**
209
- * Creates a write stream for the file at the specified path.
210
- *
211
- * @param path - The path of the file to write.
212
- * @returns A write stream for the file.
213
- */
214
133
  CreateWriteStream(path) {
215
134
  return __awaiter(this, void 0, void 0, function* () {
216
135
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"FileManager.js","sourceRoot":"","sources":["../../source/Storage/FileManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2DAAqC;AACrC,4CAAgC;AAEhC,iBAAiB;AACjB,gFAAuD;AAMvD;;GAEG;AACH,MAAqB,WAAW;IAQ9B;;OAEG;IACH;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;IAED;;;;;;OAMG;IACU,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,MAA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CAAC,cAAc,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACpD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;KAAA;IAQY,iBAAiB,CAC5B,IAAY;;YAEZ,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAChD,CAAC;QACH,CAAC;KAAA;CACF;AAxND,8BAwNC"}
@@ -4,62 +4,12 @@ export default class FolderManager {
4
4
  private readonly fileSystemSync;
5
5
  private readonly responseHelper;
6
6
  constructor();
7
- /**
8
- * Creates a new directory at the specified path.
9
- *
10
- * @param path - The path of the directory to create.
11
- * @returns A promise that resolves when the directory has been created.
12
- */
13
7
  CreateDirectory(path: string): Promise<SuccessInterface | ErrorInterface>;
14
- /**
15
- * Deletes a directory at the specified path.
16
- *
17
- * @param path - The path of the directory to delete.
18
- * @returns A promise that resolves when the directory has been deleted.
19
- */
20
8
  DeleteDirectory(path: string): Promise<SuccessInterface | ErrorInterface>;
21
- /**
22
- * Checks if a directory exists at the specified path.
23
- *
24
- * @param path - The path of the directory to check.
25
- * @returns A promise that resolves with a boolean indicating if the directory exists.
26
- */
27
9
  DirectoryExists(path: string): Promise<SuccessInterface | ErrorInterface>;
28
- /**
29
- * Lists the contents of a directory at the specified path.
30
- *
31
- * @param path - The path of the directory to list.
32
- * @returns A promise that resolves with an array of directory contents.
33
- */
34
10
  ListDirectory(path: string): Promise<SuccessInterface | ErrorInterface>;
35
- /**
36
- * Moves a directory from the old path to the new path.
37
- *
38
- * @param oldPath - The current path of the directory to be moved.
39
- * @param newPath - The new path where the directory should be moved.
40
- * @returns A promise that resolves to a SuccessInterface if the operation is successful,
41
- * or an ErrorInterface if an error occurs.
42
- */
43
11
  MoveDirectory(oldPath: string, newPath: string): Promise<SuccessInterface | ErrorInterface>;
44
- /**
45
- * Locks a directory at the specified path.
46
- *
47
- * @param path - The path of the directory to lock.
48
- * @returns A promise that resolves when the directory has been locked.
49
- */
50
12
  LockDirectory(path: string): Promise<SuccessInterface | ErrorInterface>;
51
- /**
52
- * Unlocks a directory at the specified path.
53
- *
54
- * @param path - The path of the directory to unlock.
55
- * @returns A promise that resolves when the directory has been unlocked.
56
- */
57
13
  UnlockDirectory(path: string): Promise<SuccessInterface | ErrorInterface>;
58
- /**
59
- * Checks if a directory is locked at the specified path.
60
- *
61
- * @param path - The path of the directory to check.
62
- * @returns A promise that resolves with a boolean indicating if the directory is locked.
63
- */
64
14
  IsDirectoryLocked(path: string): Promise<SuccessInterface | ErrorInterface>;
65
15
  }
@@ -14,7 +14,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  const promises_1 = __importDefault(require("fs/promises"));
16
16
  const fs_1 = __importDefault(require("fs"));
17
- // Import Helpers
18
17
  const response_helper_1 = __importDefault(require("../Helper/response.helper"));
19
18
  class FolderManager {
20
19
  constructor() {
@@ -22,12 +21,6 @@ class FolderManager {
22
21
  this.fileSystemSync = fs_1.default;
23
22
  this.responseHelper = new response_helper_1.default();
24
23
  }
25
- /**
26
- * Creates a new directory at the specified path.
27
- *
28
- * @param path - The path of the directory to create.
29
- * @returns A promise that resolves when the directory has been created.
30
- */
31
24
  CreateDirectory(path) {
32
25
  return __awaiter(this, void 0, void 0, function* () {
33
26
  try {
@@ -39,12 +32,6 @@ class FolderManager {
39
32
  }
40
33
  });
41
34
  }
42
- /**
43
- * Deletes a directory at the specified path.
44
- *
45
- * @param path - The path of the directory to delete.
46
- * @returns A promise that resolves when the directory has been deleted.
47
- */
48
35
  DeleteDirectory(path) {
49
36
  return __awaiter(this, void 0, void 0, function* () {
50
37
  try {
@@ -56,12 +43,6 @@ class FolderManager {
56
43
  }
57
44
  });
58
45
  }
59
- /**
60
- * Checks if a directory exists at the specified path.
61
- *
62
- * @param path - The path of the directory to check.
63
- * @returns A promise that resolves with a boolean indicating if the directory exists.
64
- */
65
46
  DirectoryExists(path) {
66
47
  return __awaiter(this, void 0, void 0, function* () {
67
48
  try {
@@ -73,12 +54,6 @@ class FolderManager {
73
54
  }
74
55
  });
75
56
  }
76
- /**
77
- * Lists the contents of a directory at the specified path.
78
- *
79
- * @param path - The path of the directory to list.
80
- * @returns A promise that resolves with an array of directory contents.
81
- */
82
57
  ListDirectory(path) {
83
58
  return __awaiter(this, void 0, void 0, function* () {
84
59
  try {
@@ -90,14 +65,6 @@ class FolderManager {
90
65
  }
91
66
  });
92
67
  }
93
- /**
94
- * Moves a directory from the old path to the new path.
95
- *
96
- * @param oldPath - The current path of the directory to be moved.
97
- * @param newPath - The new path where the directory should be moved.
98
- * @returns A promise that resolves to a SuccessInterface if the operation is successful,
99
- * or an ErrorInterface if an error occurs.
100
- */
101
68
  MoveDirectory(oldPath, newPath) {
102
69
  return __awaiter(this, void 0, void 0, function* () {
103
70
  try {
@@ -109,12 +76,6 @@ class FolderManager {
109
76
  }
110
77
  });
111
78
  }
112
- /**
113
- * Locks a directory at the specified path.
114
- *
115
- * @param path - The path of the directory to lock.
116
- * @returns A promise that resolves when the directory has been locked.
117
- */
118
79
  LockDirectory(path) {
119
80
  return __awaiter(this, void 0, void 0, function* () {
120
81
  try {
@@ -126,12 +87,6 @@ class FolderManager {
126
87
  }
127
88
  });
128
89
  }
129
- /**
130
- * Unlocks a directory at the specified path.
131
- *
132
- * @param path - The path of the directory to unlock.
133
- * @returns A promise that resolves when the directory has been unlocked.
134
- */
135
90
  UnlockDirectory(path) {
136
91
  return __awaiter(this, void 0, void 0, function* () {
137
92
  try {
@@ -143,12 +98,6 @@ class FolderManager {
143
98
  }
144
99
  });
145
100
  }
146
- /**
147
- * Checks if a directory is locked at the specified path.
148
- *
149
- * @param path - The path of the directory to check.
150
- * @returns A promise that resolves with a boolean indicating if the directory is locked.
151
- */
152
101
  IsDirectoryLocked(path) {
153
102
  return __awaiter(this, void 0, void 0, function* () {
154
103
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"FolderManager.js","sourceRoot":"","sources":["../../source/Storage/FolderManager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2DAAqC;AACrC,4CAAgC;AAEhC,iBAAiB;AACjB,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;IAED;;;;;OAKG;IACU,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;IAED;;;;;OAKG;IACU,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;IAED;;;;;OAKG;IACU,eAAe,CAC1B,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AAK,CAAC,KAAK,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;KAAA;IAQY,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,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC;gBAC5D,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,KAAK,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;KAAA;CACF;AAvJD,gCAuJC"}
@@ -1 +1 @@
1
- export {};
1
+ export default function WebServer(): Promise<void>;
@@ -1,18 +1,48 @@
1
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
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
5
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.default = WebServer;
6
16
  const fastify_1 = __importDefault(require("fastify"));
7
- // Import the Details
17
+ const outers_1 = require("outers");
18
+ const path_1 = __importDefault(require("path"));
19
+ const static_1 = __importDefault(require("@fastify/static"));
20
+ const view_1 = __importDefault(require("@fastify/view"));
21
+ const ejs_1 = __importDefault(require("ejs"));
8
22
  const Keys_1 = require("./Keys/Keys");
9
- const Server = (0, fastify_1.default)({ logger: true });
10
- // Listen to the server
11
- Server.listen({ port: Keys_1.General.PORT }, (err, address) => {
12
- if (err) {
13
- Server.log.error(err);
14
- process.exit(1);
15
- }
16
- Server.log.info(`AxioDB Web Interface is listening on ${address}`);
17
- });
23
+ function WebServer() {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const Server = (0, fastify_1.default)({ logger: false });
26
+ Server.register(static_1.default, {
27
+ root: path_1.default.join(__dirname, 'public'),
28
+ prefix: '/public/',
29
+ });
30
+ Server.register(view_1.default, {
31
+ engine: {
32
+ ejs: ejs_1.default,
33
+ },
34
+ root: path_1.default.join(__dirname, 'Views'),
35
+ viewExt: 'ejs',
36
+ });
37
+ Server.listen({ port: Keys_1.General.PORT }, (err, address) => {
38
+ if (err) {
39
+ Server.log.error(err);
40
+ outers_1.Console.red('Failed to start the server', err);
41
+ process.exit(1);
42
+ }
43
+ Server.log.info(`AxioDB Web Interface is listening on ${address}`);
44
+ outers_1.Console.green('Web Interface Server is running on', address);
45
+ });
46
+ });
47
+ }
18
48
  //# sourceMappingURL=Fastify.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Fastify.js","sourceRoot":"","sources":["../../source/Web/Fastify.ts"],"names":[],"mappings":";;;;;AAAA,sDAA8B;AAE9B,qBAAqB;AACrB,sCAAsC;AAEtC,MAAM,MAAM,GAAI,IAAA,iBAAO,EAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;AAIxC,uBAAuB;AACvB,MAAM,CAAC,MAAM,CAAC,EAAC,IAAI,EAAE,cAAO,CAAC,IAAI,EAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;IACjD,IAAI,GAAG,EAAE,CAAC;QACN,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;Q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C;YACpE,gBAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,OAAO,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACH,CAAC;CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Keys.js","sourceRoot":"","sources":["../../../source/Web/Keys/Keys.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAEX;AAFD,WAAY,OAAO;IACf,yCAAW,CAAA;AACf,CAAC,EAFW,OAAO,uBAAP,OAAO,QAElB"}
1
+ {"version":3,"file":"Keys.js","sourceRoot":"","sources":["../../../source/Web/Keys/Keys.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAEX;AAFD,WAAY,OAAO;IACjB,yCAAY,CAAA;AACd,CAAC,EAFW,OAAO,uBAAP,OAAO,QAElB"}
package/lib/config/DB.js CHANGED
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Configure = exports.FolderManager = exports.FileManager = exports.schemaValidate = exports.SchemaTypes = exports.DBMS_File_EXT = exports.DBMS_Name = void 0;
7
- // Import All Required Sub Modules
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"));
@@ -15,10 +14,10 @@ const FolderManager_1 = __importDefault(require("../Storage/FolderManager"));
15
14
  exports.FolderManager = FolderManager_1.default;
16
15
  const Indexation_operation_1 = __importDefault(require("../Operation/Indexation.operation"));
17
16
  exports.Configure = Indexation_operation_1.default;
18
- // Default Keys
17
+ const Fastify_1 = __importDefault(require("../Web/Fastify"));
18
+ (0, Fastify_1.default)();
19
19
  exports.DBMS_Name = "AxioDB";
20
20
  exports.DBMS_File_EXT = ".axiodb";
21
- // Export With All Sub Modules
22
21
  exports.default = {
23
22
  SchemaTypes: DataTypes_models_1.SchemaTypes,
24
23
  schemaValidate: validator_models_1.default,
@@ -1 +1 @@
1
- {"version":3,"file":"DB.js","sourceRoot":"","sources":["../../source/config/DB.ts"],"names":[],"mappings":";;;;;;AAAA,kCAAkC;AAClC,iEAAyD;AAWhD,4FAXA,8BAAW,OAWA;AAVpB,kFAAwD;AAUlC,yBAVf,0BAAc,CAUe;AATpC,yEAAiD;AASX,sBAT/B,qBAAW,CAS+B;AARjD,6EAAqD;AAQF,wBAR5C,uBAAa,CAQ4C;AAPhE,6FAA0D;AAOQ,oBAP3D,8BAAS,CAO2D;AAL3E,eAAe;AACF,QAAA,SAAS,GAAG,QAAQ,CAAC;AACrB,QAAA,aAAa,GAAG,SAAS,CAAC;AAKvC,8BAA8B;AAC9B,kBAAe;IACb,WAAW,EAAX,8BAAW;IACX,cAAc,EAAd,0BAAc;IACd,WAAW,EAAX,qBAAW;IACX,SAAS,EAAT,8BAAS;IACT,aAAa,EAAb,uBAAa;CACd,CAAC"}
1
+ {"version":3,"file":"DB.js","sourceRoot":"","sources":["../../source/config/DB.ts"],"names":[],"mappings":";;;;;;AACA,iEAAyD;AAehD,4FAfA,8BAAW,OAeA;AAdpB,kFAAwD;AAclC,yBAdf,0BAAc,CAce;AAbpC,yEAAiD;AAaX,sBAb/B,qBAAW,CAa+B;AAZjD,6EAAqD;AAYF,wBAZ5C,uBAAa,CAY4C;AAXhE,6FAA0D;AAWQ,oBAX3D,8BAAS,CAW2D;AAR3E,6DAAuC;AACvC,IAAA,iBAAS,GAAE,CAAC;AAGC,QAAA,SAAS,GAAG,QAAQ,CAAC;AACrB,QAAA,aAAa,GAAG,SAAS,CAAC;AAMvC,kBAAe;IACb,WAAW,EAAX,8BAAW;IACX,cAAc,EAAd,0BAAc;IACd,WAAW,EAAX,qBAAW;IACX,SAAS,EAAT,8BAAS;IACT,aAAa,EAAb,uBAAa;CACd,CAAC"}
@@ -1,4 +1,3 @@
1
1
  "use strict";
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  //# sourceMappingURL=response.helper.interface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"response.helper.interface.js","sourceRoot":"","sources":["../../../../source/config/Interfaces/Helper/response.helper.interface.ts"],"names":[],"mappings":";AAAA,uDAAuD"}
1
+ {"version":3,"file":"response.helper.interface.js","sourceRoot":"","sources":["../../../../source/config/Interfaces/Helper/response.helper.interface.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axiodb",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
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",
@@ -38,13 +38,16 @@
38
38
  "url": "https://github.com/sponsors/AnkanSaha"
39
39
  },
40
40
  "dependencies": {
41
- "ejs": "^3.1.10",
42
41
  "joi": "^17.13.3",
43
42
  "outers": "^8.5.8"
44
43
  },
45
44
  "devDependencies": {
46
45
  "@eslint/js": "^9.11.1",
46
+ "@fastify/static": "^8.0.3",
47
+ "@fastify/view": "^10.0.1",
47
48
  "@types/crypto-js": "^4.2.1",
49
+ "@types/ejs": "^3.1.5",
50
+ "ejs": "^3.1.10",
48
51
  "eslint": "^8.57.1",
49
52
  "fastify": "^5.1.0",
50
53
  "globals": "^15.9.0",