git-fs-s3 0.8.0 → 0.10.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/README.md +22 -3
- package/dist/http.js +5 -3
- package/dist/http.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ops.js +265 -232
- package/dist/ops.js.map +1 -1
- package/dist/types/errors.d.ts +0 -1
- package/dist/types/http/index.d.ts +2 -2
- package/dist/types/http/pack-reuse.d.ts +2 -1
- package/dist/types/ops/diff.d.ts +22 -5
- package/dist/types/ops/file-history.d.ts +4 -18
- package/dist/types/ops/history.d.ts +30 -43
- package/dist/types/ops/index.d.ts +5 -4
- package/dist/types/ops/last-commit.d.ts +2 -8
- package/dist/types/ops/submodules.d.ts +13 -0
- package/dist/types/ops/tree.d.ts +1 -1
- package/dist/types/ops/types.d.ts +10 -16
- package/package.json +2 -2
|
@@ -1,36 +1,35 @@
|
|
|
1
1
|
import { type TreeEntry } from "./tree.js";
|
|
2
2
|
import { type OpsHooks, type Repo } from "./types.js";
|
|
3
|
+
/** How far back history walks look by default (commit count). */
|
|
4
|
+
export declare const HISTORY_WALK_DEPTH = 400;
|
|
5
|
+
export interface GitIdentity {
|
|
6
|
+
name: string;
|
|
7
|
+
email: string;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
timezoneOffset: number;
|
|
10
|
+
}
|
|
3
11
|
export interface CommitInfo {
|
|
4
12
|
oid: string;
|
|
5
13
|
commit: {
|
|
6
14
|
message: string;
|
|
7
15
|
tree: string;
|
|
8
16
|
parent: string[];
|
|
9
|
-
author:
|
|
10
|
-
|
|
11
|
-
email: string;
|
|
12
|
-
timestamp: number;
|
|
13
|
-
timezoneOffset: number;
|
|
14
|
-
};
|
|
15
|
-
committer: {
|
|
16
|
-
name: string;
|
|
17
|
-
email: string;
|
|
18
|
-
timestamp: number;
|
|
19
|
-
timezoneOffset: number;
|
|
20
|
-
};
|
|
17
|
+
author: GitIdentity;
|
|
18
|
+
committer: GitIdentity;
|
|
21
19
|
};
|
|
22
20
|
payload: string;
|
|
23
21
|
}
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
/** The display summary of a commit (history lists, "last commit" columns). */
|
|
23
|
+
export interface CommitSummary {
|
|
24
|
+
sha: string;
|
|
25
|
+
message: string;
|
|
26
|
+
authorName: string;
|
|
27
|
+
authorEmail: string;
|
|
28
|
+
/** ISO 8601 author date. */
|
|
29
|
+
createdAt: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function summarizeCommit(commit: CommitInfo): CommitSummary;
|
|
32
|
+
/** Resolve a branch name / full ref / sha to its commit. */
|
|
34
33
|
export declare function resolveCommit(repo: Repo, ref: string): Promise<{
|
|
35
34
|
oid: string;
|
|
36
35
|
commit: import("isomorphic-git").CommitObject;
|
|
@@ -44,40 +43,28 @@ export declare function getCommit(repo: Repo, sha: string): Promise<CommitInfo>;
|
|
|
44
43
|
export interface CommitLogOptions {
|
|
45
44
|
ref: string;
|
|
46
45
|
depth?: number;
|
|
47
|
-
/**
|
|
48
|
-
* Pass the head sha when the caller already resolved `ref` — resolveRef
|
|
49
|
-
* tries several candidate paths in sequence and misses the first few every
|
|
50
|
-
* time for a normal branch name, which is pure waste when the sha is known.
|
|
51
|
-
*/
|
|
46
|
+
/** The ref's commit, when the caller already resolved it (saves a lookup). */
|
|
52
47
|
knownHeadSha?: string;
|
|
53
48
|
}
|
|
54
49
|
/**
|
|
55
|
-
* The commit chain from a ref, newest first
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* repeated requests — don't bypass this by calling `git.log` directly.
|
|
50
|
+
* The commit chain from a ref, newest first; [] when the ref doesn't exist.
|
|
51
|
+
* Walking is sequential and round-trip-bound on object storage, so the
|
|
52
|
+
* deepest walk seen per head is memoized in `hooks.resultCache` and sliced
|
|
53
|
+
* for shallower requests.
|
|
60
54
|
*/
|
|
61
55
|
export declare function getCommitLog(repo: Repo, options: CommitLogOptions, hooks?: OpsHooks): Promise<CommitInfo[]>;
|
|
62
|
-
/** A file at a ref, decoded for display: utf8 text or base64 when binary. */
|
|
63
|
-
export declare function getFileFromRef(repo: Repo, filePath: string, ref: string, hooks?: OpsHooks): Promise<{
|
|
64
|
-
content: string;
|
|
65
|
-
size: number;
|
|
66
|
-
isBinary: boolean;
|
|
67
|
-
}>;
|
|
68
56
|
/**
|
|
69
57
|
* List a directory at the tip of a ref. Throws GitRefNotFoundError when the
|
|
70
|
-
* ref doesn't resolve
|
|
71
|
-
*
|
|
72
|
-
* head sha (auto-invalidates on push).
|
|
58
|
+
* ref doesn't resolve and GitPathNotFoundError when `treePath` doesn't exist.
|
|
59
|
+
* Memoized per head sha.
|
|
73
60
|
*/
|
|
74
61
|
export declare function getTreeFromRef(repo: Repo, options: {
|
|
75
62
|
ref: string;
|
|
76
63
|
treePath?: string;
|
|
77
64
|
}, hooks?: OpsHooks): Promise<TreeEntry[]>;
|
|
78
65
|
/**
|
|
79
|
-
* A page of commit history from a
|
|
80
|
-
*
|
|
66
|
+
* A page of commit history from a ref tip; [] when the ref doesn't exist.
|
|
67
|
+
* Pages are slices of {@link getCommitLog}'s memoized walk.
|
|
81
68
|
*/
|
|
82
69
|
export declare function getCommitHistory(repo: Repo, options: {
|
|
83
70
|
ref: string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { assertBranchExists, assertSafeBranchName, type Branch, createBranchFrom, deleteBranchByName, listBranches, resolveLooseRefFast, } from "./branch.js";
|
|
2
2
|
export { authorNow, type CommitAuthor, commitFilesToBare, deleteFileFromBare, writeCommitToBare, } from "./commit.js";
|
|
3
|
-
export { type DiffFile, type DiffResult, getCommitDiff, getDiffBetweenRefs, MAX_DIFF_TEXT_BYTES, } from "./diff.js";
|
|
4
|
-
export { BANNER_WALK_DEPTH, type
|
|
5
|
-
export { type CommitInfo, type CommitLogOptions, getBlob, getCommit, getCommitHistory, getCommitLog, getFileContent,
|
|
6
|
-
export { getLastCommitsForTree
|
|
3
|
+
export { type DiffEntry, type DiffFile, type DiffResult, getCommitDiff, getDiffBetweenRefs, MAX_DIFF_TEXT_BYTES, } from "./diff.js";
|
|
4
|
+
export { BANNER_WALK_DEPTH, type FileHistoryResult, getFileHistory, } from "./file-history.js";
|
|
5
|
+
export { type CommitInfo, type CommitLogOptions, type CommitSummary, type GitIdentity, getBlob, getCommit, getCommitHistory, getCommitLog, getFileContent, getTreeFromRef, HISTORY_WALK_DEPTH, resolveCommit, summarizeCommit, } from "./history.js";
|
|
6
|
+
export { getLastCommitsForTree } from "./last-commit.js";
|
|
7
7
|
export { analyzeMerge, fastForwardMerge, type MergeAnalysis } from "./merge.js";
|
|
8
8
|
export { withPackedWrites } from "./packed-writes.js";
|
|
9
|
+
export { getSubmodules, parseGitmodules, type SubmoduleConfig, } from "./submodules.js";
|
|
9
10
|
export { deleteFromTree, findTreeEntry, listTreeEntries, type TreeEntry, upsertTree, } from "./tree.js";
|
|
10
11
|
export { type IsoGitFs, type OpsHooks, type Repo, type ResultCache, resultKeyPrefixes, } from "./types.js";
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
+
import { type CommitSummary } from "./history.js";
|
|
1
2
|
import type { OpsHooks, Repo } from "./types.js";
|
|
2
|
-
export interface LastCommitInfo {
|
|
3
|
-
sha: string;
|
|
4
|
-
message: string;
|
|
5
|
-
authorName: string;
|
|
6
|
-
authorEmail: string;
|
|
7
|
-
createdAt: string;
|
|
8
|
-
}
|
|
9
3
|
/**
|
|
10
4
|
* For each direct child of `treePath` (at the tip of `ref`), find the most
|
|
11
5
|
* recent commit that changed it — the tree view's "last commit" column. Walks
|
|
@@ -20,4 +14,4 @@ export declare function getLastCommitsForTree(repo: Repo, options: {
|
|
|
20
14
|
ref: string;
|
|
21
15
|
treePath?: string;
|
|
22
16
|
depth?: number;
|
|
23
|
-
}, hooks?: OpsHooks): Promise<Record<string,
|
|
17
|
+
}, hooks?: OpsHooks): Promise<Record<string, CommitSummary>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OpsHooks, Repo } from "./types.js";
|
|
2
|
+
export interface SubmoduleConfig {
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Read only submodule path/url records. Never expands includes, executes Git
|
|
9
|
+
* commands, or fetches URLs. Ambiguous paths and malformed records are ignored.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseGitmodules(content: string): SubmoduleConfig[];
|
|
12
|
+
/** The root .gitmodules at this exact revision; absent/oversized config yields no links. */
|
|
13
|
+
export declare function getSubmodules(repo: Repo, ref: string, hooks?: OpsHooks): Promise<SubmoduleConfig[]>;
|
package/dist/types/ops/tree.d.ts
CHANGED
|
@@ -14,16 +14,16 @@ export interface Repo {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Key/value store for memoizing expensive walk results (commit logs, tree
|
|
17
|
-
* listings, per-
|
|
18
|
-
* so entries self-invalidate on push (new head, new key)
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* listings, per-path history). Keys are namespaced `kind:gitdir:headSha:…`,
|
|
18
|
+
* so entries self-invalidate on push (new head, new key); evict
|
|
19
|
+
* {@link resultKeyPrefixes} to drop a repo's superseded entries early.
|
|
20
|
+
* Values are always objects (arrays or records).
|
|
21
21
|
*/
|
|
22
22
|
export interface ResultCache {
|
|
23
|
-
get<T>(key: string): T | null | undefined;
|
|
24
|
-
set(key: string, value:
|
|
23
|
+
get<T extends object>(key: string): T | null | undefined;
|
|
24
|
+
set(key: string, value: object): void;
|
|
25
25
|
}
|
|
26
|
-
/** Optional instrumentation
|
|
26
|
+
/** Optional instrumentation hooks accepted by every op. */
|
|
27
27
|
export interface OpsHooks {
|
|
28
28
|
resultCache?: ResultCache;
|
|
29
29
|
/** Wrap a timed sub-step (network walk, tree listing). Default: run directly. */
|
|
@@ -31,21 +31,15 @@ export interface OpsHooks {
|
|
|
31
31
|
/** Diagnostic sink for cache hit/miss and walk summaries. */
|
|
32
32
|
onNote?: (message: string) => void;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
* walk doesn't
|
|
36
|
-
* history walks of depth >= `prefetchMinDepth` (see below), and
|
|
37
|
-
* unconditionally on every cache-miss tree read ({@link getTreeFromRef}) —
|
|
38
|
-
* a tree read has no shallow case, it always needs at least the head
|
|
39
|
-
* commit's tree object.
|
|
34
|
+
* Warm every pack (e.g. `GitFs.prefetchPacks`) before a cache-miss read,
|
|
35
|
+
* so a sequential walk doesn't discover packs one round trip at a time.
|
|
40
36
|
*/
|
|
41
37
|
prefetch?: () => Promise<void>;
|
|
42
|
-
/** Minimum walk depth before `prefetch` fires for history walks. Default 5. */
|
|
43
|
-
prefetchMinDepth?: number;
|
|
44
38
|
}
|
|
45
39
|
export declare const runStep: <T>(hooks: OpsHooks | undefined, label: string, fn: () => Promise<T>) => Promise<T>;
|
|
46
40
|
/**
|
|
47
41
|
* The result-cache key prefixes holding entries for `gitdir` — evict these
|
|
48
42
|
* from your {@link ResultCache} when the repo's storage was rewritten outside
|
|
49
|
-
* a normal push (
|
|
43
|
+
* a normal push (rename, repack).
|
|
50
44
|
*/
|
|
51
45
|
export declare function resultKeyPrefixes(gitdir: string): string[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-fs-s3",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "isomorphic-git filesystem backend for S3-compatible object storage (AWS S3, Cloudflare R2, MinIO)
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "isomorphic-git filesystem backend for S3-compatible object storage (AWS S3, Cloudflare R2, MinIO) — run git servers without a disk",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|