@leed-ai/git-gateway-backend-gitlab 0.0.0-stage → 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-backend.js","names":[],"sources":["../src/gitlab-backend.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { isGatewayError } from '@leed-ai/git-gateway-contract/gateway-error';\nimport type { Commit } from '@leed-ai/git-gateway-contract/schemas/commit';\nimport { FilePath, RepoName, Revision } from '@leed-ai/git-gateway-contract/schemas/names';\nimport { Sha } from '@leed-ai/git-gateway-contract/schemas/sha';\nimport { GitAccess, GitRemote } from '@leed-ai/git-gateway-contract/storage/git-remote';\nimport type { StorageBackend } from '@leed-ai/git-gateway-contract/storage/storage-backend';\nimport {\n repoExists,\n repoNotFound,\n storageUnavailable,\n} from '@leed-ai/git-gateway-contract/storage/storage-errors';\nimport { parseStorageInput } from '@leed-ai/git-gateway-contract/storage/storage-input';\nimport { StorageLogOptions, StorageRef } from '@leed-ai/git-gateway-contract/storage/storage-read';\nimport {\n CreateStorageRepoOptions,\n StorageRepoInfo,\n} from '@leed-ai/git-gateway-contract/storage/storage-repo-info';\nimport type { StorageTreeEntry } from '@leed-ai/git-gateway-contract/storage/storage-tree-entry';\nimport { GitHttpClient, type FetchLike } from '@leed-ai/git-gateway-core/smart-http/git-http-client';\nimport { z } from 'zod';\n\nimport { GitLabApi, GitLabHttpError } from './gitlab-api.ts';\nimport { FrontedProjects, frontedLifecycleRefused } from './gitlab-fronted.ts';\nimport { readCommitsOverGit, readTreeOverGit } from './gitlab-git-reads.ts';\nimport { isAncestorOnGitLab } from './gitlab-merge-base.ts';\nimport { GitLabBackendConfig } from './schemas/gitlab-config.ts';\nimport { GitLabCommitSummary, GitLabGroup, GitLabProject, GitLabRef } from './schemas/gitlab-responses.ts';\n\n/** Options of a {@link GitLabBackend}: its configuration and, optionally, how requests are sent. */\nexport type GitLabBackendOptions = GitLabBackendConfig & {\n /** Sends API and git requests; default the global fetch. */\n readonly fetch?: FetchLike;\n};\n\nconst PAGE = 100;\nconst enc = encodeURIComponent;\n\n/**\n * A {@link StorageBackend} over a GitLab instance, so the gateway can front repositories that\n * still live on GitLab. Each repository is a private project in one group. Lifecycle, refs,\n * blobs, files and history use the REST API (v4); commits and trees are read as git objects over\n * the smart-HTTP transport (GitLab's API reports neither tree ids nor raw messages), and writes\n * are git pushes to {@link gitRemote}. It offers the optional `isAncestor` capability through\n * GitLab's merge-base API, so the gateway proves fast-forwards in one call. Every API response is parsed with Zod.\n *\n * With `frontedProjects`, a reserved name `<prefix><projectId>` addresses an existing project by\n * id, wherever it lives under `frontedProjects.namespace`, so the gateway can front repositories\n * that predate it without moving them. Those names can be read and pushed but never created or\n * deleted.\n */\nexport class GitLabBackend implements StorageBackend {\n readonly #config: z.output<typeof GitLabBackendConfig>;\n readonly #api: GitLabApi;\n readonly #fetch: FetchLike;\n #namespaceId: number | undefined;\n readonly #fronted: FrontedProjects;\n\n constructor(options: GitLabBackendOptions) {\n const { fetch, ...config } = options;\n this.#config = GitLabBackendConfig.parse(config);\n this.#fetch = fetch ?? (async (request) => globalThis.fetch(request));\n this.#api = new GitLabApi(this.#config.baseUrl, this.#config.token, this.#fetch);\n this.#namespaceId = this.#config.namespaceId;\n this.#fronted = new FrontedProjects(this.#config.frontedProjects);\n }\n\n async createRepo(name: string, options: CreateStorageRepoOptions = {}): Promise<StorageRepoInfo> {\n const repo = parseStorageInput(RepoName, name);\n const { defaultBranch } = parseStorageInput(CreateStorageRepoOptions, options);\n if (this.#fronted.idOf(repo) !== null) throw frontedLifecycleRefused(repo, 'created');\n return this.#call(repo, 'createRepo', async () => {\n const namespaceId = await this.#resolveNamespaceId();\n try {\n const body = {\n name: repo,\n path: repo,\n namespace_id: namespaceId,\n default_branch: defaultBranch,\n visibility: 'private',\n initialize_with_readme: false,\n };\n return this.#info(\n await this.#api.json(GitLabProject, '/projects', { method: 'POST', body }),\n defaultBranch,\n );\n } catch (error) {\n if (\n error instanceof GitLabHttpError &&\n error.status === 400 &&\n /already been taken/i.test(error.detail)\n )\n throw repoExists(repo);\n throw error;\n }\n });\n }\n\n async deleteRepo(name: string): Promise<void> {\n const repo = parseStorageInput(RepoName, name);\n if (this.#fronted.idOf(repo) !== null) throw frontedLifecycleRefused(repo, 'deleted');\n await this.#call(repo, 'deleteRepo', async () => {\n const project = await this.#projectOrNull(repo);\n if (project === null) return;\n await this.#api.request(`/projects/${project.id}`, { method: 'DELETE' });\n // With delayed deletion the project is only marked (and renamed); remove it for good so the\n // name is free again. Instances without delayed deletion have already removed it.\n const marked = await this.#api.json(GitLabProject, `/projects/${project.id}`).catch(() => null);\n if (marked !== null) {\n await this.#api.request(`/projects/${project.id}`, {\n method: 'DELETE',\n query: { permanently_remove: true, full_path: marked.path_with_namespace },\n });\n }\n });\n }\n\n async repoInfo(name: string): Promise<StorageRepoInfo | null> {\n const repo = parseStorageInput(RepoName, name);\n return this.#call(repo, 'repoInfo', async () => {\n const project = await this.#projectOrNull(repo);\n return project === null ? null : this.#info(project, 'main', repo);\n });\n }\n\n async resolveRef(name: string, ref: string): Promise<string | null> {\n const repo = parseStorageInput(RepoName, name);\n const parsed = parseStorageInput(StorageRef, ref);\n const [kind, short] = parsed.startsWith('refs/tags/')\n ? ['tags', parsed.slice(10)]\n : ['branches', parsed.replace(/^refs\\/heads\\//, '')];\n return this.#call(repo, 'resolveRef', async () => {\n try {\n return (\n await this.#api.json(GitLabRef, `${await this.#projectPath(repo)}/repository/${kind}/${enc(short)}`)\n ).commit.id;\n } catch (error) {\n if (error instanceof GitLabHttpError && error.status === 404 && !error.projectMissing) return null;\n throw error;\n }\n });\n }\n\n async readCommit(name: string, sha: string): Promise<Commit | null> {\n const repo = parseStorageInput(RepoName, name);\n const id = parseStorageInput(Sha, sha);\n return this.#call(repo, 'readCommit', async () => {\n const found = await this.#api.bytesOrNull(`${await this.#projectPath(repo)}/repository/commits/${id}`);\n if (found === null) return null;\n const [commit] = await readCommitsOverGit(await this.#client(repo), [id]);\n return commit ?? null;\n });\n }\n\n async readTree(name: string, sha: string): Promise<StorageTreeEntry[] | null> {\n const repo = parseStorageInput(RepoName, name);\n const id = parseStorageInput(Sha, sha);\n return this.#call(repo, 'readTree', async () => readTreeOverGit(await this.#client(repo), id));\n }\n\n async readBlob(name: string, sha: string): Promise<Uint8Array | null> {\n const repo = parseStorageInput(RepoName, name);\n const id = parseStorageInput(Sha, sha);\n return this.#call(repo, 'readBlob', async () =>\n this.#api.bytesOrNull(`${await this.#projectPath(repo)}/repository/blobs/${id}/raw`),\n );\n }\n\n async readFile(name: string, ref: string, path: string): Promise<Uint8Array | null> {\n const repo = parseStorageInput(RepoName, name);\n const revision = parseStorageInput(Revision, ref);\n const file = parseStorageInput(FilePath, path);\n return this.#call(repo, 'readFile', async () =>\n this.#api.bytesOrNull(`${await this.#projectPath(repo)}/repository/files/${enc(file)}/raw`, {\n ref: revision,\n }),\n );\n }\n\n async log(name: string, ref: string, options: StorageLogOptions): Promise<Commit[]> {\n const repo = parseStorageInput(RepoName, name);\n const revision = parseStorageInput(Revision, ref);\n const { limit, offset } = parseStorageInput(StorageLogOptions, options);\n return this.#call(repo, 'log', async () => {\n const shas = await this.#listFirstParents(repo, revision, offset + limit);\n return readCommitsOverGit(await this.#client(repo), shas.slice(offset, offset + limit));\n });\n }\n\n /** One merge-base API call: `ancestor` is an ancestor exactly when it is the merge base. */\n async isAncestor(name: string, ancestor: string, descendant: string): Promise<boolean | null> {\n const repo = parseStorageInput(RepoName, name);\n const older = parseStorageInput(Sha, ancestor);\n const newer = parseStorageInput(Sha, descendant);\n return this.#call(repo, 'isAncestor', async () =>\n isAncestorOnGitLab(this.#api, await this.#projectPath(repo), older, newer),\n );\n }\n\n async gitRemote(name: string, access: string): Promise<GitRemote> {\n const repo = parseStorageInput(RepoName, name);\n parseStorageInput(GitAccess, access);\n return this.#call(repo, 'gitRemote', async () => {\n const project = await this.#projectOrNull(repo);\n if (project === null) throw repoNotFound(repo);\n const basic = btoa(`${this.#config.gitUsername}:${this.#config.token}`);\n // GitLab access tokens are not scoped per request: read and write remotes carry the same\n // credential, and the gateway's own policy decides who may push.\n return GitRemote.parse({\n url: project.http_url_to_repo,\n headers: { Authorization: `Basic ${basic}` },\n expiresAt: null,\n });\n });\n }\n\n /** The ids along the first-parent chain from `revision`, newest first, at most `count`. */\n async #listFirstParents(repo: string, revision: string, count: number): Promise<string[]> {\n const shas: string[] = [];\n for (let page = 1; shas.length < count; page += 1) {\n let listed: GitLabCommitSummary[];\n try {\n const query = { ref_name: revision, first_parent: true, per_page: PAGE, page };\n listed = await this.#api.json(\n z.array(GitLabCommitSummary),\n `${await this.#projectPath(repo)}/repository/commits`,\n { query },\n );\n } catch (error) {\n if (error instanceof GitLabHttpError && error.status === 404 && !error.projectMissing) return [];\n throw error;\n }\n shas.push(...listed.map((commit) => commit.id));\n if (listed.length < PAGE) break;\n }\n return shas.slice(0, count);\n }\n\n async #client(repo: string): Promise<GitHttpClient> {\n return new GitHttpClient(await this.gitRemote(repo, 'read'), { fetch: this.#fetch });\n }\n\n /**\n * The API path of `repo`'s project. A fronted name is checked to lie under the fronted namespace\n * first (once per id), so a project elsewhere is repo_not_found rather than reachable by id.\n */\n async #projectPath(repo: string): Promise<string> {\n const id = this.#fronted.idOf(repo);\n if (id === null) return `/projects/${enc(`${this.#config.namespace}/${repo}`)}`;\n if (!this.#fronted.verified(id) && (await this.#projectOrNull(repo)) === null) throw repoNotFound(repo);\n return `/projects/${id}`;\n }\n\n async #projectOrNull(repo: string): Promise<GitLabProject | null> {\n const id = this.#fronted.idOf(repo);\n const path = id === null ? `/projects/${enc(`${this.#config.namespace}/${repo}`)}` : `/projects/${id}`;\n try {\n const project = await this.#api.json(GitLabProject, path);\n if (project.marked_for_deletion_on !== null && project.marked_for_deletion_on !== undefined)\n return null;\n if (id === null) return project;\n return this.#fronted.admits(id, project) ? project : null;\n } catch (error) {\n if (error instanceof GitLabHttpError && error.status === 404) return null;\n throw error;\n }\n }\n\n async #resolveNamespaceId(): Promise<number> {\n this.#namespaceId ??= (await this.#api.json(GitLabGroup, `/groups/${enc(this.#config.namespace)}`)).id;\n return this.#namespaceId;\n }\n\n /** The StorageRepoInfo of `project`; a fronted project is named by the reserved `name` it was opened by. */\n #info(project: GitLabProject, fallbackBranch: string, name?: string): StorageRepoInfo {\n return StorageRepoInfo.parse({\n name: name !== undefined && this.#fronted.idOf(name) !== null ? name : project.path,\n defaultBranch: project.default_branch ?? fallbackBranch,\n createdAt: new Date(project.created_at).toISOString(),\n });\n }\n\n /** Runs one call: GatewayErrors pass through, a 404 for the project is repo_not_found, anything else storage_unavailable. */\n async #call<T>(repo: string, what: string, work: () => Promise<T>): Promise<T> {\n try {\n return await work();\n } catch (error) {\n if (isGatewayError(error)) throw error;\n if (error instanceof GitLabHttpError && error.projectMissing) throw repoNotFound(repo);\n throw storageUnavailable(`GitLab ${what}`, error);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAmCA,MAAM,OAAO;AACb,MAAM,MAAM;;;;;;;;;;;;;;AAeZ,IAAa,gBAAb,MAAqD;CACnD;CACA;CACA;CACA;CACA;CAEA,YAAY,SAA+B;EACzC,MAAM,EAAE,OAAO,GAAG,WAAW;EAC7B,KAAK,UAAU,oBAAoB,MAAM,MAAM;EAC/C,KAAK,SAAS,UAAU,OAAO,YAAY,WAAW,MAAM,OAAO;EACnE,KAAK,OAAO,IAAI,UAAU,KAAK,QAAQ,SAAS,KAAK,QAAQ,OAAO,KAAK,MAAM;EAC/E,KAAK,eAAe,KAAK,QAAQ;EACjC,KAAK,WAAW,IAAI,gBAAgB,KAAK,QAAQ,eAAe;CAClE;CAEA,MAAM,WAAW,MAAc,UAAoC,CAAC,GAA6B;EAC/F,MAAM,OAAO,kBAAkB,UAAU,IAAI;EAC7C,MAAM,EAAE,kBAAkB,kBAAkB,0BAA0B,OAAO;EAC7E,IAAI,KAAK,SAAS,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AQ,KAAK;EAClD;CACF;AACF"}
@@ -0,0 +1,25 @@
1
+ import { GitLabProject } from "./schemas/gitlab-responses.js";
2
+ import { GatewayError } from "@leed-ai/git-gateway-contract/gateway-error";
3
+ /** How existing projects are fronted by id (GitLabBackendConfig.frontedProjects, parsed). */
4
+ export interface FrontedProjectsConfig {
5
+ readonly prefix: string;
6
+ readonly namespace: string;
7
+ }
8
+ /**
9
+ * The reserved names `<prefix><projectId>` of a GitLab backend's fronted projects: which names are
10
+ * reserved, which project id each addresses, and whether a project may be fronted (it lives under
11
+ * the fronted namespace). Ids already confirmed are remembered for the life of the backend.
12
+ */
13
+ export declare class FrontedProjects {
14
+ #private;
15
+ constructor(config: FrontedProjectsConfig | undefined);
16
+ /** The project id `repo` addresses when it is a reserved name; null for an ordinary name. */
17
+ idOf(repo: string): number | null;
18
+ /** True once {@link admits} has accepted project `id`. */
19
+ verified(id: number): boolean;
20
+ /** True when `project` is project `id` and lives under the fronted namespace, at any depth; remembered. */
21
+ admits(id: number, project: GitLabProject): boolean;
22
+ }
23
+ /** The invalid_input error createRepo and deleteRepo answer for a fronted project's reserved name. */
24
+ export declare function frontedLifecycleRefused(repo: string, what: 'created' | 'deleted'): GatewayError;
25
+ //# sourceMappingURL=gitlab-fronted.d.ts.map
@@ -0,0 +1,41 @@
1
+ import { gatewayError } from "@leed-ai/git-gateway-contract/gateway-error";
2
+ // src/gitlab-fronted.ts
3
+ /**
4
+ * The reserved names `<prefix><projectId>` of a GitLab backend's fronted projects: which names are
5
+ * reserved, which project id each addresses, and whether a project may be fronted (it lives under
6
+ * the fronted namespace). Ids already confirmed are remembered for the life of the backend.
7
+ */
8
+ var FrontedProjects = class {
9
+ #pattern;
10
+ #namespace;
11
+ #verified = /* @__PURE__ */ new Set();
12
+ constructor(config) {
13
+ this.#namespace = config?.namespace.toLowerCase();
14
+ this.#pattern = config === void 0 ? void 0 : new RegExp(`^${config.prefix.replace(/[.*+?^${}()|[\]\\/-]/g, "\\$&")}([1-9][0-9]{0,15})$`);
15
+ }
16
+ /** The project id `repo` addresses when it is a reserved name; null for an ordinary name. */
17
+ idOf(repo) {
18
+ const match = this.#pattern?.exec(repo);
19
+ return match?.[1] === void 0 ? null : Number(match[1]);
20
+ }
21
+ /** True once {@link admits} has accepted project `id`. */
22
+ verified(id) {
23
+ return this.#verified.has(id);
24
+ }
25
+ /** True when `project` is project `id` and lives under the fronted namespace, at any depth; remembered. */
26
+ admits(id, project) {
27
+ const ok = this.#namespace !== void 0 && project.id === id && project.path_with_namespace.toLowerCase().startsWith(`${this.#namespace}/`);
28
+ if (ok) this.#verified.add(id);
29
+ return ok;
30
+ }
31
+ };
32
+ /** The invalid_input error createRepo and deleteRepo answer for a fronted project's reserved name. */
33
+ function frontedLifecycleRefused(repo, what) {
34
+ return gatewayError("invalid_input", "Invalid input", { issues: [{
35
+ path: "name",
36
+ message: `${repo} addresses an existing GitLab project by id; it cannot be ${what} through the gateway`
37
+ }] });
38
+ }
39
+ export { FrontedProjects, frontedLifecycleRefused };
40
+
41
+ //# sourceMappingURL=gitlab-fronted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-fronted.js","names":[],"sources":["../src/gitlab-fronted.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { gatewayError, type GatewayError } from '@leed-ai/git-gateway-contract/gateway-error';\n\nimport type { GitLabProject } from './schemas/gitlab-responses.ts';\n\n/** How existing projects are fronted by id (GitLabBackendConfig.frontedProjects, parsed). */\nexport interface FrontedProjectsConfig {\n readonly prefix: string;\n readonly namespace: string;\n}\n\n/**\n * The reserved names `<prefix><projectId>` of a GitLab backend's fronted projects: which names are\n * reserved, which project id each addresses, and whether a project may be fronted (it lives under\n * the fronted namespace). Ids already confirmed are remembered for the life of the backend.\n */\nexport class FrontedProjects {\n readonly #pattern: RegExp | undefined;\n readonly #namespace: string | undefined;\n readonly #verified = new Set<number>();\n\n constructor(config: FrontedProjectsConfig | undefined) {\n this.#namespace = config?.namespace.toLowerCase();\n this.#pattern =\n config === undefined\n ? undefined\n : new RegExp(`^${config.prefix.replace(/[.*+?^${}()|[\\]\\\\/-]/g, '\\\\$&')}([1-9][0-9]{0,15})$`);\n }\n\n /** The project id `repo` addresses when it is a reserved name; null for an ordinary name. */\n idOf(repo: string): number | null {\n const match = this.#pattern?.exec(repo);\n return match?.[1] === undefined ? null : Number(match[1]);\n }\n\n /** True once {@link admits} has accepted project `id`. */\n verified(id: number): boolean {\n return this.#verified.has(id);\n }\n\n /** True when `project` is project `id` and lives under the fronted namespace, at any depth; remembered. */\n admits(id: number, project: GitLabProject): boolean {\n const ok =\n this.#namespace !== undefined &&\n project.id === id &&\n project.path_with_namespace.toLowerCase().startsWith(`${this.#namespace}/`);\n if (ok) this.#verified.add(id);\n return ok;\n }\n}\n\n/** The invalid_input error createRepo and deleteRepo answer for a fronted project's reserved name. */\nexport function frontedLifecycleRefused(repo: string, what: 'created' | 'deleted'): GatewayError {\n return gatewayError('invalid_input', 'Invalid input', {\n issues: [\n {\n path: 'name',\n message: `${repo} addresses an existing GitLab project by id; it cannot be ${what} through the gateway`,\n },\n ],\n });\n}\n"],"mappings":";;;;;;;AAgBA,IAAa,kBAAb,MAA6B;CAC3B;CACA;CACA,4BAAqB,IAAI,IAAY;CAErC,YAAY,QAA2C;EACrD,KAAK,aAAa,QAAQ,UAAU,YAAY;EAChD,KAAK,WACH,WAAW,KAAA,IACP,KAAA,IACA,IAAI,OAAO,IAAI,OAAO,OAAO,QAAQ,yBAAyB,MAAM,EAAE,oBAAoB;CAClG;;CAGA,KAAK,MAA6B;EAChC,MAAM,QAAQ,KAAK,UAAU,KAAK,IAAI;EACtC,OAAO,QAAQ,OAAO,KAAA,IAAY,OAAO,OAAO,MAAM,EAAE;CAC1D;;CAGA,SAAS,IAAqB;EAC5B,OAAO,KAAK,UAAU,IAAI,EAAE;CAC9B;;CAGA,OAAO,IAAY,SAAiC;EAClD,MAAM,KACJ,KAAK,eAAe,KAAA,KACpB,QAAQ,OAAO,MACf,QAAQ,oBAAoB,YAAY,CAAC,CAAC,WAAW,GAAG,KAAK,WAAW,EAAE;EAC5E,IAAI,IAAI,KAAK,UAAU,IAAI,EAAE;EAC7B,OAAO;CACT;AACF;;AAGA,SAAgB,wBAAwB,MAAc,MAA2C;CAC/F,OAAO,aAAa,iBAAiB,iBAAiB,EACpD,QAAQ,CACN;EACE,MAAM;EACN,SAAS,GAAG,KAAK,4DAA4D,KAAK;CACpF,CACF,EACF,CAAC;AACH"}
@@ -0,0 +1,12 @@
1
+ import { GitHttpClient } from "@leed-ai/git-gateway-core/smart-http/git-http-client";
2
+ import { StorageTreeEntry } from "@leed-ai/git-gateway-contract/storage/storage-tree-entry";
3
+ import { Commit } from "@leed-ai/git-gateway-contract/schemas/commit";
4
+ /**
5
+ * The commit objects for `shas`, decoded exactly as stored (GitLab's Commits API reports neither
6
+ * the tree id nor the raw message, so they are read from the objects themselves). Throws when the
7
+ * server does not send one of them.
8
+ */
9
+ export declare function readCommitsOverGit(client: GitHttpClient, shas: readonly string[]): Promise<Commit[]>;
10
+ /** One level of the tree `sha`, read over git; null when the server has no such object or it is not a tree. */
11
+ export declare function readTreeOverGit(client: GitHttpClient, sha: string): Promise<StorageTreeEntry[] | null>;
12
+ //# sourceMappingURL=gitlab-git-reads.d.ts.map
@@ -0,0 +1,56 @@
1
+ import { StorageTreeEntry } from "@leed-ai/git-gateway-contract/storage/storage-tree-entry";
2
+ import { isCoreError } from "@leed-ai/git-gateway-core/core-error";
3
+ import { decodeCommit } from "@leed-ai/git-gateway-core/objects/commit-object";
4
+ import { decodeTree } from "@leed-ai/git-gateway-core/objects/tree-object";
5
+ // src/gitlab-git-reads.ts
6
+ const KIND_OF_MODE = {
7
+ "040000": "tree",
8
+ "160000": "commit"
9
+ };
10
+ /**
11
+ * Fetches exactly the named objects over git: each want with one generation of history and a
12
+ * partial-clone filter that leaves out everything below it ("tree:0" for commits — the commit
13
+ * objects alone; "tree:1" for a tree — that tree alone). Returns null only when the server refuses
14
+ * a want in-protocol (an "ERR" pkt-line in an HTTP 200 answer: an unknown id), so the caller can
15
+ * tell a missing object from a failure. An HTTP failure (remote_http_error: an outage, an expired
16
+ * token) propagates, so the backend reports it as storage_unavailable.
17
+ */
18
+ async function fetchExact(client, wants, filter) {
19
+ try {
20
+ const { objects } = await client.fetchPack({
21
+ wants: [...wants],
22
+ depth: 1,
23
+ filter
24
+ });
25
+ return new Map(objects.map((object) => [object.sha, object]));
26
+ } catch (error) {
27
+ if (isCoreError(error, "remote_error")) return null;
28
+ throw error;
29
+ }
30
+ }
31
+ /**
32
+ * The commit objects for `shas`, decoded exactly as stored (GitLab's Commits API reports neither
33
+ * the tree id nor the raw message, so they are read from the objects themselves). Throws when the
34
+ * server does not send one of them.
35
+ */
36
+ async function readCommitsOverGit(client, shas) {
37
+ if (shas.length === 0) return [];
38
+ const objects = await fetchExact(client, shas, "tree:0");
39
+ return shas.map((sha) => {
40
+ const object = objects?.get(sha);
41
+ if (object?.type !== "commit") throw new Error(`GitLab did not send commit ${sha}`);
42
+ return decodeCommit(sha, object.data);
43
+ });
44
+ }
45
+ /** One level of the tree `sha`, read over git; null when the server has no such object or it is not a tree. */
46
+ async function readTreeOverGit(client, sha) {
47
+ const object = (await fetchExact(client, [sha], "tree:1"))?.get(sha);
48
+ if (object?.type !== "tree") return null;
49
+ return decodeTree(object.data, sha).map((entry) => StorageTreeEntry.parse({
50
+ ...entry,
51
+ type: entry.mode === "040000" || entry.mode === "160000" ? KIND_OF_MODE[entry.mode] : "blob"
52
+ }));
53
+ }
54
+ export { readCommitsOverGit, readTreeOverGit };
55
+
56
+ //# sourceMappingURL=gitlab-git-reads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-git-reads.js","names":[],"sources":["../src/gitlab-git-reads.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport type { Commit } from '@leed-ai/git-gateway-contract/schemas/commit';\nimport { StorageTreeEntry } from '@leed-ai/git-gateway-contract/storage/storage-tree-entry';\nimport { isCoreError } from '@leed-ai/git-gateway-core/core-error';\nimport { decodeCommit } from '@leed-ai/git-gateway-core/objects/commit-object';\nimport { decodeTree } from '@leed-ai/git-gateway-core/objects/tree-object';\nimport type { GitObject } from '@leed-ai/git-gateway-core/schemas/git-object';\nimport type { GitHttpClient } from '@leed-ai/git-gateway-core/smart-http/git-http-client';\n\nconst KIND_OF_MODE = { '040000': 'tree', '160000': 'commit' } as const;\n\n/**\n * Fetches exactly the named objects over git: each want with one generation of history and a\n * partial-clone filter that leaves out everything below it (\"tree:0\" for commits — the commit\n * objects alone; \"tree:1\" for a tree — that tree alone). Returns null only when the server refuses\n * a want in-protocol (an \"ERR\" pkt-line in an HTTP 200 answer: an unknown id), so the caller can\n * tell a missing object from a failure. An HTTP failure (remote_http_error: an outage, an expired\n * token) propagates, so the backend reports it as storage_unavailable.\n */\nasync function fetchExact(\n client: GitHttpClient,\n wants: readonly string[],\n filter: 'tree:0' | 'tree:1',\n): Promise<Map<string, GitObject> | null> {\n try {\n const { objects } = await client.fetchPack({ wants: [...wants], depth: 1, filter });\n return new Map(objects.map((object) => [object.sha, object]));\n } catch (error) {\n if (isCoreError(error, 'remote_error')) return null;\n throw error;\n }\n}\n\n/**\n * The commit objects for `shas`, decoded exactly as stored (GitLab's Commits API reports neither\n * the tree id nor the raw message, so they are read from the objects themselves). Throws when the\n * server does not send one of them.\n */\nexport async function readCommitsOverGit(client: GitHttpClient, shas: readonly string[]): Promise<Commit[]> {\n if (shas.length === 0) return [];\n const objects = await fetchExact(client, shas, 'tree:0');\n return shas.map((sha) => {\n const object = objects?.get(sha);\n if (object?.type !== 'commit') throw new Error(`GitLab did not send commit ${sha}`);\n return decodeCommit(sha, object.data);\n });\n}\n\n/** One level of the tree `sha`, read over git; null when the server has no such object or it is not a tree. */\nexport async function readTreeOverGit(\n client: GitHttpClient,\n sha: string,\n): Promise<StorageTreeEntry[] | null> {\n const object = (await fetchExact(client, [sha], 'tree:1'))?.get(sha);\n if (object?.type !== 'tree') return null;\n return decodeTree(object.data, sha).map((entry) =>\n StorageTreeEntry.parse({\n ...entry,\n type: entry.mode === '040000' || entry.mode === '160000' ? KIND_OF_MODE[entry.mode] : 'blob',\n }),\n );\n}\n"],"mappings":";;;;;AASA,MAAM,eAAe;CAAE,UAAU;CAAQ,UAAU;AAAS;;;;;;;;;AAU5D,eAAe,WACb,QACA,OACA,QACwC;CACxC,IAAI;EACF,MAAM,EAAE,YAAY,MAAM,OAAO,UAAU;GAAE,OAAO,CAAC,GAAG,KAAK;GAAG,OAAO;GAAG;EAAO,CAAC;EAClF,OAAO,IAAI,IAAI,QAAQ,KAAK,WAAW,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC;CAC9D,SAAS,OAAO;EACd,IAAI,YAAY,OAAO,cAAc,GAAG,OAAO;EAC/C,MAAM;CACR;AACF;;;;;;AAOA,eAAsB,mBAAmB,QAAuB,MAA4C;CAC1G,IAAI,KAAK,WAAW,GAAG,OAAO,CAAC;CAC/B,MAAM,UAAU,MAAM,WAAW,QAAQ,MAAM,QAAQ;CACvD,OAAO,KAAK,KAAK,QAAQ;EACvB,MAAM,SAAS,SAAS,IAAI,GAAG;EAC/B,IAAI,QAAQ,SAAS,UAAU,MAAM,IAAI,MAAM,8BAA8B,KAAK;EAClF,OAAO,aAAa,KAAK,OAAO,IAAI;CACtC,CAAC;AACH;;AAGA,eAAsB,gBACpB,QACA,KACoC;CACpC,MAAM,UAAU,MAAM,WAAW,QAAQ,CAAC,GAAG,GAAG,QAAQ,EAAA,EAAI,IAAI,GAAG;CACnE,IAAI,QAAQ,SAAS,QAAQ,OAAO;CACpC,OAAO,WAAW,OAAO,MAAM,GAAG,CAAC,CAAC,KAAK,UACvC,iBAAiB,MAAM;EACrB,GAAG;EACH,MAAM,MAAM,SAAS,YAAY,MAAM,SAAS,WAAW,aAAa,MAAM,QAAQ;CACxF,CAAC,CACH;AACF"}
@@ -0,0 +1,11 @@
1
+ import { GitLabApi } from "./gitlab-api.js";
2
+ /**
3
+ * Whether `ancestor` is `descendant` or one of its ancestors, from one call to GitLab's merge-base
4
+ * API (`GET /projects/:id/repository/merge_base?refs[]=…&refs[]=…`): it is exactly when the merge
5
+ * base of the two is `ancestor` itself. Null when GitLab cannot find either commit (400 "Could not
6
+ * find ref"); false when the two share no history (404 "Merge Base Not Found"). Any other error is
7
+ * thrown for the backend to map. Both ids must already be validated 40-character hex ids, which
8
+ * git resolves as object ids before any ref name.
9
+ */
10
+ export declare function isAncestorOnGitLab(api: GitLabApi, projectPath: string, ancestor: string, descendant: string): Promise<boolean | null>;
11
+ //# sourceMappingURL=gitlab-merge-base.d.ts.map
@@ -0,0 +1,26 @@
1
+ import { GitLabHttpError } from "./gitlab-api.js";
2
+ import { GitLabCommitSummary } from "./schemas/gitlab-responses.js";
3
+ // src/gitlab-merge-base.ts
4
+ /**
5
+ * Whether `ancestor` is `descendant` or one of its ancestors, from one call to GitLab's merge-base
6
+ * API (`GET /projects/:id/repository/merge_base?refs[]=…&refs[]=…`): it is exactly when the merge
7
+ * base of the two is `ancestor` itself. Null when GitLab cannot find either commit (400 "Could not
8
+ * find ref"); false when the two share no history (404 "Merge Base Not Found"). Any other error is
9
+ * thrown for the backend to map. Both ids must already be validated 40-character hex ids, which
10
+ * git resolves as object ids before any ref name.
11
+ */
12
+ async function isAncestorOnGitLab(api, projectPath, ancestor, descendant) {
13
+ const refs = [ancestor, descendant].map((sha) => `refs%5B%5D=${sha}`).join("&");
14
+ try {
15
+ return (await api.json(GitLabCommitSummary, `${projectPath}/repository/merge_base?${refs}`)).id === ancestor;
16
+ } catch (error) {
17
+ if (error instanceof GitLabHttpError && !error.projectMissing) {
18
+ if (error.status === 400 && /could not find/i.test(error.detail)) return null;
19
+ if (error.status === 404 && /merge base/i.test(error.detail)) return false;
20
+ }
21
+ throw error;
22
+ }
23
+ }
24
+ export { isAncestorOnGitLab };
25
+
26
+ //# sourceMappingURL=gitlab-merge-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-merge-base.js","names":[],"sources":["../src/gitlab-merge-base.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { GitLabHttpError, type GitLabApi } from './gitlab-api.ts';\nimport { GitLabCommitSummary } from './schemas/gitlab-responses.ts';\n\n/**\n * Whether `ancestor` is `descendant` or one of its ancestors, from one call to GitLab's merge-base\n * API (`GET /projects/:id/repository/merge_base?refs[]=…&refs[]=…`): it is exactly when the merge\n * base of the two is `ancestor` itself. Null when GitLab cannot find either commit (400 \"Could not\n * find ref\"); false when the two share no history (404 \"Merge Base Not Found\"). Any other error is\n * thrown for the backend to map. Both ids must already be validated 40-character hex ids, which\n * git resolves as object ids before any ref name.\n */\nexport async function isAncestorOnGitLab(\n api: GitLabApi,\n projectPath: string,\n ancestor: string,\n descendant: string,\n): Promise<boolean | null> {\n const refs = [ancestor, descendant].map((sha) => `refs%5B%5D=${sha}`).join('&');\n try {\n const base = await api.json(GitLabCommitSummary, `${projectPath}/repository/merge_base?${refs}`);\n return base.id === ancestor;\n } catch (error) {\n if (error instanceof GitLabHttpError && !error.projectMissing) {\n if (error.status === 400 && /could not find/i.test(error.detail)) return null;\n if (error.status === 404 && /merge base/i.test(error.detail)) return false;\n }\n throw error;\n }\n}\n"],"mappings":";;;;;;;;;;;AAYA,eAAsB,mBACpB,KACA,aACA,UACA,YACyB;CACzB,MAAM,OAAO,CAAC,UAAU,UAAU,CAAC,CAAC,KAAK,QAAQ,cAAc,KAAK,CAAC,CAAC,KAAK,GAAG;CAC9E,IAAI;EAEF,QAAO,MADY,IAAI,KAAK,qBAAqB,GAAG,YAAY,yBAAyB,MAAM,EAAA,CACnF,OAAO;CACrB,SAAS,OAAO;EACd,IAAI,iBAAiB,mBAAmB,CAAC,MAAM,gBAAgB;GAC7D,IAAI,MAAM,WAAW,OAAO,kBAAkB,KAAK,MAAM,MAAM,GAAG,OAAO;GACzE,IAAI,MAAM,WAAW,OAAO,cAAc,KAAK,MAAM,MAAM,GAAG,OAAO;EACvE;EACA,MAAM;CACR;AACF"}
@@ -0,0 +1,3 @@
1
+ /** The npm name this package is published under. */
2
+ export declare const packageName: '@leed-ai/git-gateway-backend-gitlab';
3
+ //# sourceMappingURL=package-name.d.ts.map
@@ -0,0 +1,6 @@
1
+ // src/package-name.ts
2
+ /** The npm name this package is published under. */
3
+ const packageName = "@leed-ai/git-gateway-backend-gitlab";
4
+ export { packageName };
5
+
6
+ //# sourceMappingURL=package-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-name.js","names":[],"sources":["../src/package-name.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/** The npm name this package is published under. */\nexport const packageName = '@leed-ai/git-gateway-backend-gitlab' as const;\n"],"mappings":";;AAGA,MAAa,cAAc"}
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ /** How the GitLab backend reaches its GitLab instance. */
3
+ export declare const GitLabBackendConfig: z.ZodObject<{
4
+ baseUrl: z.ZodDefault<z.ZodURL>;
5
+ token: z.ZodString;
6
+ namespace: z.ZodString;
7
+ namespaceId: z.ZodOptional<z.ZodInt>;
8
+ frontedProjects: z.ZodOptional<z.ZodObject<{
9
+ prefix: z.ZodDefault<z.ZodString>;
10
+ namespace: z.ZodString;
11
+ }, z.core.$strict>>;
12
+ gitUsername: z.ZodDefault<z.ZodString>;
13
+ }, z.core.$strict>;
14
+ /** GitLab backend configuration as accepted (defaults optional). */
15
+ export type GitLabBackendConfig = z.input<typeof GitLabBackendConfig>;
16
+ //# sourceMappingURL=gitlab-config.d.ts.map
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ // src/schemas/gitlab-config.ts
3
+ /** How the GitLab backend reaches its GitLab instance. */
4
+ const GitLabBackendConfig = z.object({
5
+ baseUrl: z.url({ protocol: /^https?$/ }).default("https://gitlab.com").describe("Base URL of the GitLab instance, without a trailing \"/api/v4\". Default \"https://gitlab.com\"."),
6
+ token: z.string().min(1).describe("A GitLab access token (personal, group or project access token, or OAuth) with the api, read_repository and write_repository scopes on the namespace. Secret: sent as a PRIVATE-TOKEN header to the API and as the HTTP Basic password to git."),
7
+ namespace: z.string().min(1).max(255).regex(/^[A-Za-z0-9_.][A-Za-z0-9_.-]*(?:\/[A-Za-z0-9_.][A-Za-z0-9_.-]*)*$/).describe("Full path of the group the repositories live in, e.g. \"acme/sites\". A repository named <repo> is the project <namespace>/<repo>."),
8
+ namespaceId: z.int().positive().optional().describe("Numeric id of that group. Absent: looked up from `namespace` the first time a repository is created."),
9
+ frontedProjects: z.object({
10
+ prefix: z.string().min(1).max(20).regex(/^[A-Za-z][A-Za-z0-9_.]*-$/).default("gl-").describe("Prefix of the reserved repository names that address an existing project by id: <prefix><projectId>, e.g. \"gl-1234\" for project 1234. 1–20 characters, starting with a letter and ending in \"-\". Default \"gl-\"."),
11
+ namespace: z.string().min(1).max(255).regex(/^[A-Za-z0-9_.][A-Za-z0-9_.-]*(?:\/[A-Za-z0-9_.][A-Za-z0-9_.-]*)*$/).describe("Full path of the group whose projects (at any depth below it) may be fronted, e.g. \"acme/customers\". A project id outside it answers repo_not_found, so the token's other projects stay unreachable.")
12
+ }).strict().optional().describe("Fronts projects that already exist outside `namespace`, addressed by project id instead of by name. A repository named <prefix><projectId> is project <projectId>, provided it lives under `frontedProjects.namespace`; createRepo and deleteRepo refuse such names with invalid_input, since the gateway did not create those projects and must not remove them. Absent: every name is a project in `namespace`."),
13
+ gitUsername: z.string().min(1).default("oauth2").describe("HTTP Basic username sent with the token to git; GitLab ignores it for access tokens. Default \"oauth2\".")
14
+ }).strict().meta({
15
+ id: "GitLabBackendConfig",
16
+ title: "GitLab backend configuration",
17
+ description: "Where the GitLab storage backend keeps repositories and the credential it uses. Each repository is a private project in one group.",
18
+ examples: [{
19
+ baseUrl: "https://gitlab.com",
20
+ token: "glpat-example",
21
+ namespace: "acme/sites",
22
+ gitUsername: "oauth2"
23
+ }, {
24
+ baseUrl: "https://gitlab.com",
25
+ token: "glpat-example",
26
+ namespace: "acme/sites",
27
+ frontedProjects: {
28
+ prefix: "gl-",
29
+ namespace: "acme/customers"
30
+ },
31
+ gitUsername: "oauth2"
32
+ }]
33
+ });
34
+ export { GitLabBackendConfig };
35
+
36
+ //# sourceMappingURL=gitlab-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-config.js","names":[],"sources":["../../src/schemas/gitlab-config.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { z } from 'zod';\n\n/** How the GitLab backend reaches its GitLab instance. */\nexport const GitLabBackendConfig = z\n .object({\n baseUrl: z\n .url({ protocol: /^https?$/ })\n .default('https://gitlab.com')\n .describe(\n 'Base URL of the GitLab instance, without a trailing \"/api/v4\". Default \"https://gitlab.com\".',\n ),\n token: z\n .string()\n .min(1)\n .describe(\n 'A GitLab access token (personal, group or project access token, or OAuth) with the api, read_repository and write_repository scopes on the namespace. Secret: sent as a PRIVATE-TOKEN header to the API and as the HTTP Basic password to git.',\n ),\n namespace: z\n .string()\n .min(1)\n .max(255)\n .regex(/^[A-Za-z0-9_.][A-Za-z0-9_.-]*(?:\\/[A-Za-z0-9_.][A-Za-z0-9_.-]*)*$/)\n .describe(\n 'Full path of the group the repositories live in, e.g. \"acme/sites\". A repository named <repo> is the project <namespace>/<repo>.',\n ),\n namespaceId: z\n .int()\n .positive()\n .optional()\n .describe(\n 'Numeric id of that group. Absent: looked up from `namespace` the first time a repository is created.',\n ),\n frontedProjects: z\n .object({\n prefix: z\n .string()\n .min(1)\n .max(20)\n .regex(/^[A-Za-z][A-Za-z0-9_.]*-$/)\n .default('gl-')\n .describe(\n 'Prefix of the reserved repository names that address an existing project by id: <prefix><projectId>, e.g. \"gl-1234\" for project 1234. 1–20 characters, starting with a letter and ending in \"-\". Default \"gl-\".',\n ),\n namespace: z\n .string()\n .min(1)\n .max(255)\n .regex(/^[A-Za-z0-9_.][A-Za-z0-9_.-]*(?:\\/[A-Za-z0-9_.][A-Za-z0-9_.-]*)*$/)\n .describe(\n 'Full path of the group whose projects (at any depth below it) may be fronted, e.g. \"acme/customers\". A project id outside it answers repo_not_found, so the token\\'s other projects stay unreachable.',\n ),\n })\n .strict()\n .optional()\n .describe(\n 'Fronts projects that already exist outside `namespace`, addressed by project id instead of by name. A repository named <prefix><projectId> is project <projectId>, provided it lives under `frontedProjects.namespace`; createRepo and deleteRepo refuse such names with invalid_input, since the gateway did not create those projects and must not remove them. Absent: every name is a project in `namespace`.',\n ),\n gitUsername: z\n .string()\n .min(1)\n .default('oauth2')\n .describe(\n 'HTTP Basic username sent with the token to git; GitLab ignores it for access tokens. Default \"oauth2\".',\n ),\n })\n .strict()\n .meta({\n id: 'GitLabBackendConfig',\n title: 'GitLab backend configuration',\n description:\n 'Where the GitLab storage backend keeps repositories and the credential it uses. Each repository is a private project in one group.',\n examples: [\n {\n baseUrl: 'https://gitlab.com',\n token: 'glpat-example',\n namespace: 'acme/sites',\n gitUsername: 'oauth2',\n },\n {\n baseUrl: 'https://gitlab.com',\n token: 'glpat-example',\n namespace: 'acme/sites',\n frontedProjects: { prefix: 'gl-', namespace: 'acme/customers' },\n gitUsername: 'oauth2',\n },\n ],\n });\n\n/** GitLab backend configuration as accepted (defaults optional). */\nexport type GitLabBackendConfig = z.input<typeof GitLabBackendConfig>;\n"],"mappings":";;;AAIA,MAAa,sBAAsB,EAChC,OAAO;CACN,SAAS,EACN,IAAI,EAAE,UAAU,WAAW,CAAC,CAAC,CAC7B,QAAQ,oBAAoB,CAAC,CAC7B,SACC,kGACF;CACF,OAAO,EACJ,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,SACC,gPACF;CACF,WAAW,EACR,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,IAAI,GAAG,CAAC,CACR,MAAM,mEAAmE,CAAC,CAC1E,SACC,oIACF;CACF,aAAa,EACV,IAAI,CAAC,CACL,SAAS,CAAC,CACV,SAAS,CAAC,CACV,SACC,sGACF;CACF,iBAAiB,EACd,OAAO;EACN,QAAQ,EACL,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,IAAI,EAAE,CAAC,CACP,MAAM,2BAA2B,CAAC,CAClC,QAAQ,KAAK,CAAC,CACd,SACC,uNACF;EACF,WAAW,EACR,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,IAAI,GAAG,CAAC,CACR,MAAM,mEAAmE,CAAC,CAC1E,SACC,wMACF;CACJ,CAAC,CAAC,CACD,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SACC,mZACF;CACF,aAAa,EACV,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,QAAQ,QAAQ,CAAC,CACjB,SACC,0GACF;AACJ,CAAC,CAAC,CACD,OAAO,CAAC,CACR,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU,CACR;EACE,SAAS;EACT,OAAO;EACP,WAAW;EACX,aAAa;CACf,GACA;EACE,SAAS;EACT,OAAO;EACP,WAAW;EACX,iBAAiB;GAAE,QAAQ;GAAO,WAAW;EAAiB;EAC9D,aAAa;CACf,CACF;AACF,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { z } from "zod";
2
+ /** A project from the GitLab Projects API. */
3
+ export declare const GitLabProject: z.ZodObject<{
4
+ id: z.ZodInt;
5
+ path: z.ZodString;
6
+ path_with_namespace: z.ZodString;
7
+ default_branch: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
+ created_at: z.ZodISODateTime;
9
+ http_url_to_repo: z.ZodURL;
10
+ marked_for_deletion_on: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
+ }, z.core.$strip>;
12
+ /** A GitLab project, inferred from {@link GitLabProject}. */
13
+ export type GitLabProject = z.infer<typeof GitLabProject>;
14
+ /** A group from the GitLab Groups API. */
15
+ export declare const GitLabGroup: z.ZodObject<{
16
+ id: z.ZodInt;
17
+ full_path: z.ZodString;
18
+ }, z.core.$strip>;
19
+ /** A GitLab group, inferred from {@link GitLabGroup}. */
20
+ export type GitLabGroup = z.infer<typeof GitLabGroup>;
21
+ /** A branch or tag from the GitLab Branches or Tags API. */
22
+ export declare const GitLabRef: z.ZodObject<{
23
+ name: z.ZodString;
24
+ commit: z.ZodObject<{
25
+ id: z.ZodString;
26
+ }, z.core.$strip>;
27
+ }, z.core.$strip>;
28
+ /** A GitLab branch or tag, inferred from {@link GitLabRef}. */
29
+ export type GitLabRef = z.infer<typeof GitLabRef>;
30
+ /** A commit from the GitLab Commits API, as listed. */
31
+ export declare const GitLabCommitSummary: z.ZodObject<{
32
+ id: z.ZodString;
33
+ parent_ids: z.ZodArray<z.ZodString>;
34
+ }, z.core.$strip>;
35
+ /** A listed GitLab commit, inferred from {@link GitLabCommitSummary}. */
36
+ export type GitLabCommitSummary = z.infer<typeof GitLabCommitSummary>;
37
+ /** The body of a GitLab API error response. */
38
+ export declare const GitLabErrorBody: z.ZodObject<{
39
+ message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>]>>;
40
+ error: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strip>;
42
+ /** A GitLab error body, inferred from {@link GitLabErrorBody}. */
43
+ export type GitLabErrorBody = z.infer<typeof GitLabErrorBody>;
44
+ //# sourceMappingURL=gitlab-responses.d.ts.map
@@ -0,0 +1,80 @@
1
+ import { z } from "zod";
2
+ // src/schemas/gitlab-responses.ts
3
+ const SHA = /^[0-9a-f]{40}$/;
4
+ const EXAMPLE_SHA = "8f3c2a9e1b7d4c6f0a5e2d9b8c7a6f5e4d3c2b1a";
5
+ const timestamp = z.iso.datetime({ offset: true });
6
+ /** A project from the GitLab Projects API. */
7
+ const GitLabProject = z.object({
8
+ id: z.int().positive().describe("Numeric project id."),
9
+ path: z.string().min(1).describe("The project's path segment, which is the repository name."),
10
+ path_with_namespace: z.string().min(1).describe("Full path, \"<namespace>/<path>\"."),
11
+ default_branch: z.string().min(1).nullable().optional().describe("The default branch; null or absent for an empty repository on some GitLab versions."),
12
+ created_at: timestamp.describe("When the project was created, ISO 8601."),
13
+ http_url_to_repo: z.url().describe("HTTPS clone URL of the repository, ending in \".git\"."),
14
+ marked_for_deletion_on: z.string().nullable().optional().describe("Date the project is scheduled for deletion (delayed deletion); null or absent when it is not.")
15
+ }).meta({
16
+ id: "GitLabProject",
17
+ title: "GitLab project",
18
+ description: "The fields of a GitLab project the backend uses; other fields are ignored.",
19
+ examples: [{
20
+ id: 1234,
21
+ path: "acme-raw-content",
22
+ path_with_namespace: "acme/sites/acme-raw-content",
23
+ default_branch: "main",
24
+ created_at: "2026-11-20T09:30:00.000Z",
25
+ http_url_to_repo: "https://gitlab.com/acme/sites/acme-raw-content.git",
26
+ marked_for_deletion_on: null
27
+ }]
28
+ });
29
+ /** A group from the GitLab Groups API. */
30
+ const GitLabGroup = z.object({
31
+ id: z.int().positive().describe("Numeric group id, used as namespace_id when creating projects."),
32
+ full_path: z.string().min(1).describe("Full path of the group.")
33
+ }).meta({
34
+ id: "GitLabGroup",
35
+ title: "GitLab group",
36
+ description: "The fields of a GitLab group the backend uses.",
37
+ examples: [{
38
+ id: 42,
39
+ full_path: "acme/sites"
40
+ }]
41
+ });
42
+ /** A branch or tag from the GitLab Branches or Tags API. */
43
+ const GitLabRef = z.object({
44
+ name: z.string().min(1).describe("Short branch or tag name."),
45
+ commit: z.object({ id: z.string().regex(SHA).describe("Id of the commit the ref names (for a tag, the peeled commit).") }).describe("The commit the ref points at.")
46
+ }).meta({
47
+ id: "GitLabRef",
48
+ title: "GitLab branch or tag",
49
+ description: "A branch or tag and the commit it names.",
50
+ examples: [{
51
+ name: "main",
52
+ commit: { id: EXAMPLE_SHA }
53
+ }]
54
+ });
55
+ /** A commit from the GitLab Commits API, as listed. */
56
+ const GitLabCommitSummary = z.object({
57
+ id: z.string().regex(SHA).describe("The commit id."),
58
+ parent_ids: z.array(z.string().regex(SHA).describe("A parent commit id.")).describe("Parent ids in order.")
59
+ }).meta({
60
+ id: "GitLabCommitSummary",
61
+ title: "GitLab commit summary",
62
+ description: "The fields of a GitLab commit the backend uses to list history. GitLab does not report the tree id or exact message, so the commit objects themselves are fetched over git.",
63
+ examples: [{
64
+ id: EXAMPLE_SHA,
65
+ parent_ids: []
66
+ }]
67
+ });
68
+ /** The body of a GitLab API error response. */
69
+ const GitLabErrorBody = z.object({
70
+ message: z.union([z.string().describe("A plain message such as \"404 Project Not Found\"."), z.record(z.string().describe("The field that failed validation."), z.array(z.string().describe("One failure.")).describe("What is wrong with it.")).describe("Validation failures by field, e.g. {\"path\": [\"has already been taken\"]}.")]).optional().describe("The error message; absent when GitLab sent only \"error\"."),
71
+ error: z.string().optional().describe("A short error code or message, e.g. \"insufficient_scope\".")
72
+ }).meta({
73
+ id: "GitLabErrorBody",
74
+ title: "GitLab error body",
75
+ description: "The JSON body of a GitLab API error.",
76
+ examples: [{ message: "404 Project Not Found" }, { message: { path: ["has already been taken"] } }]
77
+ });
78
+ export { GitLabCommitSummary, GitLabErrorBody, GitLabGroup, GitLabProject, GitLabRef };
79
+
80
+ //# sourceMappingURL=gitlab-responses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gitlab-responses.js","names":[],"sources":["../../src/schemas/gitlab-responses.ts"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\nimport { z } from 'zod';\n\nconst SHA = /^[0-9a-f]{40}$/;\nconst EXAMPLE_SHA = '8f3c2a9e1b7d4c6f0a5e2d9b8c7a6f5e4d3c2b1a';\nconst timestamp = z.iso.datetime({ offset: true });\n\n/** A project from the GitLab Projects API. */\nexport const GitLabProject = z\n .object({\n id: z.int().positive().describe('Numeric project id.'),\n path: z.string().min(1).describe(\"The project's path segment, which is the repository name.\"),\n path_with_namespace: z.string().min(1).describe('Full path, \"<namespace>/<path>\".'),\n default_branch: z\n .string()\n .min(1)\n .nullable()\n .optional()\n .describe('The default branch; null or absent for an empty repository on some GitLab versions.'),\n created_at: timestamp.describe('When the project was created, ISO 8601.'),\n http_url_to_repo: z.url().describe('HTTPS clone URL of the repository, ending in \".git\".'),\n marked_for_deletion_on: z\n .string()\n .nullable()\n .optional()\n .describe(\n 'Date the project is scheduled for deletion (delayed deletion); null or absent when it is not.',\n ),\n })\n .meta({\n id: 'GitLabProject',\n title: 'GitLab project',\n description: 'The fields of a GitLab project the backend uses; other fields are ignored.',\n examples: [\n {\n id: 1234,\n path: 'acme-raw-content',\n path_with_namespace: 'acme/sites/acme-raw-content',\n default_branch: 'main',\n created_at: '2026-11-20T09:30:00.000Z',\n http_url_to_repo: 'https://gitlab.com/acme/sites/acme-raw-content.git',\n marked_for_deletion_on: null,\n },\n ],\n });\n\n/** A GitLab project, inferred from {@link GitLabProject}. */\nexport type GitLabProject = z.infer<typeof GitLabProject>;\n\n/** A group from the GitLab Groups API. */\nexport const GitLabGroup = z\n .object({\n id: z.int().positive().describe('Numeric group id, used as namespace_id when creating projects.'),\n full_path: z.string().min(1).describe('Full path of the group.'),\n })\n .meta({\n id: 'GitLabGroup',\n title: 'GitLab group',\n description: 'The fields of a GitLab group the backend uses.',\n examples: [{ id: 42, full_path: 'acme/sites' }],\n });\n\n/** A GitLab group, inferred from {@link GitLabGroup}. */\nexport type GitLabGroup = z.infer<typeof GitLabGroup>;\n\n/** A branch or tag from the GitLab Branches or Tags API. */\nexport const GitLabRef = z\n .object({\n name: z.string().min(1).describe('Short branch or tag name.'),\n commit: z\n .object({\n id: z.string().regex(SHA).describe('Id of the commit the ref names (for a tag, the peeled commit).'),\n })\n .describe('The commit the ref points at.'),\n })\n .meta({\n id: 'GitLabRef',\n title: 'GitLab branch or tag',\n description: 'A branch or tag and the commit it names.',\n examples: [{ name: 'main', commit: { id: EXAMPLE_SHA } }],\n });\n\n/** A GitLab branch or tag, inferred from {@link GitLabRef}. */\nexport type GitLabRef = z.infer<typeof GitLabRef>;\n\n/** A commit from the GitLab Commits API, as listed. */\nexport const GitLabCommitSummary = z\n .object({\n id: z.string().regex(SHA).describe('The commit id.'),\n parent_ids: z\n .array(z.string().regex(SHA).describe('A parent commit id.'))\n .describe('Parent ids in order.'),\n })\n .meta({\n id: 'GitLabCommitSummary',\n title: 'GitLab commit summary',\n description:\n 'The fields of a GitLab commit the backend uses to list history. GitLab does not report the tree id or exact message, so the commit objects themselves are fetched over git.',\n examples: [{ id: EXAMPLE_SHA, parent_ids: [] }],\n });\n\n/** A listed GitLab commit, inferred from {@link GitLabCommitSummary}. */\nexport type GitLabCommitSummary = z.infer<typeof GitLabCommitSummary>;\n\n/** The body of a GitLab API error response. */\nexport const GitLabErrorBody = z\n .object({\n message: z\n .union([\n z.string().describe('A plain message such as \"404 Project Not Found\".'),\n z\n .record(\n z.string().describe('The field that failed validation.'),\n z.array(z.string().describe('One failure.')).describe('What is wrong with it.'),\n )\n .describe('Validation failures by field, e.g. {\"path\": [\"has already been taken\"]}.'),\n ])\n .optional()\n .describe('The error message; absent when GitLab sent only \"error\".'),\n error: z.string().optional().describe('A short error code or message, e.g. \"insufficient_scope\".'),\n })\n .meta({\n id: 'GitLabErrorBody',\n title: 'GitLab error body',\n description: 'The JSON body of a GitLab API error.',\n examples: [{ message: '404 Project Not Found' }, { message: { path: ['has already been taken'] } }],\n });\n\n/** A GitLab error body, inferred from {@link GitLabErrorBody}. */\nexport type GitLabErrorBody = z.infer<typeof GitLabErrorBody>;\n"],"mappings":";;AAGA,MAAM,MAAM;AACZ,MAAM,cAAc;AACpB,MAAM,YAAY,EAAE,IAAI,SAAS,EAAE,QAAQ,KAAK,CAAC;;AAGjD,MAAa,gBAAgB,EAC1B,OAAO;CACN,IAAI,EAAE,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,qBAAqB;CACrD,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,2DAA2D;CAC5F,qBAAqB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,oCAAkC;CAClF,gBAAgB,EACb,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,SAAS,CAAC,CACV,SAAS,CAAC,CACV,SA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,CAAC,CAAC,SAAS,qBAAqB,CAAC,CAAC,CAC5D,SAAS,sBAAsB;AACpC,CAAC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aACE;CACF,UAAU,CAAC;EAAE,IAAI;EAAa,YAAY,CAAC;CAAE,CAAC;AAChD,CAAC;;AAMH,MAAa,kBAAkB,EAC5B,OAAO;CACN,SAAS,EACN,MAAM,CACL,EAAE,OAAO,CAAC,CAAC,SAAS,oDAAkD,GACtE,EACG,OACC,EAAE,OAAO,CAAC,CAAC,SAAS,mCAAmC,GACvD,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,SAAS,wBAAwB,CAChF,CAAC,CACA,SAAS,8EAA0E,CACxF,CAAC,CAAC,CACD,SAAS,CAAC,CACV,SAAS,4DAA0D;CACtE,OAAO,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,6DAA2D;AACnG,CAAC,CAAC,CACD,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACb,UAAU,CAAC,EAAE,SAAS,wBAAwB,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,wBAAwB,EAAE,EAAE,CAAC;AACpG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,90 @@
1
1
  {
2
2
  "name": "@leed-ai/git-gateway-backend-gitlab",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "git-gateway storage backend over a GitLab instance.",
5
+ "keywords": [
6
+ "cloudflare-workers",
7
+ "git",
8
+ "git-gateway",
9
+ "gitlab",
10
+ "storage-backend"
11
+ ],
12
+ "homepage": "https://github.com/leed-ai/git-gateway/tree/main/packages/backend-gitlab#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/leed-ai/git-gateway/issues"
15
+ },
16
+ "license": "Apache-2.0",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/leed-ai/git-gateway.git",
20
+ "directory": "packages/backend-gitlab"
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "src"
25
+ ],
26
+ "type": "module",
27
+ "sideEffects": false,
28
+ "exports": {
29
+ "./gitlab-api": {
30
+ "source": "./src/gitlab-api.ts",
31
+ "types": "./dist/gitlab-api.d.ts",
32
+ "default": "./dist/gitlab-api.js"
33
+ },
34
+ "./gitlab-backend": {
35
+ "source": "./src/gitlab-backend.ts",
36
+ "types": "./dist/gitlab-backend.d.ts",
37
+ "default": "./dist/gitlab-backend.js"
38
+ },
39
+ "./gitlab-git-reads": {
40
+ "source": "./src/gitlab-git-reads.ts",
41
+ "types": "./dist/gitlab-git-reads.d.ts",
42
+ "default": "./dist/gitlab-git-reads.js"
43
+ },
44
+ "./package-name": {
45
+ "source": "./src/package-name.ts",
46
+ "types": "./dist/package-name.d.ts",
47
+ "default": "./dist/package-name.js"
48
+ },
49
+ "./schemas/gitlab-config": {
50
+ "source": "./src/schemas/gitlab-config.ts",
51
+ "types": "./dist/schemas/gitlab-config.d.ts",
52
+ "default": "./dist/schemas/gitlab-config.js"
53
+ },
54
+ "./schemas/gitlab-responses": {
55
+ "source": "./src/schemas/gitlab-responses.ts",
56
+ "types": "./dist/schemas/gitlab-responses.d.ts",
57
+ "default": "./dist/schemas/gitlab-responses.js"
58
+ },
59
+ "./package.json": "./package.json"
60
+ },
61
+ "publishConfig": {
62
+ "access": "public",
63
+ "provenance": true
64
+ },
65
+ "scripts": {
66
+ "build": "vp pack",
67
+ "check": "vp check",
68
+ "test": "vp test",
69
+ "test:contract": "vp test test/contract/"
70
+ },
71
+ "dependencies": {
72
+ "@leed-ai/git-gateway-contract": "0.1.0",
73
+ "@leed-ai/git-gateway-core": "0.1.0"
74
+ },
75
+ "devDependencies": {
76
+ "@leed-ai/git-gateway-repo-tools": "0.0.0",
77
+ "@leed-ai/git-gateway-schema-docs": "0.0.0",
78
+ "@leed-ai/git-gateway-testkit": "0.1.0",
79
+ "@types/node": "^24.19.2",
80
+ "typescript": "^7.0.2",
81
+ "vite-plus": "^1.7.0",
82
+ "zod": "^4.6.7"
83
+ },
84
+ "peerDependencies": {
85
+ "zod": "^4"
86
+ },
87
+ "engines": {
88
+ "node": ">=22.18.0"
89
+ }
90
+ }