axiodb 20.3.0 → 20.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,19 +1,24 @@
1
- # AxioDB: The Pure JavaScript Alternative to SQLite
1
+ # AxioDB: SQLite Alternative for JavaScript
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/axiodb.svg)](https://badge.fury.io/js/axiodb)
4
+ [![npm version shields](https://img.shields.io/npm/v/axiodb?logo=npm&label=npm)](https://www.npmjs.com/package/axiodb)
4
5
  [![npm downloads total](https://img.shields.io/npm/dt/axiodb.svg)](https://www.npmjs.com/package/axiodb)
5
6
  [![npm downloads yearly](https://img.shields.io/npm/dy/axiodb.svg)](https://www.npmjs.com/package/axiodb)
6
7
  [![npm downloads weekly](https://img.shields.io/npm/dw/axiodb.svg)](https://www.npmjs.com/package/axiodb)
7
8
  [![npm downloads monthly](https://img.shields.io/npm/dm/axiodb.svg)](https://www.npmjs.com/package/axiodb)
9
+ [![install size](https://img.shields.io/npm/unpacked-size/axiodb?label=install%20size)](https://www.npmjs.com/package/axiodb)
10
+ [![jsDelivr hits](https://img.shields.io/jsdelivr/npm/hm/axiodb?label=jsDelivr)](https://www.jsdelivr.com/package/npm/axiodb)
11
+ [![npm types](https://img.shields.io/npm/types/axiodb?label=types)](https://www.npmjs.com/package/axiodb)
8
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
13
 
10
14
  [![Push to Registry](https://github.com/nexoral/AxioDB/actions/workflows/Push.yml/badge.svg?branch=main)](https://github.com/nexoral/AxioDB/actions/workflows/Push.yml)
11
15
  [![CodeQL](https://github.com/nexoral/AxioDB/actions/workflows/github-code-scanning/codeql/badge.svg?branch=main)](https://github.com/nexoral/AxioDB/actions/workflows/github-code-scanning/codeql)
12
16
  [![Socket Security](https://socket.dev/api/badge/npm/package/axiodb)](https://socket.dev/npm/package/axiodb)
17
+ [![GitHub Stars](https://img.shields.io/github/stars/nexoral/AxioDB?style=social)](https://github.com/nexoral/AxioDB)
13
18
 
14
19
  [![Node.js Version](https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen)](https://nodejs.org)
15
20
  [![Tested on Node.js](https://img.shields.io/badge/tested%20on-20%20%7C%2021%20%7C%2022%20%7C%2023%20%7C%2024%20%7C%2025%20%7C%2026-blue)](https://github.com/nexoral/AxioDB/actions/workflows/Push.yml)
16
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.6-blue)](https://www.typescriptlang.org/)
21
+ [![TypeScript](https://img.shields.io/badge/TypeScript-6.0-blue)](https://www.typescriptlang.org/)
17
22
  [![Zero Dependencies](https://img.shields.io/badge/dependencies-0%20native-success)](https://www.npmjs.com/package/axiodb)
18
23
 
19
24
  👉 **[Official Documentation](https://axiodb.in/)**: Access full guides, examples, and API references.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "axiodb",
3
- "version": "20.3.0",
4
- "description": "The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platform issues—pure JavaScript from npm install to production.",
3
+ "version": "20.3.3",
4
+ "description": "SQLite Alternative for JavaScript. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platform issues—pure JavaScript from npm install to production.",
5
5
  "main": "./lib/config/DB.js",
6
6
  "types": "./lib/config/DB.d.ts",
7
7
  "scripts": {
@@ -62,7 +62,7 @@
62
62
  "@fastify/cookie": "^10.0.1",
63
63
  "@fastify/cors": "^11.0.1",
64
64
  "@fastify/multipart": "^9.0.3",
65
- "@fastify/static": "^9.3.0",
65
+ "@fastify/static": "^10.1.1",
66
66
  "fastify": "^5.8.5",
67
67
  "tar": "^7.5.16"
68
68
  },
package/.graphifyignore DELETED
@@ -1,12 +0,0 @@
1
- # Compiled TypeScript output (tsc outDir) - duplicates every source/*.ts as
2
- # .js plus __awaiter polyfill internals (adopt/fulfilled/rejected/step) in
3
- # each file. Already git-ignored; indexing it doubles the graph with noise.
4
- /lib/
5
-
6
- # graphify's own outputs - GRAPH_REPORT.md/graph.json are generated FROM the graph;
7
- # indexing them feeds the graph its own summary back as source material.
8
- /graphify-out/
9
-
10
- # Built docs site (vite-react-ssg output) - duplicates Document/src + Document/public
11
- # as pre-rendered HTML plus llms.txt/llms-full.txt concatenations of the same content.
12
- /Document/AxioDB_Docs/
package/cli/VERSION DELETED
@@ -1 +0,0 @@
1
- 20.3.0
@@ -1,68 +0,0 @@
1
- package cmd
2
-
3
- import (
4
- "fmt"
5
- "strings"
6
-
7
- "github.com/nexoral/axiodb-cli/internal/config"
8
- "github.com/nexoral/axiodb-cli/pkg/httpclient"
9
- "github.com/spf13/cobra"
10
- )
11
-
12
- var userCmd = &cobra.Command{Use: "user", Short: "Manage HTTP API users"}
13
- var roleCmd = &cobra.Command{Use: "role", Short: "Manage HTTP API roles"}
14
-
15
- func httpClientFor(cmd *cobra.Command) (*config.Config, *httpclient.HTTPClient, error) {
16
- cfg, err := config.FromFlags(cmd)
17
- if err != nil { return nil, nil, err }
18
- if cfg.Username == "" || cfg.Password == "" { return nil, nil, fmt.Errorf("--username and --password are required for HTTP administration") }
19
- client := cfg.NewHTTPClient()
20
- if err := client.Login(cfg.Username, cfg.Password); err != nil { return nil, nil, err }
21
- return cfg, client, nil
22
- }
23
-
24
- var userListCmd = &cobra.Command{Use: "list", Short: "List users", RunE: func(cmd *cobra.Command, args []string) error {
25
- cfg, client, err := httpClientFor(cmd); if err != nil { return err }; result, err := client.ListUsers(); if err != nil { return err }; return printOutput(cfg.Output, result)
26
- }}
27
-
28
- var userCreateCmd = &cobra.Command{Use: "create <username> <password> <role>", Short: "Create a user", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) error {
29
- cfg, client, err := httpClientFor(cmd); if err != nil { return err }; result, err := client.CreateUser(args[0], args[1], args[2]); if err != nil { return err }; return printOutput(cfg.Output, result)
30
- }}
31
-
32
- var userRoleCmd = &cobra.Command{Use: "set-role <username> <role>", Short: "Change a user's role", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error {
33
- cfg, client, err := httpClientFor(cmd); if err != nil { return err }; result, err := client.UpdateUserRole(args[0], args[1]); if err != nil { return err }; return printOutput(cfg.Output, result)
34
- }}
35
-
36
- var userResetCmd = &cobra.Command{Use: "reset-password <username> <password>", Short: "Reset a user's password", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error {
37
- cfg, client, err := httpClientFor(cmd); if err != nil { return err }; result, err := client.ResetUserPassword(args[0], args[1]); if err != nil { return err }; return printOutput(cfg.Output, result)
38
- }}
39
-
40
- var userDeleteCmd = &cobra.Command{Use: "delete <username>", Short: "Delete a user", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error {
41
- cfg, client, err := httpClientFor(cmd); if err != nil { return err }; result, err := client.DeleteUser(args[0]); if err != nil { return err }; return printOutput(cfg.Output, result)
42
- }}
43
-
44
- var userChangePasswordCmd = &cobra.Command{Use: "change-password <currentPassword> <newPassword>", Short: "Change own password (self-service)", Long: "Change your own password. Requires HTTP API (port 27018) to be enabled on the server (GUI/HTTP). Uses PATCH /api/auth/change-password.", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error {
45
- cfg, client, err := httpClientFor(cmd); if err != nil { return err }; result, err := client.ChangeOwnPassword(args[0], args[1]); if err != nil { return err }; return printOutput(cfg.Output, result)
46
- }}
47
-
48
- var roleListCmd = &cobra.Command{Use: "list", Short: "List roles", RunE: func(cmd *cobra.Command, args []string) error {
49
- cfg, client, err := httpClientFor(cmd); if err != nil { return err }; result, err := client.ListRoles(); if err != nil { return err }; return printOutput(cfg.Output, result)
50
- }}
51
-
52
- var roleCreateCmd = &cobra.Command{Use: "create <name> <permission,...>", Short: "Create a role", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error {
53
- cfg, client, err := httpClientFor(cmd); if err != nil { return err }; permissions := strings.Split(args[1], ","); result, err := client.CreateRole(args[0], permissions); if err != nil { return err }; return printOutput(cfg.Output, result)
54
- }}
55
-
56
- var roleDeleteCmd = &cobra.Command{Use: "delete <name>", Short: "Delete a role", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error {
57
- cfg, client, err := httpClientFor(cmd); if err != nil { return err }; result, err := client.DeleteRole(args[0]); if err != nil { return err }; return printOutput(cfg.Output, result)
58
- }}
59
-
60
- var rolePermissionsCmd = &cobra.Command{Use: "permissions", Short: "List available permissions", RunE: func(cmd *cobra.Command, args []string) error {
61
- cfg, client, err := httpClientFor(cmd); if err != nil { return err }; result, err := client.ListPermissions(); if err != nil { return err }; return printOutput(cfg.Output, result)
62
- }}
63
-
64
- func init() {
65
- userCmd.AddCommand(userListCmd, userCreateCmd, userRoleCmd, userResetCmd, userDeleteCmd, userChangePasswordCmd)
66
- roleCmd.AddCommand(roleListCmd, roleCreateCmd, roleDeleteCmd, rolePermissionsCmd)
67
- rootCmd.AddCommand(userCmd, roleCmd)
68
- }
@@ -1,169 +0,0 @@
1
- package cmd
2
-
3
- import (
4
- "fmt"
5
-
6
- "github.com/nexoral/axiodb-cli/internal/config"
7
- "github.com/nexoral/axiodb-cli/pkg/commands"
8
- "github.com/nexoral/axiodb-cli/pkg/protocol"
9
- "github.com/spf13/cobra"
10
- )
11
-
12
- var collectionCmd = &cobra.Command{
13
- Use: "collection",
14
- Short: "Collection operations",
15
- }
16
-
17
- var collectionCreateCmd = &cobra.Command{
18
- Use: "create <name>",
19
- Short: "Create a collection",
20
- Args: cobra.ExactArgs(1),
21
- RunE: func(cmd *cobra.Command, args []string) error {
22
- cfg, err := config.FromFlags(cmd)
23
- if err != nil {
24
- return err
25
- }
26
- if cfg.DB == "" {
27
- return fmt.Errorf("--db flag is required")
28
- }
29
- client, err := cfg.ConnectAndAuth()
30
- if err != nil {
31
- return err
32
- }
33
- defer client.Disconnect()
34
-
35
- resp, err := commands.CreateCollection(client, cfg.DB, args[0])
36
- if err != nil {
37
- return err
38
- }
39
- return printOutput(cfg.Output, resp)
40
- },
41
- }
42
-
43
- var collectionDeleteCmd = &cobra.Command{
44
- Use: "delete <name>",
45
- Short: "Delete a collection",
46
- Args: cobra.ExactArgs(1),
47
- RunE: func(cmd *cobra.Command, args []string) error {
48
- cfg, err := config.FromFlags(cmd)
49
- if err != nil {
50
- return err
51
- }
52
- if cfg.DB == "" {
53
- return fmt.Errorf("--db flag is required")
54
- }
55
- client, err := cfg.ConnectAndAuth()
56
- if err != nil {
57
- return err
58
- }
59
- defer client.Disconnect()
60
-
61
- resp, err := commands.DeleteCollection(client, cfg.DB, args[0])
62
- if err != nil {
63
- return err
64
- }
65
- return printOutput(cfg.Output, resp)
66
- },
67
- }
68
-
69
- var collectionExistsCmd = &cobra.Command{
70
- Use: "exists <name>",
71
- Short: "Check if a collection exists",
72
- Args: cobra.ExactArgs(1),
73
- RunE: func(cmd *cobra.Command, args []string) error {
74
- cfg, err := config.FromFlags(cmd)
75
- if err != nil {
76
- return err
77
- }
78
- if cfg.DB == "" {
79
- return fmt.Errorf("--db flag is required")
80
- }
81
- client, err := cfg.ConnectAndAuth()
82
- if err != nil {
83
- return err
84
- }
85
- defer client.Disconnect()
86
-
87
- exists, err := commands.CollectionExists(client, cfg.DB, args[0])
88
- if err != nil {
89
- return err
90
- }
91
- fmt.Printf("Collection '%s' exists: %v\n", args[0], exists)
92
- return nil
93
- },
94
- }
95
-
96
- var collectionInfoCmd = &cobra.Command{
97
- Use: "info",
98
- Short: "Get collection information",
99
- RunE: func(cmd *cobra.Command, args []string) error {
100
- cfg, err := config.FromFlags(cmd)
101
- if err != nil {
102
- return err
103
- }
104
- if cfg.DB == "" {
105
- return fmt.Errorf("--db flag is required")
106
- }
107
- client, err := cfg.ConnectAndAuth()
108
- if err != nil {
109
- return err
110
- }
111
- defer client.Disconnect()
112
-
113
- resp, err := commands.GetCollectionInfo(client, cfg.DB)
114
- if err != nil {
115
- return err
116
- }
117
- return printOutput(cfg.Output, resp)
118
- },
119
- }
120
-
121
- var collectionListCmd = &cobra.Command{
122
- Use: "list",
123
- Short: "List all collections in a database",
124
- RunE: func(cmd *cobra.Command, args []string) error {
125
- cfg, err := config.FromFlags(cmd)
126
- if err != nil {
127
- return err
128
- }
129
- if cfg.DB == "" {
130
- return fmt.Errorf("--db flag is required")
131
- }
132
- client, err := cfg.ConnectAndAuth()
133
- if err != nil {
134
- return err
135
- }
136
- defer client.Disconnect()
137
-
138
- resp, err := commands.GetCollectionInfo(client, cfg.DB)
139
- if err != nil {
140
- return err
141
- }
142
- return printOutput(cfg.Output, resp)
143
- },
144
- }
145
-
146
- func init() {
147
- collectionCmd.AddCommand(collectionCreateCmd)
148
- collectionCmd.AddCommand(collectionDeleteCmd)
149
- collectionCmd.AddCommand(collectionExistsCmd)
150
- collectionCmd.AddCommand(collectionInfoCmd)
151
- collectionCmd.AddCommand(collectionListCmd)
152
- rootCmd.AddCommand(collectionCmd)
153
- }
154
-
155
- func createCollection(client *protocol.Client, dbName, collName string) (*protocol.Response, error) {
156
- return commands.CreateCollection(client, dbName, collName)
157
- }
158
-
159
- func deleteCollection(client *protocol.Client, dbName, collName string) (*protocol.Response, error) {
160
- return commands.DeleteCollection(client, dbName, collName)
161
- }
162
-
163
- func collectionExists(client *protocol.Client, dbName, collName string) (bool, error) {
164
- return commands.CollectionExists(client, dbName, collName)
165
- }
166
-
167
- func getCollectionInfo(client *protocol.Client, dbName string) (*protocol.Response, error) {
168
- return commands.GetCollectionInfo(client, dbName)
169
- }