@leed-ai/git-gateway-contract 0.1.0 → 0.1.1-next.20261122230525
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.
|
@@ -19,6 +19,11 @@ import { StorageTreeEntry } from "./storage-tree-entry.js";
|
|
|
19
19
|
* - Every call on a repository that does not exist throws `repo_not_found`, except
|
|
20
20
|
* {@link repoInfo} (null) and {@link deleteRepo} (no-op).
|
|
21
21
|
* - A missing object, ref or path is `null` (an empty array for {@link log}), never an error.
|
|
22
|
+
* - So is an id that names an object of another kind: {@link readCommit} of a tree or a blob,
|
|
23
|
+
* {@link readTree} of a commit or a blob, {@link readBlob} of a commit or a tree, and a
|
|
24
|
+
* revision naming a tree or a blob. Each read answers whether an object of its kind has that
|
|
25
|
+
* id, so a caller may try one kind after another; a backend whose host refuses such a read with
|
|
26
|
+
* an error maps that error to `null`, and only that error.
|
|
22
27
|
* - A host failure throws `storage_unavailable`. Everything the host returns is parsed with Zod
|
|
23
28
|
* before it is handed back.
|
|
24
29
|
*/
|
|
@@ -31,11 +36,11 @@ export interface StorageBackend {
|
|
|
31
36
|
repoInfo(name: RepoName): Promise<StorageRepoInfo | null>;
|
|
32
37
|
/** The commit a ref names, or null when the ref does not exist (always null in an empty repository). */
|
|
33
38
|
resolveRef(repo: RepoName, ref: StorageRef): Promise<Sha | null>;
|
|
34
|
-
/** A commit by id, or null when no commit has that id. */
|
|
39
|
+
/** A commit by id, or null when no commit has that id (also when the id names a tree or a blob). */
|
|
35
40
|
readCommit(repo: RepoName, sha: Sha): Promise<Commit | null>;
|
|
36
|
-
/** One level of a tree by id, in stored order, or null when no tree has that id. */
|
|
41
|
+
/** One level of a tree by id, in stored order, or null when no tree has that id (also when it names a commit or a blob). */
|
|
37
42
|
readTree(repo: RepoName, sha: Sha): Promise<StorageTreeEntry[] | null>;
|
|
38
|
-
/** A blob's bytes by id, or null when no blob has that id. */
|
|
43
|
+
/** A blob's bytes by id, or null when no blob has that id (also when it names a commit or a tree). */
|
|
39
44
|
readBlob(repo: RepoName, sha: Sha): Promise<Uint8Array | null>;
|
|
40
45
|
/** A file's bytes at a revision, or null when the revision or the file does not exist. */
|
|
41
46
|
readFile(repo: RepoName, ref: Revision, path: FilePath): Promise<Uint8Array | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leed-ai/git-gateway-contract",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-next.20261122230525",
|
|
4
4
|
"description": "Zod schemas and the RPC interface of git-gateway (the API contract), with an in-memory reference implementation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare-workers",
|
|
@@ -21,6 +21,11 @@ import type { StorageTreeEntry } from './storage-tree-entry.ts';
|
|
|
21
21
|
* - Every call on a repository that does not exist throws `repo_not_found`, except
|
|
22
22
|
* {@link repoInfo} (null) and {@link deleteRepo} (no-op).
|
|
23
23
|
* - A missing object, ref or path is `null` (an empty array for {@link log}), never an error.
|
|
24
|
+
* - So is an id that names an object of another kind: {@link readCommit} of a tree or a blob,
|
|
25
|
+
* {@link readTree} of a commit or a blob, {@link readBlob} of a commit or a tree, and a
|
|
26
|
+
* revision naming a tree or a blob. Each read answers whether an object of its kind has that
|
|
27
|
+
* id, so a caller may try one kind after another; a backend whose host refuses such a read with
|
|
28
|
+
* an error maps that error to `null`, and only that error.
|
|
24
29
|
* - A host failure throws `storage_unavailable`. Everything the host returns is parsed with Zod
|
|
25
30
|
* before it is handed back.
|
|
26
31
|
*/
|
|
@@ -34,11 +39,11 @@ export interface StorageBackend {
|
|
|
34
39
|
|
|
35
40
|
/** The commit a ref names, or null when the ref does not exist (always null in an empty repository). */
|
|
36
41
|
resolveRef(repo: RepoName, ref: StorageRef): Promise<Sha | null>;
|
|
37
|
-
/** A commit by id, or null when no commit has that id. */
|
|
42
|
+
/** A commit by id, or null when no commit has that id (also when the id names a tree or a blob). */
|
|
38
43
|
readCommit(repo: RepoName, sha: Sha): Promise<Commit | null>;
|
|
39
|
-
/** One level of a tree by id, in stored order, or null when no tree has that id. */
|
|
44
|
+
/** One level of a tree by id, in stored order, or null when no tree has that id (also when it names a commit or a blob). */
|
|
40
45
|
readTree(repo: RepoName, sha: Sha): Promise<StorageTreeEntry[] | null>;
|
|
41
|
-
/** A blob's bytes by id, or null when no blob has that id. */
|
|
46
|
+
/** A blob's bytes by id, or null when no blob has that id (also when it names a commit or a tree). */
|
|
42
47
|
readBlob(repo: RepoName, sha: Sha): Promise<Uint8Array | null>;
|
|
43
48
|
/** A file's bytes at a revision, or null when the revision or the file does not exist. */
|
|
44
49
|
readFile(repo: RepoName, ref: Revision, path: FilePath): Promise<Uint8Array | null>;
|