axiodb 2.10.22 → 2.10.24

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.
Files changed (82) hide show
  1. package/Document/eslint.config.js +28 -0
  2. package/Document/index.html +31 -0
  3. package/Document/package-lock.json +4254 -0
  4. package/Document/package.json +35 -0
  5. package/Document/postcss.config.js +6 -0
  6. package/Document/public/AXioDB.png +0 -0
  7. package/Document/src/App.tsx +39 -0
  8. package/Document/src/Assets/AXioDB.png +0 -0
  9. package/Document/src/components/content/AdvancedFeatures.tsx +318 -0
  10. package/Document/src/components/content/ApiReference.tsx +319 -0
  11. package/Document/src/components/content/Community.tsx +203 -0
  12. package/Document/src/components/content/Comparison.tsx +227 -0
  13. package/Document/src/components/content/CreateCollection.tsx +59 -0
  14. package/Document/src/components/content/CreateDatabase.tsx +57 -0
  15. package/Document/src/components/content/Features.tsx +263 -0
  16. package/Document/src/components/content/Installation.tsx +67 -0
  17. package/Document/src/components/content/Introduction.tsx +107 -0
  18. package/Document/src/components/content/MaintainersZone.tsx +142 -0
  19. package/Document/src/components/content/PainPoints.tsx +126 -0
  20. package/Document/src/components/content/Security.tsx +137 -0
  21. package/Document/src/components/content/Usage.tsx +247 -0
  22. package/Document/src/components/layout/Header.tsx +154 -0
  23. package/Document/src/components/layout/Layout.tsx +91 -0
  24. package/Document/src/components/layout/Sidebar.tsx +185 -0
  25. package/Document/src/components/ui/Button.tsx +45 -0
  26. package/Document/src/components/ui/CodeBlock.tsx +41 -0
  27. package/Document/src/context/ThemeContext.tsx +71 -0
  28. package/Document/src/hooks/useTheme.tsx +12 -0
  29. package/Document/src/index.css +3 -0
  30. package/Document/src/main.tsx +10 -0
  31. package/Document/src/styles/global.css +18 -0
  32. package/Document/src/vite-env.d.ts +1 -0
  33. package/Document/tailwind.config.js +9 -0
  34. package/Document/tsconfig.app.json +24 -0
  35. package/Document/tsconfig.node.json +22 -0
  36. package/Document/vite.config.ts +40 -0
  37. package/package.json +1 -1
  38. package/lib/Docker/Controller/Authentication/Authentication.d.ts +0 -37
  39. package/lib/Docker/Controller/Authentication/Authentication.js +0 -179
  40. package/lib/Docker/Controller/Authentication/Authentication.js.map +0 -1
  41. package/lib/Docker/Helper/bcrypt.helper.d.ts +0 -4
  42. package/lib/Docker/Helper/bcrypt.helper.js +0 -30
  43. package/lib/Docker/Helper/bcrypt.helper.js.map +0 -1
  44. package/lib/Docker/Middlewares/validateToken.middleware.d.ts +0 -3
  45. package/lib/Docker/Middlewares/validateToken.middleware.js +0 -45
  46. package/lib/Docker/Middlewares/validateToken.middleware.js.map +0 -1
  47. package/lib/Docker/Server/Fastify/Fastify.d.ts +0 -10
  48. package/lib/Docker/Server/Fastify/Fastify.js +0 -72
  49. package/lib/Docker/Server/Fastify/Fastify.js.map +0 -1
  50. package/lib/Docker/Server/Fastify/Router/Authentication/Authentication.d.ts +0 -5
  51. package/lib/Docker/Server/Fastify/Router/Authentication/Authentication.js +0 -34
  52. package/lib/Docker/Server/Fastify/Router/Authentication/Authentication.js.map +0 -1
  53. package/lib/Docker/Server/Fastify/Router/Router.d.ts +0 -2
  54. package/lib/Docker/Server/Fastify/Router/Router.js +0 -37
  55. package/lib/Docker/Server/Fastify/Router/Router.js.map +0 -1
  56. package/lib/Docker/Server/GRPC/GRPC.d.ts +0 -10
  57. package/lib/Docker/Server/GRPC/GRPC.js +0 -111
  58. package/lib/Docker/Server/GRPC/GRPC.js.map +0 -1
  59. package/lib/Docker/Server/TCP.d.ts +0 -10
  60. package/lib/Docker/Server/TCP.js +0 -38
  61. package/lib/Docker/Server/TCP.js.map +0 -1
  62. package/lib/Docker/Server/UDP.d.ts +0 -10
  63. package/lib/Docker/Server/UDP.js +0 -28
  64. package/lib/Docker/Server/UDP.js.map +0 -1
  65. package/lib/Docker/Server/Websocket.d.ts +0 -0
  66. package/lib/Docker/Server/Websocket.js +0 -2
  67. package/lib/Docker/Server/Websocket.js.map +0 -1
  68. package/lib/Docker/config/Info.d.ts +0 -30
  69. package/lib/Docker/config/Info.js +0 -52
  70. package/lib/Docker/config/Info.js.map +0 -1
  71. package/lib/Docker/config/Interfaces/RequestInterface.d.ts +0 -8
  72. package/lib/Docker/config/Interfaces/RequestInterface.js +0 -3
  73. package/lib/Docker/config/Interfaces/RequestInterface.js.map +0 -1
  74. package/lib/Docker/config/Keys.d.ts +0 -21
  75. package/lib/Docker/config/Keys.js +0 -30
  76. package/lib/Docker/config/Keys.js.map +0 -1
  77. package/lib/Docker/config/docker.d.ts +0 -1
  78. package/lib/Docker/config/docker.js +0 -60
  79. package/lib/Docker/config/docker.js.map +0 -1
  80. package/lib/Docker/util/SchemaGenerator.util.d.ts +0 -26
  81. package/lib/Docker/util/SchemaGenerator.util.js +0 -71
  82. package/lib/Docker/util/SchemaGenerator.util.js.map +0 -1
