@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.
- package/.beads/.br_history/issues.20260314_212352_900045509.jsonl +0 -0
- package/.beads/.br_history/issues.20260314_212352_900045509.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_212353_087140743.jsonl +1 -0
- package/.beads/.br_history/issues.20260314_212353_087140743.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_212353_285881504.jsonl +2 -0
- package/.beads/.br_history/issues.20260314_212353_285881504.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_212353_473915419.jsonl +3 -0
- package/.beads/.br_history/issues.20260314_212353_473915419.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_212353_659476307.jsonl +4 -0
- package/.beads/.br_history/issues.20260314_212353_659476307.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_212353_869998925.jsonl +5 -0
- package/.beads/.br_history/issues.20260314_212353_869998925.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_212354_054785029.jsonl +6 -0
- package/.beads/.br_history/issues.20260314_212354_054785029.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_213336_175893691.jsonl +7 -0
- package/.beads/.br_history/issues.20260314_213336_175893691.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_213336_338509797.jsonl +7 -0
- package/.beads/.br_history/issues.20260314_213336_338509797.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_213336_515443192.jsonl +7 -0
- package/.beads/.br_history/issues.20260314_213336_515443192.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_213336_676417592.jsonl +7 -0
- package/.beads/.br_history/issues.20260314_213336_676417592.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_213336_839182422.jsonl +7 -0
- package/.beads/.br_history/issues.20260314_213336_839182422.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_213337_004349113.jsonl +7 -0
- package/.beads/.br_history/issues.20260314_213337_004349113.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_213337_179824080.jsonl +7 -0
- package/.beads/.br_history/issues.20260314_213337_179824080.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_213701_705075332.jsonl +7 -0
- package/.beads/.br_history/issues.20260314_213701_705075332.jsonl.meta.json +1 -0
- package/.beads/.br_history/issues.20260314_213706_783128702.jsonl +8 -0
- package/.beads/.br_history/issues.20260314_213706_783128702.jsonl.meta.json +1 -0
- package/.beads/config.yaml +4 -0
- package/.beads/issues.jsonl +8 -0
- package/.beads/metadata.json +4 -0
- package/.env.example +8 -0
- package/autochangelog/.env.example +36 -0
- package/autochangelog/README.md +412 -0
- package/autochangelog/config/database.js +27 -0
- package/autochangelog/package.json +47 -0
- package/autochangelog/public/landing.html +581 -0
- package/autochangelog/server.js +104 -0
- package/autochangelog/src/app.js +181 -0
- package/autochangelog/src/config/database.js +26 -0
- package/autochangelog/src/controllers/auth.js +488 -0
- package/autochangelog/src/controllers/changelog.js +682 -0
- package/autochangelog/src/controllers/project.js +580 -0
- package/autochangelog/src/controllers/repository.js +780 -0
- package/autochangelog/src/middleware/auth.js +386 -0
- package/autochangelog/src/models/Changelog.js +443 -0
- package/autochangelog/src/models/Project.js +226 -0
- package/autochangelog/src/models/Repository.js +366 -0
- package/autochangelog/src/models/User.js +223 -0
- package/autochangelog/src/routes/auth.routes.js +32 -0
- package/autochangelog/src/routes/changelog.routes.js +42 -0
- package/autochangelog/src/routes/github-auth.routes.js +102 -0
- package/autochangelog/src/routes/project.routes.js +50 -0
- package/autochangelog/src/routes/repository.routes.js +54 -0
- package/autochangelog/src/services/changelog.js +722 -0
- package/autochangelog/src/services/github.js +243 -0
- package/autochangelog/utils/logger.js +77 -0
- package/autochangelog/views/404.ejs +18 -0
- package/autochangelog/views/dashboard.ejs +596 -0
- package/autochangelog/views/index.ejs +231 -0
- package/autochangelog/views/layouts/main.ejs +44 -0
- package/autochangelog/views/login.ejs +104 -0
- package/autochangelog/views/partials/footer.ejs +20 -0
- package/autochangelog/views/partials/navbar.ejs +51 -0
- package/autochangelog/views/register.ejs +109 -0
- package/autochangelog-cli/README.md +266 -0
- package/autochangelog-cli/bin/autochangelog +120 -0
- package/autochangelog-cli/package.json +46 -0
- package/autochangelog-cli/src/cli/commands/auth.js +291 -0
- package/autochangelog-cli/src/cli/commands/changelog.js +619 -0
- package/autochangelog-cli/src/cli/commands/project.js +427 -0
- package/autochangelog-cli/src/cli/commands/repo.js +557 -0
- package/autochangelog-cli/src/cli/commands/stats.js +706 -0
- package/autochangelog-cli/src/cli/utils/config.js +277 -0
- package/autochangelog-cli/src/cli/utils/errors.js +307 -0
- package/autochangelog-cli/src/cli/utils/logger.js +75 -0
- package/autochangelog-cli/src/cli/utils/output.js +357 -0
- package/package.json +9 -3
- package/plugins/supercli/README.md +108 -0
- package/plugins/supercli/plugin.json +123 -0
- package/server.js +1 -1
- package/src/cli/api.js +380 -0
- package/src/cli/direct/agent-utils.js +61 -0
- package/src/cli/direct/cli-utils.js +112 -0
- package/src/cli/direct/data-seeding.js +307 -0
- package/src/cli/direct/db-admin.js +84 -0
- package/src/cli/direct/db-advanced.js +372 -0
- package/src/cli/direct/db-utils.js +558 -0
- package/src/cli/direct/help.js +195 -0
- package/src/cli/direct/migration.js +107 -0
- package/src/cli/direct/rbac-advanced.js +132 -0
- package/src/cli/direct/resources-additional.js +400 -0
- package/src/cli/direct/resources-cms-advanced.js +173 -0
- package/src/cli/direct/resources-cms.js +247 -0
- package/src/cli/direct/resources-core.js +253 -0
- package/src/cli/direct/resources-execution.js +367 -0
- package/src/cli/direct/resources-health.js +152 -0
- package/src/cli/direct/resources-integrations.js +182 -0
- package/src/cli/direct/resources-logs.js +204 -0
- package/src/cli/direct/resources-org-rbac.js +187 -0
- package/src/cli/direct/resources-system.js +236 -0
- package/src/cli/direct.js +556 -0
- package/src/controllers/admin.controller.js +4 -0
- package/src/controllers/auth.controller.js +148 -1
- package/src/controllers/waitingList.controller.js +130 -1
- package/src/models/RbacRole.js +1 -1
- package/src/models/User.js +39 -5
- package/src/routes/auth.routes.js +6 -0
- package/src/routes/waitingList.routes.js +12 -2
- package/src/routes/waitingListAdmin.routes.js +3 -0
- package/src/services/email.service.js +1 -0
- package/src/services/github.service.js +255 -0
- package/src/services/rateLimiter.service.js +29 -1
- package/src/services/waitingListJson.service.js +32 -3
- package/views/admin-waiting-list.ejs +386 -3
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
const express = require("express");
|
|
2
|
+
const router = express.Router();
|
|
3
|
+
const githubService = require("../services/github");
|
|
4
|
+
const User = require("../models/User"); // Will use SuperBackend's User model
|
|
5
|
+
const { generateToken } = require("../middleware/auth");
|
|
6
|
+
const logger = require("../../utils/logger");
|
|
7
|
+
|
|
8
|
+
// Redirect to GitHub OAuth
|
|
9
|
+
router.get("/github", (req, res) => {
|
|
10
|
+
try {
|
|
11
|
+
const authUrl = githubService.getAuthURL();
|
|
12
|
+
res.redirect(authUrl);
|
|
13
|
+
} catch (error) {
|
|
14
|
+
logger.error("GitHub OAuth redirect error:", error);
|
|
15
|
+
res
|
|
16
|
+
.status(500)
|
|
17
|
+
.json({ success: false, message: "Failed to initiate GitHub login" });
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// GitHub OAuth callback
|
|
22
|
+
router.get("/github/callback", async (req, res) => {
|
|
23
|
+
try {
|
|
24
|
+
const { code, state } = req.query;
|
|
25
|
+
|
|
26
|
+
if (!code) {
|
|
27
|
+
return res
|
|
28
|
+
.status(400)
|
|
29
|
+
.json({ success: false, message: "Authorization code missing" });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Exchange code for access token
|
|
33
|
+
const tokenResponse = await githubService.getAccessToken(code);
|
|
34
|
+
if (!tokenResponse.access_token) {
|
|
35
|
+
return res
|
|
36
|
+
.status(400)
|
|
37
|
+
.json({ success: false, message: "Failed to get access token" });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const accessToken = tokenResponse.access_token;
|
|
41
|
+
|
|
42
|
+
// Get user info from GitHub
|
|
43
|
+
const githubUser = await githubService.getUser(accessToken);
|
|
44
|
+
|
|
45
|
+
// Check if user exists with this GitHub ID
|
|
46
|
+
let user = await User.findOne({ githubId: githubUser.id });
|
|
47
|
+
|
|
48
|
+
if (!user) {
|
|
49
|
+
// Check if user exists with this email
|
|
50
|
+
user = await User.findOne({
|
|
51
|
+
email:
|
|
52
|
+
githubUser.email || `${githubUser.login}@users.noreply.github.com`,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (user) {
|
|
56
|
+
// Link GitHub account to existing user
|
|
57
|
+
user.githubId = githubUser.id;
|
|
58
|
+
user.githubUsername = githubUser.login;
|
|
59
|
+
user.githubAccessToken = accessToken;
|
|
60
|
+
user.githubEmail = githubUser.email;
|
|
61
|
+
user.avatar = githubUser.avatar_url;
|
|
62
|
+
if (githubUser.name) user.name = githubUser.name;
|
|
63
|
+
await user.save();
|
|
64
|
+
} else {
|
|
65
|
+
// Create new user
|
|
66
|
+
user = new User({
|
|
67
|
+
email:
|
|
68
|
+
githubUser.email || `${githubUser.login}@users.noreply.github.com`,
|
|
69
|
+
name: githubUser.name || githubUser.login,
|
|
70
|
+
githubId: githubUser.id,
|
|
71
|
+
githubUsername: githubUser.login,
|
|
72
|
+
githubAccessToken: accessToken,
|
|
73
|
+
githubEmail: githubUser.email,
|
|
74
|
+
avatar: githubUser.avatar_url,
|
|
75
|
+
emailVerified: !!githubUser.email,
|
|
76
|
+
isActive: true,
|
|
77
|
+
});
|
|
78
|
+
await user.save();
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
// Update existing user's token and info
|
|
82
|
+
user.githubAccessToken = accessToken;
|
|
83
|
+
user.avatar = githubUser.avatar_url;
|
|
84
|
+
if (githubUser.name) user.name = githubUser.name;
|
|
85
|
+
await user.save();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Generate JWT token
|
|
89
|
+
const token = generateToken(user._id);
|
|
90
|
+
|
|
91
|
+
// Redirect to dashboard with token in URL hash (frontend extracts it)
|
|
92
|
+
const redirectUrl = `${process.env.FRONTEND_URL || "http://localhost:3000"}/dashboard#token=${token}`;
|
|
93
|
+
res.redirect(redirectUrl);
|
|
94
|
+
} catch (error) {
|
|
95
|
+
logger.error("GitHub OAuth callback error:", error);
|
|
96
|
+
res
|
|
97
|
+
.status(500)
|
|
98
|
+
.json({ success: false, message: "GitHub authentication failed" });
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
module.exports = router;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const express = require("express");
|
|
2
|
+
const {
|
|
3
|
+
createProject,
|
|
4
|
+
getProjects,
|
|
5
|
+
getProject,
|
|
6
|
+
updateProject,
|
|
7
|
+
deleteProject,
|
|
8
|
+
archiveProject,
|
|
9
|
+
getProjectStatistics,
|
|
10
|
+
searchProjects,
|
|
11
|
+
getProjectRepositories,
|
|
12
|
+
getProjectChangelogs,
|
|
13
|
+
getUserStatistics,
|
|
14
|
+
} = require("../controllers/project");
|
|
15
|
+
const {
|
|
16
|
+
authenticate,
|
|
17
|
+
checkOwnership,
|
|
18
|
+
checkSubscription,
|
|
19
|
+
checkUsageLimits,
|
|
20
|
+
apiRateLimit,
|
|
21
|
+
} = require("../middleware/auth");
|
|
22
|
+
|
|
23
|
+
const router = express.Router();
|
|
24
|
+
|
|
25
|
+
// Protected routes - require authentication
|
|
26
|
+
router.use(authenticate);
|
|
27
|
+
router.use(apiRateLimit);
|
|
28
|
+
|
|
29
|
+
// Project statistics endpoint (user-level stats)
|
|
30
|
+
router.get("/stats", getUserStatistics); // Get aggregate stats for dashboard
|
|
31
|
+
|
|
32
|
+
// Project CRUD operations
|
|
33
|
+
router.post("/", checkUsageLimits, createProject);
|
|
34
|
+
router.get("/", getProjects);
|
|
35
|
+
router.get("/search", searchProjects);
|
|
36
|
+
router.get("/:id", getProject);
|
|
37
|
+
router.put("/:id", checkOwnership("Project"), updateProject);
|
|
38
|
+
router.delete("/:id", checkOwnership("Project"), deleteProject);
|
|
39
|
+
router.post("/:id/archive", checkOwnership("Project"), archiveProject);
|
|
40
|
+
|
|
41
|
+
// Project statistics and related data
|
|
42
|
+
router.get("/:id/statistics", checkOwnership("Project"), getProjectStatistics);
|
|
43
|
+
router.get(
|
|
44
|
+
"/:id/repositories",
|
|
45
|
+
checkOwnership("Project"),
|
|
46
|
+
getProjectRepositories,
|
|
47
|
+
);
|
|
48
|
+
router.get("/:id/changelogs", checkOwnership("Project"), getProjectChangelogs);
|
|
49
|
+
|
|
50
|
+
module.exports = router;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const express = require("express");
|
|
2
|
+
const {
|
|
3
|
+
createRepository,
|
|
4
|
+
getRepositories,
|
|
5
|
+
getRepository,
|
|
6
|
+
updateRepository,
|
|
7
|
+
deleteRepository,
|
|
8
|
+
syncRepository,
|
|
9
|
+
getAvailableMonths,
|
|
10
|
+
validateRepository,
|
|
11
|
+
getRepositoryStatistics,
|
|
12
|
+
getUserGithubRepositories,
|
|
13
|
+
connectGithubRepository,
|
|
14
|
+
} = require("../controllers/repository");
|
|
15
|
+
const {
|
|
16
|
+
authenticate,
|
|
17
|
+
checkOwnership,
|
|
18
|
+
checkSubscription,
|
|
19
|
+
checkUsageLimits,
|
|
20
|
+
apiRateLimit,
|
|
21
|
+
} = require("../middleware/auth");
|
|
22
|
+
|
|
23
|
+
const router = express.Router();
|
|
24
|
+
|
|
25
|
+
// Protected routes - require authentication
|
|
26
|
+
router.use(authenticate);
|
|
27
|
+
router.use(apiRateLimit);
|
|
28
|
+
|
|
29
|
+
// Repository CRUD operations
|
|
30
|
+
router.post("/", checkUsageLimits, createRepository);
|
|
31
|
+
router.get("/:projectId", getRepositories);
|
|
32
|
+
router.get("/detail/:id", getRepository);
|
|
33
|
+
router.put("/:id", checkOwnership("Repository"), updateRepository);
|
|
34
|
+
router.delete("/:id", checkOwnership("Repository"), deleteRepository);
|
|
35
|
+
|
|
36
|
+
// Repository management
|
|
37
|
+
router.post("/:id/sync", checkOwnership("Repository"), syncRepository);
|
|
38
|
+
router.get(
|
|
39
|
+
"/:id/available-months",
|
|
40
|
+
checkOwnership("Repository"),
|
|
41
|
+
getAvailableMonths,
|
|
42
|
+
);
|
|
43
|
+
router.get("/:id/validate", checkOwnership("Repository"), validateRepository);
|
|
44
|
+
router.get(
|
|
45
|
+
"/:id/statistics",
|
|
46
|
+
checkOwnership("Repository"),
|
|
47
|
+
getRepositoryStatistics,
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// GitHub integration
|
|
51
|
+
router.get("/github/repos", getUserGithubRepositories);
|
|
52
|
+
router.post("/github/connect", connectGithubRepository);
|
|
53
|
+
|
|
54
|
+
module.exports = router;
|