@intranefr/superbackend 1.6.7 → 1.7.8

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 (119) hide show
  1. package/.beads/.br_history/issues.20260314_212352_900045509.jsonl +0 -0
  2. package/.beads/.br_history/issues.20260314_212352_900045509.jsonl.meta.json +1 -0
  3. package/.beads/.br_history/issues.20260314_212353_087140743.jsonl +1 -0
  4. package/.beads/.br_history/issues.20260314_212353_087140743.jsonl.meta.json +1 -0
  5. package/.beads/.br_history/issues.20260314_212353_285881504.jsonl +2 -0
  6. package/.beads/.br_history/issues.20260314_212353_285881504.jsonl.meta.json +1 -0
  7. package/.beads/.br_history/issues.20260314_212353_473915419.jsonl +3 -0
  8. package/.beads/.br_history/issues.20260314_212353_473915419.jsonl.meta.json +1 -0
  9. package/.beads/.br_history/issues.20260314_212353_659476307.jsonl +4 -0
  10. package/.beads/.br_history/issues.20260314_212353_659476307.jsonl.meta.json +1 -0
  11. package/.beads/.br_history/issues.20260314_212353_869998925.jsonl +5 -0
  12. package/.beads/.br_history/issues.20260314_212353_869998925.jsonl.meta.json +1 -0
  13. package/.beads/.br_history/issues.20260314_212354_054785029.jsonl +6 -0
  14. package/.beads/.br_history/issues.20260314_212354_054785029.jsonl.meta.json +1 -0
  15. package/.beads/.br_history/issues.20260314_213336_175893691.jsonl +7 -0
  16. package/.beads/.br_history/issues.20260314_213336_175893691.jsonl.meta.json +1 -0
  17. package/.beads/.br_history/issues.20260314_213336_338509797.jsonl +7 -0
  18. package/.beads/.br_history/issues.20260314_213336_338509797.jsonl.meta.json +1 -0
  19. package/.beads/.br_history/issues.20260314_213336_515443192.jsonl +7 -0
  20. package/.beads/.br_history/issues.20260314_213336_515443192.jsonl.meta.json +1 -0
  21. package/.beads/.br_history/issues.20260314_213336_676417592.jsonl +7 -0
  22. package/.beads/.br_history/issues.20260314_213336_676417592.jsonl.meta.json +1 -0
  23. package/.beads/.br_history/issues.20260314_213336_839182422.jsonl +7 -0
  24. package/.beads/.br_history/issues.20260314_213336_839182422.jsonl.meta.json +1 -0
  25. package/.beads/.br_history/issues.20260314_213337_004349113.jsonl +7 -0
  26. package/.beads/.br_history/issues.20260314_213337_004349113.jsonl.meta.json +1 -0
  27. package/.beads/.br_history/issues.20260314_213337_179824080.jsonl +7 -0
  28. package/.beads/.br_history/issues.20260314_213337_179824080.jsonl.meta.json +1 -0
  29. package/.beads/.br_history/issues.20260314_213701_705075332.jsonl +7 -0
  30. package/.beads/.br_history/issues.20260314_213701_705075332.jsonl.meta.json +1 -0
  31. package/.beads/.br_history/issues.20260314_213706_783128702.jsonl +8 -0
  32. package/.beads/.br_history/issues.20260314_213706_783128702.jsonl.meta.json +1 -0
  33. package/.beads/config.yaml +4 -0
  34. package/.beads/issues.jsonl +8 -0
  35. package/.beads/metadata.json +4 -0
  36. package/.env.example +8 -0
  37. package/autochangelog/.env.example +36 -0
  38. package/autochangelog/README.md +412 -0
  39. package/autochangelog/config/database.js +27 -0
  40. package/autochangelog/package.json +47 -0
  41. package/autochangelog/public/landing.html +581 -0
  42. package/autochangelog/server.js +104 -0
  43. package/autochangelog/src/app.js +181 -0
  44. package/autochangelog/src/config/database.js +26 -0
  45. package/autochangelog/src/controllers/auth.js +488 -0
  46. package/autochangelog/src/controllers/changelog.js +682 -0
  47. package/autochangelog/src/controllers/project.js +580 -0
  48. package/autochangelog/src/controllers/repository.js +780 -0
  49. package/autochangelog/src/middleware/auth.js +386 -0
  50. package/autochangelog/src/models/Changelog.js +443 -0
  51. package/autochangelog/src/models/Project.js +226 -0
  52. package/autochangelog/src/models/Repository.js +366 -0
  53. package/autochangelog/src/models/User.js +223 -0
  54. package/autochangelog/src/routes/auth.routes.js +32 -0
  55. package/autochangelog/src/routes/changelog.routes.js +42 -0
  56. package/autochangelog/src/routes/github-auth.routes.js +102 -0
  57. package/autochangelog/src/routes/project.routes.js +50 -0
  58. package/autochangelog/src/routes/repository.routes.js +54 -0
  59. package/autochangelog/src/services/changelog.js +722 -0
  60. package/autochangelog/src/services/github.js +243 -0
  61. package/autochangelog/utils/logger.js +77 -0
  62. package/autochangelog/views/404.ejs +18 -0
  63. package/autochangelog/views/dashboard.ejs +596 -0
  64. package/autochangelog/views/index.ejs +231 -0
  65. package/autochangelog/views/layouts/main.ejs +44 -0
  66. package/autochangelog/views/login.ejs +104 -0
  67. package/autochangelog/views/partials/footer.ejs +20 -0
  68. package/autochangelog/views/partials/navbar.ejs +51 -0
  69. package/autochangelog/views/register.ejs +109 -0
  70. package/autochangelog-cli/README.md +266 -0
  71. package/autochangelog-cli/bin/autochangelog +120 -0
  72. package/autochangelog-cli/package.json +46 -0
  73. package/autochangelog-cli/src/cli/commands/auth.js +291 -0
  74. package/autochangelog-cli/src/cli/commands/changelog.js +619 -0
  75. package/autochangelog-cli/src/cli/commands/project.js +427 -0
  76. package/autochangelog-cli/src/cli/commands/repo.js +557 -0
  77. package/autochangelog-cli/src/cli/commands/stats.js +706 -0
  78. package/autochangelog-cli/src/cli/utils/config.js +277 -0
  79. package/autochangelog-cli/src/cli/utils/errors.js +307 -0
  80. package/autochangelog-cli/src/cli/utils/logger.js +75 -0
  81. package/autochangelog-cli/src/cli/utils/output.js +357 -0
  82. package/package.json +9 -3
  83. package/plugins/supercli/README.md +108 -0
  84. package/plugins/supercli/plugin.json +123 -0
  85. package/server.js +1 -1
  86. package/src/cli/api.js +380 -0
  87. package/src/cli/direct/agent-utils.js +61 -0
  88. package/src/cli/direct/cli-utils.js +112 -0
  89. package/src/cli/direct/data-seeding.js +307 -0
  90. package/src/cli/direct/db-admin.js +84 -0
  91. package/src/cli/direct/db-advanced.js +372 -0
  92. package/src/cli/direct/db-utils.js +558 -0
  93. package/src/cli/direct/help.js +195 -0
  94. package/src/cli/direct/migration.js +107 -0
  95. package/src/cli/direct/rbac-advanced.js +132 -0
  96. package/src/cli/direct/resources-additional.js +400 -0
  97. package/src/cli/direct/resources-cms-advanced.js +173 -0
  98. package/src/cli/direct/resources-cms.js +247 -0
  99. package/src/cli/direct/resources-core.js +253 -0
  100. package/src/cli/direct/resources-execution.js +367 -0
  101. package/src/cli/direct/resources-health.js +152 -0
  102. package/src/cli/direct/resources-integrations.js +182 -0
  103. package/src/cli/direct/resources-logs.js +204 -0
  104. package/src/cli/direct/resources-org-rbac.js +187 -0
  105. package/src/cli/direct/resources-system.js +236 -0
  106. package/src/cli/direct.js +556 -0
  107. package/src/controllers/admin.controller.js +4 -0
  108. package/src/controllers/auth.controller.js +148 -1
  109. package/src/controllers/waitingList.controller.js +130 -1
  110. package/src/models/RbacRole.js +1 -1
  111. package/src/models/User.js +39 -5
  112. package/src/routes/auth.routes.js +6 -0
  113. package/src/routes/waitingList.routes.js +12 -2
  114. package/src/routes/waitingListAdmin.routes.js +3 -0
  115. package/src/services/email.service.js +1 -0
  116. package/src/services/github.service.js +255 -0
  117. package/src/services/rateLimiter.service.js +29 -1
  118. package/src/services/waitingListJson.service.js +32 -3
  119. package/views/admin-waiting-list.ejs +386 -3