@@ -0,0 +1,45 @@
1
+ import React from "react";
2
+
3
+ interface ButtonProps {
4
+ children: React.ReactNode;
5
+ variant?: "primary" | "secondary" | "outline";
6
+ size?: "sm" | "md" | "lg";
7
+ onClick?: () => void;
8
+ className?: string;
9
+ }
10
+
11
+ const Button: React.FC<ButtonProps> = ({
12
+ children,
13
+ variant = "primary",
14
+ size = "md",
15
+ onClick,
16
+ className = "",
17
+ }) => {
18
+ const baseClasses =
19
+ "inline-flex items-center justify-center rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2";
20
+
21
+ const variantClasses = {
22
+ primary: "bg-blue-500 text-white hover:bg-blue-600 shadow-sm",
23
+ secondary:
24
+ "bg-gray-100 text-gray-900 hover:bg-gray-200 dark:bg-gray-700 dark:text-gray-100 dark:hover:bg-gray-600",
25
+ outline:
26
+ "border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",
27
+ };
28
+
29
+ const sizeClasses = {
30
+ sm: "px-3 py-1.5 text-sm",
31
+ md: "px-4 py-2 text-base",
32
+ lg: "px-6 py-3 text-lg",
33
+ };
34
+
35
+ return (
36
+ <button
37
+ className={`${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]} ${className}`}
38
+ onClick={onClick}
39
+ >
40
+ {children}
41
+ </button>
42
+ );
43
+ };
44
+
45
+ export default Button;
@@ -0,0 +1,41 @@
1
+ import React, { useState } from "react";
2
+ import { Check, Copy } from "lucide-react";
3
+
4
+ interface CodeBlockProps {
5
+ code: string;
6
+ language: string;
7
+ }
8
+
9
+ const CodeBlock: React.FC<CodeBlockProps> = ({ code, language }) => {
10
+ const [copied, setCopied] = useState(false);
11
+
12
+ const handleCopy = async () => {
13
+ await navigator.clipboard.writeText(code);
14
+ setCopied(true);
15
+ setTimeout(() => setCopied(false), 2000);
16
+ };
17
+
18
+ return (
19
+ <div className="relative group rounded-lg overflow-hidden my-6">
20
+ <div className="flex items-center justify-between px-4 py-2 bg-gray-800 text-gray-400">
21
+ <span className="text-sm font-mono">{language}</span>
22
+ <button
23
+ onClick={handleCopy}
24
+ className="text-gray-400 hover:text-white transition-colors p-1 rounded"
25
+ aria-label="Copy code"
26
+ >
27
+ {copied ? (
28
+ <Check size={18} className="text-green-400" />
29
+ ) : (
30
+ <Copy size={18} />
31
+ )}
32
+ </button>
33
+ </div>
34
+ <pre className="overflow-x-auto p-4 bg-gray-900 text-white text-sm">
35
+ <code className="font-mono">{code}</code>
36
+ </pre>
37
+ </div>
38
+ );
39
+ };
40
+
41
+ export default CodeBlock;
@@ -0,0 +1,71 @@
1
+ import React, { createContext, useState, useEffect } from "react";
2
+
3
+ type Theme = "light" | "dark";
4
+
5
+ interface ThemeContextType {
6
+ theme: Theme;
7
+ toggleTheme: () => void;
8
+ }
9
+
10
+ export const ThemeContext = createContext<ThemeContextType | undefined>(
11
+ undefined,
12
+ );
13
+
14
+ interface ThemeProviderProps {
15
+ children: React.ReactNode;
16
+ }
17
+
18
+ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children }) => {
19
+ const [theme, setTheme] = useState<Theme>(() => {
20
+ // Check for saved theme preference in localStorage
21
+ const savedTheme = localStorage.getItem("theme");
22
+
23
+ // Check for system preference if no saved preference
24
+ if (!savedTheme) {
25
+ return window.matchMedia("(prefers-color-scheme: dark)").matches
26
+ ? "dark"
27
+ : "light";
28
+ }
29
+
30
+ return (savedTheme as Theme) || "light";
31
+ });
32
+
33
+ // Apply theme class to document
34
+ useEffect(() => {
35
+ const root = window.document.documentElement;
36
+
37
+ if (theme === "dark") {
38
+ root.classList.add("dark");
39
+ } else {
40
+ root.classList.remove("dark");
41
+ }
42
+
43
+ // Save theme preference to localStorage
44
+ localStorage.setItem("theme", theme);
45
+ }, [theme]);
46
+
47
+ // Listen for system theme changes
48
+ useEffect(() => {
49
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
50
+
51
+ const handleChange = (e: MediaQueryListEvent) => {
52
+ // Only update if user hasn't manually set a preference
53
+ if (!localStorage.getItem("theme")) {
54
+ setTheme(e.matches ? "dark" : "light");
55
+ }
56
+ };
57
+
58
+ mediaQuery.addEventListener("change", handleChange);
59
+ return () => mediaQuery.removeEventListener("change", handleChange);
60
+ }, []);
61
+
62
+ const toggleTheme = () => {
63
+ setTheme((prevTheme) => (prevTheme === "light" ? "dark" : "light"));
64
+ };
65
+
66
+ return (
67
+ <ThemeContext.Provider value={{ theme, toggleTheme }}>
68
+ {children}
69
+ </ThemeContext.Provider>
70
+ );
71
+ };
@@ -0,0 +1,12 @@
1
+ import { useContext } from "react";
2
+ import { ThemeContext } from "../context/ThemeContext";
3
+
4
+ export const useTheme = () => {
5
+ const context = useContext(ThemeContext);
6
+
7
+ if (!context) {
8
+ throw new Error("useTheme must be used within a ThemeProvider");
9
+ }
10
+
11
+ return context;
12
+ };
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
@@ -0,0 +1,10 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import App from "./App.tsx";
4
+ import "./index.css";
5
+
6
+ createRoot(document.getElementById("root")!).render(
7
+ <StrictMode>
8
+ <App />
9
+ </StrictMode>,
10
+ );
@@ -0,0 +1,18 @@
1
+ /* ...existing styles... */
2
+ @keyframes fade-in {
3
+ from {
4
+ opacity: 0;
5
+ transform: translateY(20px);
6
+ }
7
+
8
+ to {
9
+ opacity: 1;
10
+ transform: translateY(0);
11
+ }
12
+ }
13
+
14
+ .animate-fade-in {
15
+ animation: fade-in 0.8s ease-out;
16
+ }
17
+
18
+ /* ...existing styles... */
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,9 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ export default {
3
+ content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
4
+ darkMode: 'class', // Enable class-based dark mode toggling
5
+ theme: {
6
+ extend: {}
7
+ },
8
+ plugins: []
9
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "isolatedModules": true,
13
+ "moduleDetection": "force",
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "noFallthroughCasesInSwitch": true
22
+ },
23
+ "include": ["src"]
24
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2023"],
5
+ "module": "ESNext",
6
+ "skipLibCheck": true,
7
+
8
+ /* Bundler mode */
9
+ "moduleResolution": "bundler",
10
+ "allowImportingTsExtensions": true,
11
+ "isolatedModules": true,
12
+ "moduleDetection": "force",
13
+ "noEmit": true,
14
+
15
+ /* Linting */
16
+ "strict": true,
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": true,
19
+ "noFallthroughCasesInSwitch": true
20
+ },
21
+ "include": ["vite.config.ts"]
22
+ }
@@ -0,0 +1,40 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+
4
+ // https://vitejs.dev/config/
5
+ export default defineConfig({
6
+ plugins: [react()],
7
+ optimizeDeps: {
8
+ exclude: ["lucide-react"],
9
+ },
10
+ cacheDir: ".vite",
11
+ assetsInclude: [
12
+ "**/*.jpeg",
13
+ "**/*.txt",
14
+ "**/*.png",
15
+ "**/*.svg",
16
+ "**/*.jpg, **/*.webp, **/*.ico, **/*.json, **/*.webmanifest, **/*.xml, **/*.pdf, **/*.txt, **/*.md, **/*.woff, **/*.woff2, **/*.ttf, **/*.otf, **/*.eot, **/*.wav, **/*.mp3, **/*.mp4, **/*.webm, **/*.ogg, **/*.m4a, **/*.aac, **/*.flac, **/*.oga, **/*.opus, **/*.svg, **/*.svgz, **/*.zip, **/*.gz, **/*.tgz, **/*.brotli, **/*.7z, **/*.rar, **/*.bz2, **/*.xz, **/*.pdf, **/*.epub, **/*.woff, **/*.woff2, **/*.ttf, **/*.otf, **/*.eot, **/*.wav, **/*.mp3, **/*.mp4, **/*.webm, **/*.ogg, **/*.m4a, **/*.aac, **/*.flac, **/*.oga, **/*.opus, **/*.svg, **/*.svgz, **/*.zip, **/*.gz, **/*.tgz, **/*.brotli, **/*.7z, **/*.rar, **/*.bz2, **/*.xz, **/*.pdf, **/*.epub, **/*.woff, **/*.woff2, **/*.ttf, **/*.otf, **/*.eot, **/*.wav, **/*.mp3, **/*.mp4, **/*.webm, **/*.ogg, **/*.m4a, **/*.aac, **/*.flac, **/*.oga, **/*.opus, **/*.svg, **/*.svgz, **/*.zip, **/*.gz, **/*.tgz, **/*.brotli, **/*.7z, **/*.rar, **/*.bz2, **/*.xz, **/*.pdf, **/*.epub",
17
+ ],
18
+ base: "/",
19
+ mode: "production",
20
+ publicDir: "public",
21
+ build: {
22
+ outDir: "AxioDB_Docs",
23
+ emptyOutDir: true,
24
+ sourcemap: false,
25
+ minify: true,
26
+ ssrManifest: true,
27
+ modulePreload: true,
28
+ copyPublicDir: true,
29
+ cssCodeSplit: true,
30
+ manifest: true,
31
+ cssTarget: "es2015",
32
+ target: "es2015",
33
+ assetsDir: "assets",
34
+ chunkSizeWarningLimit: 100000,
35
+ cssMinify: true,
36
+ ssrEmitAssets: true,
37
+ write: true,
38
+ assetsInlineLimit: 5128,
39
+ },
40
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axiodb",
3
- "version": "2.10.22",
3
+ "version": "2.10.24",
4
4
  "description": "A blazing-fast, lightweight, and scalable nodejs package based DBMS for modern applications. Supports schemas, encryption, and advanced query capabilities.",
5
5
  "main": "./lib/config/DB.js",
6
6
  "types": "./lib/config/DB.d.ts",
@@ -1,37 +0,0 @@
1
- import Collection from "axiodb/lib/Operation/Collection/collection.operation";
2
- interface RegisterRequest {
3
- username: string;
4
- password: string;
5
- email: string;
6
- name: string;
7
- }
8
- interface LoginRequest {
9
- username: string;
10
- password: string;
11
- }
12
- export default class Authentication {
13
- static Register(userData: RegisterRequest, CollectionInstance: Collection): Promise<{
14
- status: boolean;
15
- title: string;
16
- message: string;
17
- statusCode?: undefined;
18
- data?: undefined;
19
- } | {
20
- status: boolean;
21
- statusCode: import("outers/lib/StatusCode/Code").StatusCode;
22
- title: string;
23
- message: string;
24
- data: {
25
- username: string;
26
- password: string;
27
- };
28
- } | {
29
- status: boolean;
30
- title: string;
31
- message: string;
32
- data: unknown;
33
- statusCode?: undefined;
34
- }>;
35
- static Login(userData: LoginRequest, CollectionInstance: Collection): Promise<any>;
36
- }
37
- export {};
@@ -1,179 +0,0 @@
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 outers_1 = require("outers");
16
- const bcrypt_helper_1 = __importDefault(require("../../Helper/bcrypt.helper"));
17
- const outers_2 = require("outers");
18
- const Keys_1 = require("../../config/Keys");
19
- // Authentication Class to handle all the authentication related operations
20
- class Authentication {
21
- // Method to handle user registration management
22
- static Register(userData, CollectionInstance) {
23
- return __awaiter(this, void 0, void 0, function* () {
24
- var _a;
25
- try {
26
- // check if all fields are filled
27
- for (const key in userData) {
28
- if (!userData[key]) {
29
- throw new Error(`${key} is required`);
30
- }
31
- }
32
- const { email, username } = userData; // Destructure the userData object
33
- // check if username already exists
34
- const existingUser = yield CollectionInstance.query({
35
- email: email,
36
- username: username,
37
- }).exec();
38
- if (existingUser.statusCode === outers_1.StatusCodes.OK &&
39
- existingUser.status == true &&
40
- ((_a = existingUser.data.documents) === null || _a === void 0 ? void 0 : _a.length) > 0) {
41
- return {
42
- status: false,
43
- title: "User Already Exists",
44
- message: "User with this email or username already exists",
45
- };
46
- }
47
- // Hash Password
48
- const hashedPassword = yield bcrypt_helper_1.default.hashPassword(userData.password);
49
- // Create User Object
50
- const user = Object.assign(Object.assign({}, userData), { password: hashedPassword });
51
- // Create User in Database
52
- const createdUser = yield CollectionInstance.insert(user);
53
- if ((createdUser === null || createdUser === void 0 ? void 0 : createdUser.statusCode) !== outers_1.StatusCodes.OK) {
54
- return {
55
- status: false,
56
- title: "Error in Creating User",
57
- message: "User could not be created in the database",
58
- };
59
- }
60
- return {
61
- status: true,
62
- statusCode: outers_1.StatusCodes.OK,
63
- title: "User Created Successfully",
64
- message: "User has been created successfully, please login with your credentials",
65
- data: {
66
- username: userData.username,
67
- password: userData.password,
68
- },
69
- };
70
- }
71
- catch (error) {
72
- console.error("Error in Registering User", error);
73
- return {
74
- status: false,
75
- title: "Error in Registering User",
76
- message: "Error in Registering User when creating user",
77
- data: error,
78
- };
79
- }
80
- });
81
- }
82
- // Method to handle user login management
83
- static Login(userData, CollectionInstance) {
84
- return __awaiter(this, void 0, void 0, function* () {
85
- var _a, _b, _c;
86
- try {
87
- // check if all fields are filled
88
- for (const key in userData) {
89
- if (!userData[key]) {
90
- throw new Error(`${key} is required`);
91
- }
92
- }
93
- // check if username and password are provided
94
- if (!userData.username || !userData.password) {
95
- return {
96
- status: false,
97
- title: "Username and Password Required",
98
- message: "Username and Password are required",
99
- };
100
- }
101
- const { username, password } = userData; // Destructure the userData object
102
- // check if username already exists
103
- const existingUser = yield CollectionInstance.query({
104
- username: username,
105
- }).exec();
106
- if (existingUser.statusCode === outers_1.StatusCodes.OK &&
107
- existingUser.status == true &&
108
- ((_a = existingUser.data.documents) === null || _a === void 0 ? void 0 : _a.length) === 0) {
109
- return {
110
- status: false,
111
- title: "User Not Found",
112
- message: "User with this username does not exist",
113
- };
114
- }
115
- // check if password is correct
116
- const isPasswordCorrect = yield bcrypt_helper_1.default.comparePasswords(password, (_b = existingUser.data.documents[0]) === null || _b === void 0 ? void 0 : _b.password);
117
- if (!isPasswordCorrect) {
118
- return {
119
- status: false,
120
- title: "Incorrect Password",
121
- message: "Password is incorrect",
122
- };
123
- }
124
- // if AccessToken is already present, return it
125
- if ((_c = existingUser.data.documents[0]) === null || _c === void 0 ? void 0 : _c.AccessToken) {
126
- delete existingUser.data.documents[0].password;
127
- delete existingUser.data.documents[0].AccessToken;
128
- }
129
- // generate access token
130
- const newAccessToken = new outers_2.ClassBased.JWT_Manager(Keys_1.CentralInformation.CentralDB_JWT_Secret).generateLoginToken(existingUser.data.documents[0], 1, "24h");
131
- if (newAccessToken.status === false) {
132
- return {
133
- status: false,
134
- title: "Token Generation Failed",
135
- message: "Failed to generate access token",
136
- };
137
- }
138
- // Update in DB
139
- const updateResponse = yield CollectionInstance.update({
140
- username: username,
141
- }).UpdateOne({ AccessToken: newAccessToken.toKen });
142
- if (updateResponse.status == true &&
143
- updateResponse.statusCode == outers_1.StatusCodes.OK) {
144
- // Return success message
145
- return {
146
- status: true,
147
- statusCode: outers_1.StatusCodes.OK,
148
- title: "User Logged In Successfully",
149
- message: "User has been logged in successfully",
150
- data: {
151
- username: existingUser.data.documents[0].username,
152
- AccessToken: newAccessToken.toKen,
153
- willExpireIn: "24h",
154
- currentTimeStamp: newAccessToken.currentTimeStamp,
155
- },
156
- };
157
- }
158
- else {
159
- return {
160
- status: false,
161
- title: "Error in Updating Access Token",
162
- message: "Error in Updating Access Token in the database",
163
- };
164
- }
165
- }
166
- catch (error) {
167
- console.error("Error in Login User", error);
168
- return {
169
- status: false,
170
- title: "Error in Login User",
171
- message: "Error in Login User when creating user",
172
- data: error,
173
- };
174
- }
175
- });
176
- }
177
- }
178
- exports.default = Authentication;
179
- //# sourceMappingURL=Authentication.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Authentication.js","sourceRoot":"","sources":["../../../../source/Docker/Controller/Authentication/Authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,mCAAqC;AACrC,+EAAgD;AAChD,mCAAoC;AACpC,4CAAuD;AAcvD,2EAA2E;AAC3E,MAAqB,cAAc;IACjC,gDAAgD;IACzC,MAAM,CAAO,QAAQ,CAC1B,QAAyB,EACzB,kBAA8B;;;YAE9B,IAAI,CAAC;gBACH,iCAAiC;gBACjC,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;oBAC3B,IAAI,CAAC,QAAQ,CAAC,GAA4B,CAAC,EAAE,CAAC;wBAC5C,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,cAAc,CAAC,CAAC;oBACxC,CAAC;gBACH,CAAC;gBACD,MAAM,EAAE,K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AAE,WAAW,EAAE,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC;gBAEpD,IACE,cAAc,CAAC,MAAM,IAAI,IAAI;oBAC7B,cAAc,CAAC,UAAU,IAAI,oBAAW,CAAC,EAAE,EAC3C,CAAC;oBACD,yBAAyB;oBACzB,OAAO;wBACL,MAAM,EAAE,IAAI;wBACZ,UAAU,EAAE,oBAAW,CAAC,EAAE;wBAC1B,KAAK,EAAE,6BAA6B;wBACpC,OAAO,EAAE,sCAAsC;wBAC/C,IAAI,EAAE;4BACJ,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ;4BACjD,WAAW,EAAE,cAAc,CAAC,KAAK;4BACjC,YAAY,EAAE,KAAK;4BACnB,gBAAgB,EAAE,cAAc,CAAC,gBAAgB;yBAClD;qBACF,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,OAAO;wBACL,MAAM,EAAE,KAAK;wBACb,KAAK,EAAE,gCAAgC;wBACvC,OAAO,EAAE,gDAAgD;qBAC1D,CAAC;gBACJ,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;gBAC5C,OAAO;oBACL,MAAM,EAAE,KAAK;oBACb,KAAK,EAAE,qBAAqB;oBAC5B,OAAO,EAAE,wCAAwC;oBACjD,IAAI,EAAE,KAAK;iBACZ,CAAC;YACJ,CAAC;QACH,CAAC;KAAA;CACF;AAzLD,iCAyLC"}
@@ -1,4 +0,0 @@
1
- export default class bcrypt {
2
- static hashPassword(password: string): Promise<string>;
3
- static comparePasswords(password: string, hashedPassword: string): Promise<boolean>;
4
- }
@@ -1,30 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const bcryptjs_1 = require("bcryptjs");
13
- class bcrypt {
14
- // Method to hash password
15
- static hashPassword(password) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- const saltRounds = yield (0, bcryptjs_1.genSalt)(10);
18
- const hashedPassword = yield (0, bcryptjs_1.hash)(password, saltRounds);
19
- return hashedPassword;
20
- });
21
- }
22
- // Method to compare password
23
- static comparePasswords(password, hashedPassword) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- return yield (0, bcryptjs_1.compare)(password, hashedPassword);
26
- });
27
- }
28
- }
29
- exports.default = bcrypt;
30
- //# sourceMappingURL=bcrypt.helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bcrypt.helper.js","sourceRoot":"","sources":["../../../source/Docker/Helper/bcrypt.helper.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAAkD;AAElD,MAAqB,MAAM;IACzB,0BAA0B;IACnB,MAAM,CAAO,YAAY,CAAC,QAAgB;;YAC/C,MAAM,UAAU,GAAG,MAAM,IAAA,kBAAO,EAAC,EAAE,CAAC,CAAC;YACrC,MAAM,cAAc,GAAG,MAAM,IAAA,eAAI,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACxD,OAAO,cAAc,CAAC;QACxB,CAAC;KAAA;IAED,8BAA8B;IACvB,MAAM,CAAO,gBAAgB,CAClC,QAAgB,EAChB,cAAsB;;YAEtB,OAAO,MAAM,IAAA,kBAAO,EAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;QACjD,CAAC;KAAA;CACF;AAfD,yBAeC"}
@@ -1,3 +0,0 @@
1
- import { FastifyReply } from "fastify";
2
- import { RequestBody } from "../config/Interfaces/RequestInterface";
3
- export default function validateToken(request: RequestBody, reply: FastifyReply): Promise<undefined>;
@@ -1,45 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.default = validateToken;
13
- const outers_1 = require("outers");
14
- const outers_2 = require("outers");
15
- const Keys_1 = require("../config/Keys");
16
- function validateToken(request, reply) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- // Get Token from the request headers
19
- const authToken = request.headers["servicetoken"];
20
- // Check if the token is valid
21
- if (!authToken) {
22
- return reply.status(outers_1.StatusCodes.UNAUTHORIZED).send({
23
- statusCode: outers_1.StatusCodes.UNAUTHORIZED,
24
- success: false,
25
- error: "Unauthorized",
26
- message: "No service token provided, please provide servicetoken in the header",
27
- });
28
- }
29
- // Decode the token
30
- const decodedToken = new outers_2.ClassBased.JWT_Manager(Keys_1.CentralInformation.CentralDB_JWT_Secret).decode(authToken);
31
- // Check if the token is valid or expired
32
- if (decodedToken.status === "Invalid") {
33
- return reply.status(outers_1.StatusCodes.UNAUTHORIZED).send({
34
- statusCode: outers_1.StatusCodes.UNAUTHORIZED,
35
- success: false,
36
- error: "Unauthorized",
37
- message: "Invalid or expired token",
38
- });
39
- }
40
- console.log("Decoded Token", decodedToken.data.data);
41
- // Set the user data in the request body
42
- request.body = Object.assign(Object.assign({}, request.body), { user: decodedToken.data.data });
43
- });
44
- }
45
- //# sourceMappingURL=validateToken.middleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validateToken.middleware.js","sourceRoot":"","sources":["../../../source/Docker/Middlewares/validateToken.middleware.ts"],"names":[],"mappings":";;;;;;;;;;;AAMA,gCAsCC;AA3CD,mCAAqC;AAErC,mCAAoC;AACpC,yCAAoD;AAEpD,SAA8B,aAAa,CACzC,OAAoB,EACpB,KAAmB;;QAEnB,qCAAqC;QACrC,MAAM,SAAS,GAAW,OAAO,CAAC,OAAO,CAAC,cAAc,CAAW,CAAC;QAEpE,8BAA8B;QAC9B,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,KAAK,CAAC,MAAM,CAAC,oBAAW,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;gBACjD,UAAU,EAAE,oBAAW,CAAC,YAAY;gBACpC,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,cAAc;gBACrB,OAAO,EACL,sEAAsE;aACzE,CAAC,CAAC;QACL,CAAC;QACD,mBAAmB;QACnB,MAAM,YAAY,GAAG,IAAI,mBAAU,CAAC,WAAW,CAC7C,yBAAkB,CAAC,oBAAoB,CACxC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAEpB,yCAAyC;QACzC,IAAI,YAAY,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACtC,OAAO,KAAK,CAAC,MAAM,CAAC,oBAAW,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;gBACjD,UAAU,EAAE,oBAAW,CAAC,YAAY;gBACpC,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,cAAc;gBACrB,OAAO,EAAE,0BAA0B;aACpC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAErD,wCAAwC;QACxC,OAAO,CAAC,IAAI,mCACP,OAAO,CAAC,IAAI,KACf,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,GAC7B,CAAC;IACJ,CAAC;CAAA"}
@@ -1,10 +0,0 @@
1
- import { AxioDB } from "axiodb";
2
- import Collection from "axiodb/lib/Operation/Collection/collection.operation";
3
- import Database from "axiodb/lib/Operation/Database/database.operation";
4
- interface ServerOptions {
5
- CentralAuthCollection: Collection;
6
- CentralDB: Database;
7
- CentralDBInstance: AxioDB;
8
- }
9
- declare const start: (options: ServerOptions) => Promise<void>;
10
- export default start;