@mhalle/vost 0.9.6 → 0.9.10
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 +12 -0
- package/dist/batch.d.ts +2 -1
- package/dist/batch.js +4 -2
- package/dist/batch.js.map +1 -1
- package/dist/copy.d.ts +4 -0
- package/dist/copy.js +6 -6
- package/dist/copy.js.map +1 -1
- package/dist/fs.d.ts +30 -2
- package/dist/fs.js +63 -9
- package/dist/fs.js.map +1 -1
- package/dist/gitstore.d.ts +79 -8
- package/dist/gitstore.js +132 -6
- package/dist/gitstore.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mirror.d.ts +16 -4
- package/dist/mirror.js +226 -76
- package/dist/mirror.js.map +1 -1
- package/package.json +1 -1
package/dist/gitstore.js
CHANGED
|
@@ -5,6 +5,7 @@ import * as nodeFs from 'node:fs';
|
|
|
5
5
|
import git from 'isomorphic-git';
|
|
6
6
|
import { RefDict } from './refdict.js';
|
|
7
7
|
import { NoteDict } from './notes.js';
|
|
8
|
+
import { FS } from './fs.js';
|
|
8
9
|
/**
|
|
9
10
|
* A versioned filesystem backed by a bare git repository.
|
|
10
11
|
*
|
|
@@ -29,6 +30,116 @@ export class GitStore {
|
|
|
29
30
|
this.tags = new RefDict(this, 'refs/tags/');
|
|
30
31
|
this.notes = new NoteDict(this);
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Get an FS snapshot for any ref (branch, tag, or commit hash).
|
|
35
|
+
*
|
|
36
|
+
* Resolution order: branches → tags → commit hash.
|
|
37
|
+
* Writable for branches, read-only for tags and hashes.
|
|
38
|
+
*
|
|
39
|
+
* @param ref - Branch name, tag name, or commit hash.
|
|
40
|
+
* @param opts.back - Walk back N ancestor commits (default 0).
|
|
41
|
+
* @returns FS snapshot for the resolved ref.
|
|
42
|
+
* @throws {KeyNotFoundError} If the ref cannot be resolved.
|
|
43
|
+
*/
|
|
44
|
+
async fs(ref, opts) {
|
|
45
|
+
let result;
|
|
46
|
+
if (await this.branches.has(ref)) {
|
|
47
|
+
result = await this.branches.get(ref);
|
|
48
|
+
}
|
|
49
|
+
else if (await this.tags.has(ref)) {
|
|
50
|
+
result = await this.tags.get(ref);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// Try as commit hash
|
|
54
|
+
try {
|
|
55
|
+
result = await FS._fromCommit(this, ref, null, false);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
const { KeyNotFoundError } = await import('./types.js');
|
|
59
|
+
throw new KeyNotFoundError(`ref not found: '${ref}'`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const back = opts?.back ?? 0;
|
|
63
|
+
if (back) {
|
|
64
|
+
result = await result.back(back);
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Pack loose objects into a packfile.
|
|
70
|
+
*
|
|
71
|
+
* Not implemented in the TypeScript port — isomorphic-git does not
|
|
72
|
+
* expose object database or packing APIs.
|
|
73
|
+
*
|
|
74
|
+
* @throws {Error} Always throws "not implemented".
|
|
75
|
+
*/
|
|
76
|
+
async pack() {
|
|
77
|
+
throw new Error('pack() is not implemented in the TypeScript port');
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Run garbage collection.
|
|
81
|
+
*
|
|
82
|
+
* Not implemented in the TypeScript port — isomorphic-git does not
|
|
83
|
+
* expose object database or packing APIs.
|
|
84
|
+
*
|
|
85
|
+
* @throws {Error} Always throws "not implemented".
|
|
86
|
+
*/
|
|
87
|
+
async gc() {
|
|
88
|
+
throw new Error('gc() is not implemented in the TypeScript port');
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Read raw blob data by hash, bypassing tree/ref resolution.
|
|
92
|
+
* Direct object store lookup — the fastest path to blob data.
|
|
93
|
+
*
|
|
94
|
+
* @param hash - 40-char hex SHA of the blob.
|
|
95
|
+
* @param opts - Optional read options.
|
|
96
|
+
* @param opts.offset - Byte offset to start reading from.
|
|
97
|
+
* @param opts.size - Maximum bytes to return (undefined for all).
|
|
98
|
+
* @returns Raw blob contents as Uint8Array.
|
|
99
|
+
*/
|
|
100
|
+
async readByHash(hash, opts) {
|
|
101
|
+
const { blob } = await git.readBlob({ fs: this._fsModule, gitdir: this._gitdir, oid: hash });
|
|
102
|
+
if (opts && (opts.offset !== undefined || opts.size !== undefined)) {
|
|
103
|
+
const offset = opts.offset ?? 0;
|
|
104
|
+
const end = opts.size !== undefined ? offset + opts.size : blob.length;
|
|
105
|
+
return blob.subarray(offset, end);
|
|
106
|
+
}
|
|
107
|
+
return blob;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Check if a blob with the given hash exists in the object store.
|
|
111
|
+
*
|
|
112
|
+
* @param hash - 40-char hex SHA of the blob.
|
|
113
|
+
* @returns true if the blob exists, false otherwise.
|
|
114
|
+
*/
|
|
115
|
+
async hasHash(hash) {
|
|
116
|
+
try {
|
|
117
|
+
await this.readByHash(hash, { size: 0 });
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/** @internal Apply compression and bigFileThreshold config to the repository. */
|
|
125
|
+
async _applyConfig(compression, bigFileThreshold) {
|
|
126
|
+
if (compression !== undefined) {
|
|
127
|
+
await git.setConfig({
|
|
128
|
+
fs: this._fsModule,
|
|
129
|
+
gitdir: this._gitdir,
|
|
130
|
+
path: 'core.compression',
|
|
131
|
+
value: compression,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
if (bigFileThreshold !== undefined) {
|
|
135
|
+
await git.setConfig({
|
|
136
|
+
fs: this._fsModule,
|
|
137
|
+
gitdir: this._gitdir,
|
|
138
|
+
path: 'core.bigFileThreshold',
|
|
139
|
+
value: bigFileThreshold,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
32
143
|
toString() {
|
|
33
144
|
return `GitStore('${this._gitdir}')`;
|
|
34
145
|
}
|
|
@@ -41,6 +152,8 @@ export class GitStore {
|
|
|
41
152
|
* @param opts.branch - Initial branch when creating (default: "main"). Null for no branch.
|
|
42
153
|
* @param opts.author - Default author name (default: "vost").
|
|
43
154
|
* @param opts.email - Default author email (default: "vost@localhost").
|
|
155
|
+
* @param opts.compression - Zlib compression level for git objects (0-9). Undefined uses the git default.
|
|
156
|
+
* @param opts.bigFileThreshold - Blobs larger than this (bytes) skip delta compression. 0 = all blobs skip deltas.
|
|
44
157
|
*/
|
|
45
158
|
static async open(path, opts = {}) {
|
|
46
159
|
const fsModule = opts.fs ?? nodeFs;
|
|
@@ -48,6 +161,8 @@ export class GitStore {
|
|
|
48
161
|
const branch = opts.branch !== undefined ? opts.branch : 'main';
|
|
49
162
|
const author = opts.author ?? 'vost';
|
|
50
163
|
const email = opts.email ?? 'vost@localhost';
|
|
164
|
+
const compression = opts.compression;
|
|
165
|
+
const bigFileThreshold = opts.bigFileThreshold;
|
|
51
166
|
// Check if repo exists
|
|
52
167
|
let exists = false;
|
|
53
168
|
try {
|
|
@@ -56,7 +171,9 @@ export class GitStore {
|
|
|
56
171
|
}
|
|
57
172
|
catch { /* not found */ }
|
|
58
173
|
if (exists) {
|
|
59
|
-
|
|
174
|
+
const store = new GitStore(fsModule, path, author, email);
|
|
175
|
+
await store._applyConfig(compression, bigFileThreshold);
|
|
176
|
+
return store;
|
|
60
177
|
}
|
|
61
178
|
if (!create) {
|
|
62
179
|
throw new Error(`Repository not found: ${path}`);
|
|
@@ -64,6 +181,7 @@ export class GitStore {
|
|
|
64
181
|
// Create bare repo
|
|
65
182
|
await git.init({ fs: fsModule, gitdir: path, bare: true });
|
|
66
183
|
const store = new GitStore(fsModule, path, author, email);
|
|
184
|
+
await store._applyConfig(compression, bigFileThreshold);
|
|
67
185
|
if (branch !== null) {
|
|
68
186
|
// Create initial empty commit on the branch
|
|
69
187
|
const emptyTreeOid = await git.writeTree({ fs: fsModule, gitdir: path, tree: [] });
|
|
@@ -108,7 +226,9 @@ export class GitStore {
|
|
|
108
226
|
* @param opts.http - HTTP client (required for HTTP URLs only).
|
|
109
227
|
* @param opts.dryRun - Compute diff without pushing.
|
|
110
228
|
* @param opts.onAuth - Optional authentication callback.
|
|
111
|
-
* @param opts.refs - Only backup these refs
|
|
229
|
+
* @param opts.refs - Only backup these refs. Pass a `string[]` for identity
|
|
230
|
+
* mapping or a `Record<string, string>` to rename refs on transfer
|
|
231
|
+
* (keys = source names, values = destination names).
|
|
112
232
|
* @param opts.format - Force format: `'bundle'` for git bundle output.
|
|
113
233
|
* @returns A MirrorDiff describing what changed (or would change).
|
|
114
234
|
*/
|
|
@@ -130,7 +250,9 @@ export class GitStore {
|
|
|
130
250
|
* @param opts.http - HTTP client (required for HTTP URLs only).
|
|
131
251
|
* @param opts.dryRun - Compute diff without fetching.
|
|
132
252
|
* @param opts.onAuth - Optional authentication callback.
|
|
133
|
-
* @param opts.refs - Only restore these refs
|
|
253
|
+
* @param opts.refs - Only restore these refs. Pass a `string[]` for identity
|
|
254
|
+
* mapping or a `Record<string, string>` to rename refs on transfer
|
|
255
|
+
* (keys = source names, values = destination names).
|
|
134
256
|
* @param opts.format - Force format: `'bundle'` for git bundle input.
|
|
135
257
|
* @returns A MirrorDiff describing what changed (or would change).
|
|
136
258
|
*/
|
|
@@ -142,17 +264,21 @@ export class GitStore {
|
|
|
142
264
|
* Export refs to a bundle file.
|
|
143
265
|
*
|
|
144
266
|
* @param path - Destination `.bundle` file path.
|
|
145
|
-
* @param opts.refs - Only export these refs
|
|
267
|
+
* @param opts.refs - Only export these refs. Pass a `string[]` for identity
|
|
268
|
+
* mapping or a `Record<string, string>` to rename refs in the bundle
|
|
269
|
+
* (keys = local names, values = bundle names).
|
|
146
270
|
*/
|
|
147
271
|
async bundleExport(path, opts = {}) {
|
|
148
272
|
const { bundleExport } = await import('./mirror.js');
|
|
149
|
-
return bundleExport(this, path, opts.refs);
|
|
273
|
+
return bundleExport(this, path, opts.refs, opts.squash);
|
|
150
274
|
}
|
|
151
275
|
/**
|
|
152
276
|
* Import refs from a bundle file (additive — no deletes).
|
|
153
277
|
*
|
|
154
278
|
* @param path - Source `.bundle` file path.
|
|
155
|
-
* @param opts.refs - Only import these refs
|
|
279
|
+
* @param opts.refs - Only import these refs. Pass a `string[]` for identity
|
|
280
|
+
* mapping or a `Record<string, string>` to rename refs on import
|
|
281
|
+
* (keys = bundle names, values = local names).
|
|
156
282
|
*/
|
|
157
283
|
async bundleImport(path, opts = {}) {
|
|
158
284
|
const { bundleImport } = await import('./mirror.js');
|
package/dist/gitstore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitstore.js","sourceRoot":"","sources":["../src/gitstore.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,GAAG,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"gitstore.js","sourceRoot":"","sources":["../src/gitstore.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,GAAG,MAAM,gBAAgB,CAAC;AAGjC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,OAAO,QAAQ;IACnB,gBAAgB,CAAC,SAAS,CAAW;IACrC,gBAAgB,CAAC,OAAO,CAAS;IACjC,gBAAgB,CAAC,UAAU,CAAY;IACvC,oCAAoC;IACpC,QAAQ,CAAU;IAClB,gCAAgC;IAChC,IAAI,CAAU;IACd,4BAA4B;IAC5B,KAAK,CAAW;IAEhB,YAAY,QAAkB,EAAE,MAAc,EAAE,MAAc,EAAE,KAAa;QAC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AAM,CAAC,aAAa,CAAC,CAAC;QAChD,OAAO,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,YAAY,CAChB,IAAY,EACZ,OAA6C,EAAE;QAE/C,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;QACrD,OAAO,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,YAAY,CAChB,IAAY,EACZ,OAA2B,EAAE;QAE7B,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;QACrD,OAAO,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7C,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export { FsWriter, BatchWriter } from './fileobj.js';
|
|
|
30
30
|
export { RefDict } from './refdict.js';
|
|
31
31
|
export { NoteDict, NoteNamespace, NotesBatch } from './notes.js';
|
|
32
32
|
export { FileType, fileTypeFromMode, fileModeFromType, MODE_BLOB, MODE_BLOB_EXEC, MODE_LINK, MODE_TREE, GitStoreError, StaleSnapshotError, FileNotFoundError, IsADirectoryError, NotADirectoryError, PermissionError, KeyNotFoundError, KeyExistsError, InvalidRefNameError, InvalidPathError, BatchClosedError, type WalkEntry, type WriteEntry, type StatResult, type FileEntry, type ChangeAction, type ChangeError, type ChangeReport, type RefChange, type MirrorDiff, type CommitInfo, type ReflogEntry, type Signature, type FsModule, type HttpClient, emptyChangeReport, changeReportInSync, changeReportTotal, changeReportActions, mirrorDiffInSync, mirrorDiffTotal, } from './types.js';
|
|
33
|
-
export { resolveCredentials, bundleExport, bundleImport } from './mirror.js';
|
|
33
|
+
export { resolveCredentials, bundleExport, bundleImport, type RefSpec } from './mirror.js';
|
|
34
34
|
export { diskGlob } from './copy.js';
|
|
35
35
|
export { ExcludeFilter } from './exclude.js';
|
|
36
36
|
export { normalizePath, validateRefName } from './paths.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,eAAe;AACf,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjE,4BAA4B;AAC5B,OAAO;AACL,qBAAqB;AACrB,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,SAAS,EACT,SAAS;AAET,SAAS;AACT,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB;AAkBhB,uBAAuB;AACvB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB;AAEnB,qBAAqB;AACrB,gBAAgB,EAChB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,mBAAmB;AACnB,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,eAAe;AACf,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjE,4BAA4B;AAC5B,OAAO;AACL,qBAAqB;AACrB,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,SAAS,EACT,SAAS;AAET,SAAS;AACT,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB;AAkBhB,uBAAuB;AACvB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB;AAEnB,qBAAqB;AACrB,gBAAgB,EAChB,eAAe,GAChB,MAAM,YAAY,CAAC;AAEpB,mBAAmB;AACnB,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAgB,MAAM,aAAa,CAAC;AAE3F,sCAAsC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/mirror.d.ts
CHANGED
|
@@ -7,8 +7,19 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { MirrorDiff, HttpClient } from './types.js';
|
|
9
9
|
import type { GitStore } from './gitstore.js';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Ref specification for backup/restore/bundle operations.
|
|
12
|
+
*
|
|
13
|
+
* - `string[]` — identity mapping (source name = destination name).
|
|
14
|
+
* - `Record<string, string>` — keys are source ref names, values are
|
|
15
|
+
* destination ref names (allows renaming on transfer).
|
|
16
|
+
*
|
|
17
|
+
* Short names (e.g. `"main"`) are resolved against available refs using
|
|
18
|
+
* the standard branches → tags → notes precedence.
|
|
19
|
+
*/
|
|
20
|
+
export type RefSpec = string[] | Record<string, string>;
|
|
21
|
+
export declare function bundleExport(store: GitStore, destPath: string, refs?: RefSpec, squash?: boolean): Promise<void>;
|
|
22
|
+
export declare function bundleImport(store: GitStore, bundlePath: string, refs?: RefSpec): Promise<void>;
|
|
12
23
|
/**
|
|
13
24
|
* Inject credentials into an HTTPS URL if available.
|
|
14
25
|
*
|
|
@@ -43,8 +54,9 @@ export declare function backup(store: GitStore, url: string, opts?: {
|
|
|
43
54
|
http?: HttpClient;
|
|
44
55
|
dryRun?: boolean;
|
|
45
56
|
onAuth?: Function;
|
|
46
|
-
refs?:
|
|
57
|
+
refs?: RefSpec;
|
|
47
58
|
format?: string;
|
|
59
|
+
squash?: boolean;
|
|
48
60
|
}): Promise<MirrorDiff>;
|
|
49
61
|
/**
|
|
50
62
|
* Fetch refs from url additively into the local store.
|
|
@@ -65,6 +77,6 @@ export declare function restore(store: GitStore, url: string, opts?: {
|
|
|
65
77
|
http?: HttpClient;
|
|
66
78
|
dryRun?: boolean;
|
|
67
79
|
onAuth?: Function;
|
|
68
|
-
refs?:
|
|
80
|
+
refs?: RefSpec;
|
|
69
81
|
format?: string;
|
|
70
82
|
}): Promise<MirrorDiff>;
|