@trebired/git-host 1.2.0 → 1.4.0
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/CHANGELOG.md +16 -0
- package/README.md +55 -6
- package/dist/api/forge/handler.d.ts +6 -0
- package/dist/api/forge/handler.d.ts.map +1 -0
- package/dist/api/forge/handler.js +260 -0
- package/dist/api/forge/handler.js.map +1 -0
- package/dist/api/forge/route.d.ts +34 -0
- package/dist/api/forge/route.d.ts.map +1 -0
- package/dist/api/forge/route.js +94 -0
- package/dist/api/forge/route.js.map +1 -0
- package/dist/api/handler/action.d.ts +1 -1
- package/dist/api/handler/response.d.ts +6 -2
- package/dist/api/handler/response.d.ts.map +1 -1
- package/dist/api/handler/response.js +5 -0
- package/dist/api/handler/response.js.map +1 -1
- package/dist/api/handler/route.d.ts +1 -1
- package/dist/browser/index.d.ts +44 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +767 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/styles.css +242 -0
- package/dist/core/create_git_forge.d.ts +4 -0
- package/dist/core/create_git_forge.d.ts.map +1 -0
- package/dist/core/create_git_forge.js +481 -0
- package/dist/core/create_git_forge.js.map +1 -0
- package/dist/core/create_git_host/content_methods.d.ts +1 -1
- package/dist/core/create_git_host/content_methods.d.ts.map +1 -1
- package/dist/core/create_git_host/content_methods.js +21 -0
- package/dist/core/create_git_host/content_methods.js.map +1 -1
- package/dist/core/git_forge/storage_memory.d.ts +4 -0
- package/dist/core/git_forge/storage_memory.d.ts.map +1 -0
- package/dist/core/git_forge/storage_memory.js +140 -0
- package/dist/core/git_forge/storage_memory.js.map +1 -0
- package/dist/core/inspect.d.ts +6 -1
- package/dist/core/inspect.d.ts.map +1 -1
- package/dist/core/inspect.js +3 -3
- package/dist/core/inspect.js.map +1 -1
- package/dist/core/inspection.d.ts +11 -0
- package/dist/core/inspection.d.ts.map +1 -0
- package/dist/core/inspection.js +593 -0
- package/dist/core/inspection.js.map +1 -0
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/react/client/types.d.ts +45 -1
- package/dist/react/client/types.d.ts.map +1 -1
- package/dist/react/client.d.ts.map +1 -1
- package/dist/react/client.js +135 -2
- package/dist/react/client.js.map +1 -1
- package/dist/react/hooks/query.d.ts +6 -2
- package/dist/react/hooks/query.d.ts.map +1 -1
- package/dist/react/hooks/query.js +41 -1
- package/dist/react/hooks/query.js.map +1 -1
- package/dist/react/hooks/resources.d.ts +50 -3
- package/dist/react/hooks/resources.d.ts.map +1 -1
- package/dist/react/hooks/resources.js +209 -2
- package/dist/react/hooks/resources.js.map +1 -1
- package/dist/react/hooks/types.d.ts +15 -2
- package/dist/react/hooks/types.d.ts.map +1 -1
- package/dist/react/hooks.d.ts +3 -3
- package/dist/react/hooks.d.ts.map +1 -1
- package/dist/react/hooks.js +2 -2
- package/dist/react/hooks.js.map +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/types/forge.d.ts +220 -0
- package/dist/types/forge.d.ts.map +1 -0
- package/dist/types/forge.js +2 -0
- package/dist/types/forge.js.map +1 -0
- package/dist/types/host.d.ts +46 -2
- package/dist/types/host.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/repository.d.ts +98 -1
- package/dist/types/repository.d.ts.map +1 -1
- package/dist/types/transports.d.ts +1 -1
- package/dist/types/transports.d.ts.map +1 -1
- package/package.json +14 -7
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ All notable changes to `@trebired/git-host` will be documented here.
|
|
|
4
4
|
|
|
5
5
|
This project follows semantic versioning once published.
|
|
6
6
|
|
|
7
|
+
## 1.4.0
|
|
8
|
+
|
|
9
|
+
- Added a new forge layer through `createGitForge()` with host-owned storage adapters for releases, forks, stars, watching, and repository activity timelines.
|
|
10
|
+
- Added `createGitForgeApiHandler()` plus new repository routes for overview, social state, releases, forks, fork sync, and activity while keeping the existing read-only JSON API stable.
|
|
11
|
+
- Extended the typed React client and hooks with forge reads and mutations, including optimistic star and watch helpers.
|
|
12
|
+
- Added `@trebired/git-host/browser` with reusable SSR-safe repository pages and bundled browser styles for overview, code, commits, releases, forks, and activity views.
|
|
13
|
+
- Added an in-memory forge storage adapter for tests, prototypes, and local embedding.
|
|
14
|
+
|
|
15
|
+
## 1.3.0
|
|
16
|
+
|
|
17
|
+
- Added a first-class repository inspection layer with `resolveInspectionTarget()`, `readTree()`, `readDirectory()`, `readFile()`, and `readRepositoryAnalysis()`.
|
|
18
|
+
- Added generic auto-ref resolution with safe empty/unborn repository handling for inspection calls, without assuming the repository default branch.
|
|
19
|
+
- Added nested-tree and ASCII-tree helpers through `nestTreeEntries()` and `formatTreeAscii()`.
|
|
20
|
+
- Added normalized high-level inspection progress events alongside the existing raw linguist progress stream.
|
|
21
|
+
- Added structured inspection result types for tree, directory, file, and repository analysis snapshots.
|
|
22
|
+
|
|
7
23
|
## 1.2.0
|
|
8
24
|
|
|
9
25
|
- Added package startup logs through package-specific `.initialize` groups such as `git-host.initialize`, `git-host.http.initialize`, `git-host.api.initialize`, and `git-host.ssh.initialize`.
|
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# @trebired/git-host
|
|
2
2
|
|
|
3
|
-
Embeddable Git
|
|
3
|
+
Embeddable Git forge for Node.js and Bun apps with real Git CLI execution, smart HTTP and SSH transports, repository inspection APIs, forge features such as releases and forks, and optional React/browser companions.
|
|
4
4
|
|
|
5
|
-
`@trebired/git-host` gives your app real Git repository operations and real Git transports without
|
|
5
|
+
`@trebired/git-host` gives your app real Git repository operations, forge-style repository metadata, and real Git transports without forcing you into a monolithic hosted product. It runs the real Git CLI, helps you resolve repository paths safely, serializes mutations per repository, and exposes reusable APIs for repository initialization, summary reads, content inspection, branch operations, working-tree changes, releases, forks, stars, watching, activity feeds, JSON API handlers, browser-ready pages, and smart HTTP and SSH hosting.
|
|
6
6
|
|
|
7
7
|
It is aimed at platforms and products that already own users, permissions, tokens, repository records, and UI, but want to stop hand-rolling the Git layer underneath all of that.
|
|
8
8
|
|
|
9
|
-
The package keeps auth, permission, and persistence decisions host-owned while giving you reusable Git behavior and
|
|
9
|
+
The package keeps auth, permission, and persistence decisions host-owned while giving you reusable Git behavior, forge adapters, and browser integration.
|
|
10
10
|
|
|
11
|
-
It also exposes an optional React companion at `@trebired/git-host/react` for typed API clients, providers, and headless data hooks
|
|
11
|
+
It also exposes an optional React companion at `@trebired/git-host/react` for typed API clients, providers, and headless data hooks, plus an optional browser UI entry at `@trebired/git-host/browser` for full repository pages.
|
|
12
12
|
|
|
13
13
|
In plain terms:
|
|
14
14
|
|
|
15
|
-
- it is a Git hosting layer you embed into your app
|
|
16
|
-
- it is not a full
|
|
15
|
+
- it is a Git hosting and lightweight forge layer you embed into your app
|
|
16
|
+
- it is not a full hosted SaaS product with built-in accounts, billing, or platform ownership
|
|
17
17
|
- it is not a reimplementation of Git
|
|
18
18
|
- it uses the real `git` binary for the hard parts
|
|
19
19
|
|
|
@@ -35,6 +35,12 @@ Optional React companion:
|
|
|
35
35
|
npm install react
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
Optional browser pages:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npm install react
|
|
42
|
+
```
|
|
43
|
+
|
|
38
44
|
```ts
|
|
39
45
|
import { createGitHost, resolveRepositoryPath } from "@trebired/git-host";
|
|
40
46
|
import { createLog } from "@trebired/logger";
|
|
@@ -102,6 +108,49 @@ const archive = await gitHost.readArchive("demo", {
|
|
|
102
108
|
});
|
|
103
109
|
console.log(tags.length, blame.lines[0]?.author_name, search.match_count, archive.file_name);
|
|
104
110
|
|
|
111
|
+
const inspectionTarget = await gitHost.resolveInspectionTarget("demo", {
|
|
112
|
+
ref: "auto",
|
|
113
|
+
});
|
|
114
|
+
console.log(inspectionTarget.state, inspectionTarget.resolved_ref);
|
|
115
|
+
|
|
116
|
+
const treeSnapshot = await gitHost.readTree("demo", {
|
|
117
|
+
ref: "auto",
|
|
118
|
+
recursive: true,
|
|
119
|
+
nested: true,
|
|
120
|
+
ascii: true,
|
|
121
|
+
icons: true,
|
|
122
|
+
linguist: true,
|
|
123
|
+
});
|
|
124
|
+
console.log(treeSnapshot.ascii);
|
|
125
|
+
|
|
126
|
+
const directorySnapshot = await gitHost.readDirectory("demo", {
|
|
127
|
+
path: "src",
|
|
128
|
+
ref: "auto",
|
|
129
|
+
icons: true,
|
|
130
|
+
linguist: true,
|
|
131
|
+
includeLineCounts: true,
|
|
132
|
+
});
|
|
133
|
+
console.log(directorySnapshot.kind);
|
|
134
|
+
|
|
135
|
+
const fileSnapshot = await gitHost.readFile("demo", {
|
|
136
|
+
path: "src/app.ts",
|
|
137
|
+
ref: "auto",
|
|
138
|
+
includeLanguage: true,
|
|
139
|
+
includeIcon: true,
|
|
140
|
+
});
|
|
141
|
+
console.log(fileSnapshot.language, fileSnapshot.icon?.name);
|
|
142
|
+
|
|
143
|
+
const repositoryAnalysis = await gitHost.readRepositoryAnalysis("demo", {
|
|
144
|
+
ref: "auto",
|
|
145
|
+
icons: true,
|
|
146
|
+
nested: true,
|
|
147
|
+
ascii: true,
|
|
148
|
+
onProgress(event) {
|
|
149
|
+
console.log(event.phase, event.percent);
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
console.log(repositoryAnalysis.linguist.languages.results);
|
|
153
|
+
|
|
105
154
|
const workingTree = await gitHost.readWorkingTree("demo");
|
|
106
155
|
console.log(workingTree.unstaged_entries);
|
|
107
156
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import type { CreateGitForgeApiHandlerOptions } from "../../types.js";
|
|
3
|
+
import { parseGitForgeApiRoute } from "./route.js";
|
|
4
|
+
declare function createGitForgeApiHandler(options: CreateGitForgeApiHandlerOptions): (req: IncomingMessage, res: ServerResponse) => void;
|
|
5
|
+
export { createGitForgeApiHandler, parseGitForgeApiRoute };
|
|
6
|
+
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/api/forge/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIjE,OAAO,KAAK,EAAE,+BAA+B,EAAoC,MAAM,gBAAgB,CAAC;AAUxG,OAAO,EAAE,qBAAqB,EAAyB,MAAM,YAAY,CAAC;AA0P1E,iBAAS,wBAAwB,CAAC,OAAO,EAAE,+BAA+B,IAarC,KAAK,eAAe,EAAE,KAAK,cAAc,UAK7E;AAED,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { logPackageInitialized } from "@trebired/logger-adapter";
|
|
2
|
+
import { resolveLogger } from "../../logging.js";
|
|
3
|
+
import { text } from "../../utils/text.js";
|
|
4
|
+
import { runGitApiAction } from "../handler/action.js";
|
|
5
|
+
import { applyAuthorizationHeaders, authorizationAllowed, serializeError, statusForError, writeJson, } from "../handler/response.js";
|
|
6
|
+
import { parseGitForgeApiRoute } from "./route.js";
|
|
7
|
+
function routeOperation(route, method) {
|
|
8
|
+
if ("resource" in route && route.resource === "repository" && !("releaseId" in route) && !("forkId" in route))
|
|
9
|
+
return "read";
|
|
10
|
+
switch (route.action) {
|
|
11
|
+
case "stars":
|
|
12
|
+
return method === "DELETE" ? "delete" : "create";
|
|
13
|
+
case "watch":
|
|
14
|
+
return "subscribe";
|
|
15
|
+
case "releases":
|
|
16
|
+
return method === "POST" ? "create" : "read";
|
|
17
|
+
case "release":
|
|
18
|
+
if (method === "PATCH")
|
|
19
|
+
return "update";
|
|
20
|
+
if (method === "DELETE")
|
|
21
|
+
return "delete";
|
|
22
|
+
return "read";
|
|
23
|
+
case "forks":
|
|
24
|
+
return method === "POST" ? "create" : "read";
|
|
25
|
+
case "fork_sync":
|
|
26
|
+
return "sync";
|
|
27
|
+
default:
|
|
28
|
+
return "read";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function allowedMethodsForRoute(route) {
|
|
32
|
+
switch (route.action) {
|
|
33
|
+
case "stars":
|
|
34
|
+
case "watch":
|
|
35
|
+
return ["DELETE", "POST"];
|
|
36
|
+
case "releases":
|
|
37
|
+
case "forks":
|
|
38
|
+
return ["GET", "HEAD", "POST"];
|
|
39
|
+
case "release":
|
|
40
|
+
return ["DELETE", "GET", "HEAD", "PATCH"];
|
|
41
|
+
case "fork_sync":
|
|
42
|
+
return ["POST"];
|
|
43
|
+
default:
|
|
44
|
+
return ["GET", "HEAD"];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function readJsonBody(req) {
|
|
48
|
+
const chunks = [];
|
|
49
|
+
for await (const chunk of req) {
|
|
50
|
+
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));
|
|
51
|
+
}
|
|
52
|
+
const raw = Buffer.concat(chunks).toString("utf8").trim();
|
|
53
|
+
if (!raw)
|
|
54
|
+
return {};
|
|
55
|
+
const parsed = JSON.parse(raw);
|
|
56
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
57
|
+
}
|
|
58
|
+
async function runForgeAction(options, route, repositoryId, actor, body) {
|
|
59
|
+
switch (route.action) {
|
|
60
|
+
case "overview":
|
|
61
|
+
return await options.forge.readOverview(repositoryId, { actorId: actor?.id });
|
|
62
|
+
case "social":
|
|
63
|
+
return await options.forge.readSocialState(repositoryId, { actorId: actor?.id });
|
|
64
|
+
case "stars":
|
|
65
|
+
return body && body._method === "DELETE"
|
|
66
|
+
? await options.forge.unstarRepository(repositoryId, { actor: actor })
|
|
67
|
+
: await options.forge.starRepository(repositoryId, { actor: actor });
|
|
68
|
+
case "watch":
|
|
69
|
+
return body && body._method === "DELETE"
|
|
70
|
+
? await options.forge.unwatchRepository(repositoryId, { actor: actor })
|
|
71
|
+
: await options.forge.watchRepository(repositoryId, { actor: actor });
|
|
72
|
+
case "releases":
|
|
73
|
+
if (body && body._method === "POST") {
|
|
74
|
+
return await options.forge.createRelease(repositoryId, {
|
|
75
|
+
actor: actor,
|
|
76
|
+
assets: Array.isArray(body.assets) ? body.assets : undefined,
|
|
77
|
+
createTag: body.createTag && typeof body.createTag === "object" ? {
|
|
78
|
+
annotatedMessage: text(body.createTag.annotatedMessage),
|
|
79
|
+
name: text(body.createTag.name),
|
|
80
|
+
targetRef: text(body.createTag.targetRef),
|
|
81
|
+
} : undefined,
|
|
82
|
+
draft: body.draft === true,
|
|
83
|
+
existingTagName: text(body.existingTagName),
|
|
84
|
+
notes: text(body.notes),
|
|
85
|
+
prerelease: body.prerelease === true,
|
|
86
|
+
publishedAt: body.publishedAt === null ? null : text(body.publishedAt),
|
|
87
|
+
title: text(body.title),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return await options.forge.listReleases(repositoryId);
|
|
91
|
+
case "release":
|
|
92
|
+
if (body && body._method === "PATCH") {
|
|
93
|
+
return await options.forge.updateRelease(repositoryId, route.releaseId, {
|
|
94
|
+
actor: actor,
|
|
95
|
+
assets: Array.isArray(body.assets) ? body.assets : undefined,
|
|
96
|
+
draft: body.draft === true,
|
|
97
|
+
notes: text(body.notes),
|
|
98
|
+
prerelease: body.prerelease === true,
|
|
99
|
+
publishedAt: body.publishedAt === null ? null : (body.publishedAt === undefined ? undefined : text(body.publishedAt)),
|
|
100
|
+
title: body.title === undefined ? undefined : text(body.title),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (body && body._method === "DELETE") {
|
|
104
|
+
await options.forge.deleteRelease(repositoryId, route.releaseId, {
|
|
105
|
+
actor: actor,
|
|
106
|
+
deleteTag: body.deleteTag === true,
|
|
107
|
+
});
|
|
108
|
+
return {
|
|
109
|
+
deleted: true,
|
|
110
|
+
release_id: route.releaseId,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return await options.forge.readRelease(repositoryId, route.releaseId);
|
|
114
|
+
case "forks":
|
|
115
|
+
if (body && body._method === "POST") {
|
|
116
|
+
return await options.forge.createFork(repositoryId, {
|
|
117
|
+
actor: actor,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return await options.forge.listForks(repositoryId);
|
|
121
|
+
case "fork_sync":
|
|
122
|
+
return await options.forge.syncFork(route.forkId, {
|
|
123
|
+
actor: actor,
|
|
124
|
+
strategy: text(body.strategy) === "merge" ? "merge" : undefined,
|
|
125
|
+
});
|
|
126
|
+
case "activity":
|
|
127
|
+
return await options.forge.listActivity(repositoryId);
|
|
128
|
+
default:
|
|
129
|
+
return await runGitApiAction({
|
|
130
|
+
gitHost: options.gitHost,
|
|
131
|
+
}, route, repositoryId, new URLSearchParams());
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async function handleGitForgeApiRequest(req, res, options) {
|
|
135
|
+
const logger = resolveLogger(options.logger, options.loggerAdapter);
|
|
136
|
+
const verbose = options.verbose === true;
|
|
137
|
+
const logGroup = "git-host.forge.api";
|
|
138
|
+
const method = text(req.method).toUpperCase() || "GET";
|
|
139
|
+
const url = new URL(String(req.url || "/"), "http://127.0.0.1");
|
|
140
|
+
const route = parseGitForgeApiRoute(url.pathname, options.basePath);
|
|
141
|
+
if (!route) {
|
|
142
|
+
writeJson(req, res, 404, {
|
|
143
|
+
ok: false,
|
|
144
|
+
error: {
|
|
145
|
+
code: "route_not_found",
|
|
146
|
+
message: "Git forge API route not found.",
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const allowedMethods = allowedMethodsForRoute(route);
|
|
152
|
+
if (!allowedMethods.includes(method)) {
|
|
153
|
+
res.setHeader("allow", allowedMethods.join(", "));
|
|
154
|
+
writeJson(req, res, 405, {
|
|
155
|
+
ok: false,
|
|
156
|
+
error: {
|
|
157
|
+
code: "method_not_allowed",
|
|
158
|
+
message: `Supported methods: ${allowedMethods.join(", ")}.`,
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const repositoryKey = route.repositoryKey;
|
|
164
|
+
const repositoryId = text(options.resolveRepositoryId ? await options.resolveRepositoryId(repositoryKey, req) : repositoryKey);
|
|
165
|
+
if (!repositoryId) {
|
|
166
|
+
writeJson(req, res, 404, {
|
|
167
|
+
ok: false,
|
|
168
|
+
error: {
|
|
169
|
+
code: "repository_not_found",
|
|
170
|
+
message: "Repository not found.",
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
const actor = options.resolveActor ? await options.resolveActor(req) : null;
|
|
176
|
+
const auth = authorizationAllowed(options.authorize
|
|
177
|
+
? await options.authorize({
|
|
178
|
+
action: route.action,
|
|
179
|
+
actor,
|
|
180
|
+
method,
|
|
181
|
+
operation: routeOperation(route, method),
|
|
182
|
+
pathname: url.pathname,
|
|
183
|
+
releaseId: "releaseId" in route ? route.releaseId : undefined,
|
|
184
|
+
remoteAddress: text(req.socket && req.socket.remoteAddress),
|
|
185
|
+
repositoryId,
|
|
186
|
+
repositoryKey,
|
|
187
|
+
request: req,
|
|
188
|
+
resource: route.resource,
|
|
189
|
+
searchParams: url.searchParams,
|
|
190
|
+
})
|
|
191
|
+
: undefined);
|
|
192
|
+
applyAuthorizationHeaders(res, auth.headers);
|
|
193
|
+
if (!auth.allowed) {
|
|
194
|
+
writeJson(req, res, auth.status || 403, {
|
|
195
|
+
ok: false,
|
|
196
|
+
error: {
|
|
197
|
+
code: "permission_denied",
|
|
198
|
+
message: auth.message || "Permission denied.",
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const body = method === "POST" || method === "PATCH" || method === "DELETE"
|
|
204
|
+
? await readJsonBody(req)
|
|
205
|
+
: {};
|
|
206
|
+
if (method === "POST" || method === "PATCH" || method === "DELETE") {
|
|
207
|
+
body._method = method;
|
|
208
|
+
}
|
|
209
|
+
try {
|
|
210
|
+
const data = route.resource === "repository" && route.action !== "overview" && route.action !== "social" && route.action !== "activity"
|
|
211
|
+
? await runGitApiAction({
|
|
212
|
+
gitHost: options.gitHost,
|
|
213
|
+
}, route, repositoryId, url.searchParams)
|
|
214
|
+
: await runForgeAction(options, route, repositoryId, actor, body);
|
|
215
|
+
if (verbose) {
|
|
216
|
+
logger.info(logGroup, "forge api action completed", {
|
|
217
|
+
action: route.action,
|
|
218
|
+
method,
|
|
219
|
+
pathname: url.pathname,
|
|
220
|
+
repositoryId,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
writeJson(req, res, 200, {
|
|
224
|
+
action: route.action,
|
|
225
|
+
data,
|
|
226
|
+
ok: true,
|
|
227
|
+
repository_id: repositoryId,
|
|
228
|
+
repository_key: repositoryKey,
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
logger.error(logGroup, "forge api action failed", {
|
|
233
|
+
action: route.action,
|
|
234
|
+
error: error instanceof Error ? error.message : String(error),
|
|
235
|
+
method,
|
|
236
|
+
pathname: url.pathname,
|
|
237
|
+
repositoryId,
|
|
238
|
+
});
|
|
239
|
+
writeJson(req, res, statusForError(error), serializeError(error));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function createGitForgeApiHandler(options) {
|
|
243
|
+
if (!options || typeof options.forge !== "object") {
|
|
244
|
+
throw new TypeError("createGitForgeApiHandler() requires a forge instance.");
|
|
245
|
+
}
|
|
246
|
+
logPackageInitialized({
|
|
247
|
+
adapter: options.loggerAdapter,
|
|
248
|
+
fallback: "console",
|
|
249
|
+
group: "git-host.forge.api",
|
|
250
|
+
logger: options.logger,
|
|
251
|
+
source: "@trebired/git-host",
|
|
252
|
+
});
|
|
253
|
+
return function gitForgeApiHandler(req, res) {
|
|
254
|
+
void handleGitForgeApiRequest(req, res, options).catch((error) => {
|
|
255
|
+
writeJson(req, res, 500, serializeError(error));
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
export { createGitForgeApiHandler, parseGitForgeApiRoute };
|
|
260
|
+
//# sourceMappingURL=handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/api/forge/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,SAAS,GACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAyB,MAAM,YAAY,CAAC;AAE1E,SAAS,cAAc,CAAC,KAAuB,EAAE,MAAc;IAC7D,IAAI,UAAU,IAAI,KAAK,IAAI,KAAK,CAAC,QAAQ,KAAK,YAAY,IAAI,CAAC,CAAC,WAAW,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,IAAI,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IAC7H,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;QACrB,KAAK,OAAO;YACV,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QACnD,KAAK,OAAO;YACV,OAAO,WAAW,CAAC;QACrB,KAAK,UAAU;YACb,OAAO,MAAM,KAAK,MAAM,CAAC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+
resource: "activity" | "repository" | "social";
|
|
6
|
+
} | {
|
|
7
|
+
action: "fork_sync";
|
|
8
|
+
forkId: string;
|
|
9
|
+
repositoryKey: string;
|
|
10
|
+
resource: "fork";
|
|
11
|
+
} | {
|
|
12
|
+
action: "forks";
|
|
13
|
+
repositoryKey: string;
|
|
14
|
+
resource: "fork";
|
|
15
|
+
} | {
|
|
16
|
+
action: "release";
|
|
17
|
+
releaseId: string;
|
|
18
|
+
repositoryKey: string;
|
|
19
|
+
resource: "release";
|
|
20
|
+
} | {
|
|
21
|
+
action: "releases";
|
|
22
|
+
repositoryKey: string;
|
|
23
|
+
resource: "release";
|
|
24
|
+
} | {
|
|
25
|
+
action: "stars" | "watch";
|
|
26
|
+
repositoryKey: string;
|
|
27
|
+
resource: "social";
|
|
28
|
+
} | (ReturnType<typeof parseGitApiRoute> & {
|
|
29
|
+
resource: "repository";
|
|
30
|
+
});
|
|
31
|
+
declare function parseGitForgeApiRoute(pathnameInput: unknown, basePathInput: unknown): GitForgeApiRoute | null;
|
|
32
|
+
export { parseGitForgeApiRoute };
|
|
33
|
+
export type { GitForgeApiRoute };
|
|
34
|
+
//# sourceMappingURL=route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/api/forge/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAiBjD,KAAK,gBAAgB,GACjB;IACE,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,UAAU,GAAG,YAAY,GAAG,QAAQ,CAAC;CAChD,GACD;IACE,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB,GACD;IACE,MAAM,EAAE,UAAU,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB,GACD;IACE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;CACpB,GACD,CAAC,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAAG;IACrC,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC,CAAC;AAEP,iBAAS,qBAAqB,CAAC,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CA8EtG;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC;AACjC,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { parseGitApiRoute } from "../handler.js";
|
|
2
|
+
import { text } from "../../utils/text.js";
|
|
3
|
+
function normalizeBasePath(value) {
|
|
4
|
+
const next = text(value).replace(/\/+$/g, "");
|
|
5
|
+
if (!next || next === "/")
|
|
6
|
+
return "";
|
|
7
|
+
return next.startsWith("/") ? next : `/${next}`;
|
|
8
|
+
}
|
|
9
|
+
function decodeRouteSegment(value) {
|
|
10
|
+
try {
|
|
11
|
+
return decodeURIComponent(value);
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function parseGitForgeApiRoute(pathnameInput, basePathInput) {
|
|
18
|
+
const legacy = parseGitApiRoute(pathnameInput, basePathInput);
|
|
19
|
+
if (legacy) {
|
|
20
|
+
return {
|
|
21
|
+
...legacy,
|
|
22
|
+
resource: "repository",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const pathname = text(pathnameInput, "/");
|
|
26
|
+
const basePath = normalizeBasePath(basePathInput);
|
|
27
|
+
if (basePath && !pathname.startsWith(`${basePath}/`) && pathname !== basePath)
|
|
28
|
+
return null;
|
|
29
|
+
const remainder = basePath
|
|
30
|
+
? pathname.slice(basePath.length).replace(/^\/+/, "")
|
|
31
|
+
: pathname.replace(/^\/+/, "");
|
|
32
|
+
if (!remainder)
|
|
33
|
+
return null;
|
|
34
|
+
const segments = remainder.split("/").filter(Boolean);
|
|
35
|
+
if (segments[0] !== "repositories" || segments.length < 3)
|
|
36
|
+
return null;
|
|
37
|
+
const repositoryKey = decodeRouteSegment(segments[1] || "");
|
|
38
|
+
if (!repositoryKey)
|
|
39
|
+
return null;
|
|
40
|
+
const action = text(segments[2]);
|
|
41
|
+
if ((action === "overview" || action === "social" || action === "activity") && segments.length === 3) {
|
|
42
|
+
return {
|
|
43
|
+
action: action,
|
|
44
|
+
repositoryKey,
|
|
45
|
+
resource: action === "activity" ? "activity" : (action === "social" ? "social" : "repository"),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if ((action === "stars" || action === "watch" || action === "releases" || action === "forks") && segments.length === 3) {
|
|
49
|
+
if (action === "forks") {
|
|
50
|
+
return {
|
|
51
|
+
action: "forks",
|
|
52
|
+
repositoryKey,
|
|
53
|
+
resource: "fork",
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (action === "releases") {
|
|
57
|
+
return {
|
|
58
|
+
action: "releases",
|
|
59
|
+
repositoryKey,
|
|
60
|
+
resource: "release",
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
action: action,
|
|
65
|
+
repositoryKey,
|
|
66
|
+
resource: "social",
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (action === "releases" && segments.length === 4) {
|
|
70
|
+
const releaseId = decodeRouteSegment(segments[3] || "");
|
|
71
|
+
if (!releaseId)
|
|
72
|
+
return null;
|
|
73
|
+
return {
|
|
74
|
+
action: "release",
|
|
75
|
+
releaseId,
|
|
76
|
+
repositoryKey,
|
|
77
|
+
resource: "release",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (action === "forks" && segments.length === 5 && segments[4] === "sync") {
|
|
81
|
+
const forkId = decodeRouteSegment(segments[3] || "");
|
|
82
|
+
if (!forkId)
|
|
83
|
+
return null;
|
|
84
|
+
return {
|
|
85
|
+
action: "fork_sync",
|
|
86
|
+
forkId,
|
|
87
|
+
repositoryKey,
|
|
88
|
+
resource: "fork",
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
export { parseGitForgeApiRoute };
|
|
94
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.js","sourceRoot":"","sources":["../../../src/api/forge/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,SAAS,iBAAiB,CAAC,KAAc;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC9C,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,GAAG;QAAE,OAAO,EAAE,CAAC;IACrC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;AAClD,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa;IACvC,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AAC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,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;QAC1E,MAAM,MAAM,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACrD,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACzB,OAAO;YACL,MAAM,EAAE,WAAW;YACnB,MAAM;YACN,aAAa;YACb,QAAQ,EAAE,MAAM;SACjB,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CreateGitApiHandlerOptions } from "../../types.js";
|
|
2
2
|
import { parseGitApiRoute } from "./route.js";
|
|
3
|
-
declare function runGitApiAction(options: CreateGitApiHandlerOptions, route: ReturnType<typeof parseGitApiRoute>, repositoryId: string, searchParams: URLSearchParams): Promise<import("../../types.js").GitCommitDetail | import("../../types.js").GitCommitSummary[] | import("../../types.js").GitCompareSummary | import("../../types.js").GitTagDetail | import("../../types.js").GitBlame | import("../../types.js").GitSearchResult | import("../../types.js").GitBlob | import("../../types.js").GitArchive | import("../../types.js").GitBranchSummary[] | import("../../types.js").GitRepositorySummary | import("../../types.js").GitRepositoryLinguist | import("../../types.js").
|
|
3
|
+
declare function runGitApiAction(options: CreateGitApiHandlerOptions, route: ReturnType<typeof parseGitApiRoute>, repositoryId: string, searchParams: URLSearchParams): Promise<import("../../types.js").GitCommitDetail | import("../../types.js").GitCommitSummary[] | import("../../types.js").GitCompareSummary | import("../../types.js").GitTagDetail | import("../../types.js").GitBlame | import("../../types.js").GitSearchResult | import("../../types.js").GitBlob | import("../../types.js").GitArchive | import("../../types.js").GitBranchSummary[] | import("../../types.js").GitRepositorySummary | import("../../types.js").GitRepositoryLinguist | import("../../types.js").GitTreeEntry[] | import("../../types.js").GitTagSummary[]>;
|
|
4
4
|
export { runGitApiAction };
|
|
5
5
|
//# sourceMappingURL=action.d.ts.map
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
-
import type { GitApiAuthorizationResult } from "../../types.js";
|
|
3
2
|
declare function applyAuthorizationHeaders(res: ServerResponse, headers: Record<string, string> | undefined): void;
|
|
4
|
-
declare function authorizationAllowed(value:
|
|
3
|
+
declare function authorizationAllowed(value: boolean | {
|
|
4
|
+
allowed: boolean;
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
message?: string;
|
|
7
|
+
status?: number;
|
|
8
|
+
} | undefined): {
|
|
5
9
|
allowed: boolean;
|
|
6
10
|
status: number;
|
|
7
11
|
message: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/api/handler/response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/api/handler/response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAKjE,iBAAS,yBAAyB,CAAC,GAAG,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,QAMlG;AAED,iBAAS,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,SAAS;;;;;;;;;;EAUZ;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOhF;AAED,iBAAS,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAsB9C;AAED,iBAAS,cAAc,CAAC,KAAK,EAAE,OAAO;;;;;;;;;;;;;;EA6BrC;AAED,iBAAS,SAAS,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,QAQ7F;AAED,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -36,10 +36,15 @@ function statusForError(error) {
|
|
|
36
36
|
case "invalid_repository_path":
|
|
37
37
|
return 400;
|
|
38
38
|
case "repository_not_found":
|
|
39
|
+
case "forge_resource_not_found":
|
|
39
40
|
return 404;
|
|
40
41
|
case "repository_not_initialized":
|
|
41
42
|
case "repository_clone_target_not_empty":
|
|
43
|
+
case "forge_sync_conflict":
|
|
42
44
|
return 409;
|
|
45
|
+
case "forge_invalid_actor":
|
|
46
|
+
case "forge_invalid_input":
|
|
47
|
+
return 400;
|
|
43
48
|
default:
|
|
44
49
|
return 400;
|
|
45
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/api/handler/response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"response.js","sourceRoot":"","sources":["../../../src/api/handler/response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAE3C,SAAS,yBAAyB,CAAC,GAAmB,EAAE,OAA2C;IACjG,MAAM,WAAW,GAAG,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CA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SACnC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,SAAS,CAAC,GAAoB,EAAE,GAAmB,EAAE,MAAc,EAAE,OAAgB;IAC5F,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC;IACxB,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,iCAAiC,CAAC,CAAC;IACjE,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;QAC9C,GAAG,CAAC,GAAG,EAAE,CAAC;QACV,OAAO;IACT,CAAC;IACD,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare function parseGitApiRoute(pathnameInput: unknown, basePathInput: unknown): {
|
|
2
|
-
action: "
|
|
2
|
+
action: "blob" | "linguist" | "tree" | "archive" | "blame" | "branches" | "diff" | "search" | "summary";
|
|
3
3
|
repositoryKey: string;
|
|
4
4
|
commitRef?: undefined;
|
|
5
5
|
tagName?: undefined;
|