@@ -0,0 +1,243 @@
1
+ const axios = require("axios");
2
+
3
+ class GitHubService {
4
+ constructor(accessToken) {
5
+ this.accessToken = accessToken;
6
+ this.baseURL = "https://api.github.com";
7
+ this.client = axios.create({
8
+ baseURL: this.baseURL,
9
+ headers: {
10
+ Authorization: `token ${accessToken}`,
11
+ Accept: "application/vnd.github.v3+json",
12
+ },
13
+ });
14
+ }
15
+
16
+ // Get user's repositories
17
+ async getUserRepos(options = {}) {
18
+ const {
19
+ per_page = 100,
20
+ page = 1,
21
+ sort = "updated",
22
+ visibility = "all",
23
+ } = options;
24
+
25
+ try {
26
+ const response = await this.client.get("/user/repos", {
27
+ params: { per_page, page, sort, visibility },
28
+ });
29
+
30
+ return {
31
+ success: true,
32
+ data: response.data,
33
+ headers: response.headers,
34
+ };
35
+ } catch (error) {
36
+ return this.handleError(error);
37
+ }
38
+ }
39
+
40
+ // Get organization repositories
41
+ async getOrgRepos(org, options = {}) {
42
+ const { per_page = 100, page = 1 } = options;
43
+
44
+ try {
45
+ const response = await this.client.get(`/orgs/${org}/repos`, {
46
+ params: { per_page, page },
47
+ });
48
+
49
+ return {
50
+ success: true,
51
+ data: response.data,
52
+ headers: response.headers,
53
+ };
54
+ } catch (error) {
55
+ return this.handleError(error);
56
+ }
57
+ }
58
+
59
+ // Get repository details
60
+ async getRepo(fullName) {
61
+ try {
62
+ const response = await this.client.get(`/repos/${fullName}`);
63
+
64
+ return {
65
+ success: true,
66
+ data: response.data,
67
+ };
68
+ } catch (error) {
69
+ return this.handleError(error);
70
+ }
71
+ }
72
+
73
+ // Get repository branches
74
+ async getBranches(fullName, options = {}) {
75
+ const { per_page = 100, page = 1 } = options;
76
+
77
+ try {
78
+ const response = await this.client.get(`/repos/${fullName}/branches`, {
79
+ params: { per_page, page },
80
+ });
81
+
82
+ return {
83
+ success: true,
84
+ data: response.data,
85
+ headers: response.headers,
86
+ };
87
+ } catch (error) {
88
+ return this.handleError(error);
89
+ }
90
+ }
91
+
92
+ // Get repository commits
93
+ async getCommits(fullName, options = {}) {
94
+ const { sha = "main", per_page = 100, page = 1, since, until } = options;
95
+
96
+ try {
97
+ const response = await this.client.get(`/repos/${fullName}/commits`, {
98
+ params: { sha, per_page, page, since, until },
99
+ });
100
+
101
+ return {
102
+ success: true,
103
+ data: response.data,
104
+ headers: response.headers,
105
+ };
106
+ } catch (error) {
107
+ return this.handleError(error);
108
+ }
109
+ }
110
+
111
+ // Get repository pull requests
112
+ async getPullRequests(fullName, options = {}) {
113
+ const { state = "all", per_page = 100, page = 1, base, head } = options;
114
+
115
+ try {
116
+ const response = await this.client.get(`/repos/${fullName}/pulls`, {
117
+ params: { state, per_page, page, base, head },
118
+ });
119
+
120
+ return {
121
+ success: true,
122
+ data: response.data,
123
+ headers: response.headers,
124
+ };
125
+ } catch (error) {
126
+ return this.handleError(error);
127
+ }
128
+ }
129
+
130
+ // Get pull request details
131
+ async getPullRequest(fullName, prNumber) {
132
+ try {
133
+ const response = await this.client.get(
134
+ `/repos/${fullName}/pulls/${prNumber}`,
135
+ );
136
+
137
+ return {
138
+ success: true,
139
+ data: response.data,
140
+ };
141
+ } catch (error) {
142
+ return this.handleError(error);
143
+ }
144
+ }
145
+
146
+ // Get repository releases
147
+ async getReleases(fullName, options = {}) {
148
+ const { per_page = 100, page = 1 } = options;
149
+
150
+ try {
151
+ const response = await this.client.get(`/repos/${fullName}/releases`, {
152
+ params: { per_page, page },
153
+ });
154
+
155
+ return {
156
+ success: true,
157
+ data: response.data,
158
+ headers: response.headers,
159
+ };
160
+ } catch (error) {
161
+ return this.handleError(error);
162
+ }
163
+ }
164
+
165
+ // Create webhook
166
+ async createWebhook(
167
+ fullName,
168
+ webhookUrl,
169
+ secret = "",
170
+ events = ["push", "pull_request"],
171
+ ) {
172
+ try {
173
+ const response = await this.client.post(`/repos/${fullName}/hooks`, {
174
+ name: "web",
175
+ active: true,
176
+ events,
177
+ config: {
178
+ url: webhookUrl,
179
+ content_type: "json",
180
+ secret: secret || undefined,
181
+ insecure_ssl: "0",
182
+ },
183
+ });
184
+
185
+ return {
186
+ success: true,
187
+ data: response.data,
188
+ };
189
+ } catch (error) {
190
+ return this.handleError(error);
191
+ }
192
+ }
193
+
194
+ // Delete webhook
195
+ async deleteWebhook(fullName, hookId) {
196
+ try {
197
+ await this.client.delete(`/repos/${fullName}/hooks/${hookId}`);
198
+
199
+ return {
200
+ success: true,
201
+ };
202
+ } catch (error) {
203
+ return this.handleError(error);
204
+ }
205
+ }
206
+
207
+ // List webhooks
208
+ async listWebhooks(fullName) {
209
+ try {
210
+ const response = await this.client.get(`/repos/${fullName}/hooks`);
211
+
212
+ return {
213
+ success: true,
214
+ data: response.data,
215
+ };
216
+ } catch (error) {
217
+ return this.handleError(error);
218
+ }
219
+ }
220
+
221
+ // Handle errors
222
+ handleError(error) {
223
+ if (error.response) {
224
+ return {
225
+ success: false,
226
+ error: {
227
+ message: error.response.data.message || "GitHub API error",
228
+ status: error.response.status,
229
+ documentation_url: error.response.data.documentation_url,
230
+ },
231
+ };
232
+ }
233
+
234
+ return {
235
+ success: false,
236
+ error: {
237
+ message: error.message || "Unknown error",
238
+ },
239
+ };
240
+ }
241
+ }
242
+
243
+ module.exports = GitHubService;
@@ -0,0 +1,77 @@
1
+ const winston = require('winston');
2
+ const path = require('path');
3
+
4
+ // Define log levels
5
+ const levels = {
6
+ error: 0,
7
+ warn: 1,
8
+ info: 2,
9
+ http: 3,
10
+ debug: 4,
11
+ };
12
+
13
+ // Define colors for each log level
14
+ const colors = {
15
+ error: 'red',
16
+ warn: 'yellow',
17
+ info: 'green',
18
+ http: 'magenta',
19
+ debug: 'white',
20
+ };
21
+
22
+ winston.addColors(colors);
23
+
24
+ // Define log format
25
+ const format = winston.format.combine(
26
+ winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss:ms' }),
27
+ winston.format.colorize({ all: true }),
28
+ winston.format.printf(
29
+ (info) => `${info.timestamp} ${info.level}: ${info.message}`
30
+ )
31
+ );
32
+
33
+ // Define transports (where logs go)
34
+ const transports = [
35
+ // Console transport
36
+ new winston.transports.Console({
37
+ format,
38
+ }),
39
+ // File transport for errors
40
+ new winston.transports.File({
41
+ filename: path.join(__dirname, '../logs/error.log'),
42
+ level: 'error',
43
+ format: winston.format.simple(),
44
+ }),
45
+ // File transport for all logs
46
+ new winston.transports.File({
47
+ filename: path.join(__dirname, '../logs/combined.log'),
48
+ format: winston.format.simple(),
49
+ }),
50
+ ];
51
+
52
+ // Create the logger
53
+ const logger = winston.createLogger({
54
+ level: process.env.LOG_LEVEL || 'info',
55
+ levels,
56
+ format,
57
+ transports,
58
+ });
59
+
60
+ // Create logs directory if it doesn't exist
61
+ const fs = require('fs');
62
+ const logsDir = path.join(__dirname, '../logs');
63
+ if (!fs.existsSync(logsDir)) {
64
+ fs.mkdirSync(logsDir, { recursive: true });
65
+ }
66
+
67
+ // If we're not in production, log to the `console` with the format:
68
+ // `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
69
+ if (process.env.NODE_ENV !== 'production') {
70
+ logger.add(
71
+ new winston.transports.Console({
72
+ format: winston.format.simple(),
73
+ })
74
+ );
75
+ }
76
+
77
+ module.exports = logger;
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" data-theme="light">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title><%= title %></title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link href="https://cdn.jsdelivr.net/npm/daisyui@4.4.19/dist/full.min.css" rel="stylesheet" type="text/css" />
9
+ </head>
10
+ <body class="min-h-screen bg-base-100 flex items-center justify-center">
11
+ <div class="text-center">
12
+ <h1 class="text-9xl font-bold text-primary">404</h1>
13
+ <h2 class="text-2xl font-bold mt-4">Page Not Found</h2>
14
+ <p class="text-gray-500 mt-2">The page you're looking for doesn't exist.</p>
15
+ <a href="/" class="btn btn-primary mt-6">Go Home</a>
16
+ </div>
17
+ </body>
18
+ </html>