git-fs-s3 0.4.0 → 0.6.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.
Files changed (63) hide show
  1. package/README.md +23 -17
  2. package/dist/{chunk-YQFNY6PG.js → chunk-FIFWOMPM.js} +1 -1
  3. package/dist/chunk-FIFWOMPM.js.map +1 -0
  4. package/dist/{chunk-Z4656PGE.js → chunk-XNSZTA4Y.js} +3 -3
  5. package/dist/{chunk-Z4656PGE.js.map → chunk-XNSZTA4Y.js.map} +1 -1
  6. package/dist/http.js +8 -8
  7. package/dist/http.js.map +1 -1
  8. package/dist/index.js +2 -3
  9. package/dist/index.js.map +1 -1
  10. package/dist/ops.js +15 -18
  11. package/dist/ops.js.map +1 -1
  12. package/dist/types/cache.d.ts +81 -0
  13. package/dist/types/edge-utils.d.ts +43 -0
  14. package/dist/types/errors.d.ts +16 -0
  15. package/dist/types/git-errors.d.ts +70 -0
  16. package/dist/types/git-fs.d.ts +60 -0
  17. package/dist/types/git-layout.d.ts +52 -0
  18. package/dist/types/http/index.d.ts +7 -0
  19. package/dist/types/http/info-refs.d.ts +28 -0
  20. package/dist/types/http/pack-reuse.d.ts +26 -0
  21. package/dist/types/http/pkt-line.d.ts +14 -0
  22. package/dist/types/http/reachability.d.ts +36 -0
  23. package/dist/types/http/receive-pack.d.ts +55 -0
  24. package/dist/types/http/repack.d.ts +24 -0
  25. package/dist/types/http/types.d.ts +40 -0
  26. package/dist/types/http/upload-pack.d.ts +21 -0
  27. package/dist/types/index.d.ts +11 -0
  28. package/dist/types/ops/branch.d.ts +38 -0
  29. package/dist/types/ops/commit.d.ts +45 -0
  30. package/dist/types/ops/diff.d.ts +24 -0
  31. package/dist/types/ops/file-history.d.ts +41 -0
  32. package/dist/types/ops/history.d.ts +86 -0
  33. package/dist/types/ops/index.d.ts +9 -0
  34. package/dist/types/ops/last-commit.d.ts +23 -0
  35. package/dist/types/ops/merge.d.ts +28 -0
  36. package/dist/types/ops/tree.d.ts +19 -0
  37. package/dist/{types-BHoHOaQt.d.cts → types/ops/types.d.ts} +7 -9
  38. package/dist/types/pack-files.d.ts +28 -0
  39. package/dist/types/path.d.ts +9 -0
  40. package/dist/types/refs.d.ts +54 -0
  41. package/dist/types/retry.d.ts +52 -0
  42. package/dist/types/stores/memory.d.ts +16 -0
  43. package/dist/{s3.d.ts → types/stores/s3.d.ts} +4 -7
  44. package/dist/{types-dbHzZ4ed.d.ts → types/types.d.ts} +11 -22
  45. package/package.json +18 -22
  46. package/dist/chunk-YQFNY6PG.js.map +0 -1
  47. package/dist/http.cjs +0 -1063
  48. package/dist/http.cjs.map +0 -1
  49. package/dist/http.d.cts +0 -215
  50. package/dist/http.d.ts +0 -215
  51. package/dist/index.cjs +0 -944
  52. package/dist/index.cjs.map +0 -1
  53. package/dist/index.d.cts +0 -479
  54. package/dist/index.d.ts +0 -479
  55. package/dist/ops.cjs +0 -1060
  56. package/dist/ops.cjs.map +0 -1
  57. package/dist/ops.d.cts +0 -302
  58. package/dist/ops.d.ts +0 -302
  59. package/dist/s3.cjs +0 -123
  60. package/dist/s3.cjs.map +0 -1
  61. package/dist/s3.d.cts +0 -36
  62. package/dist/types-BHoHOaQt.d.ts +0 -53
  63. package/dist/types-dbHzZ4ed.d.cts +0 -131
package/dist/index.d.ts DELETED
@@ -1,479 +0,0 @@
1
- import { O as ObjectStore, G as GitFsClient, a as GitdirFacts, b as GitFsOptions, c as ObjectStat, L as ListOptions, d as ListResult } from './types-dbHzZ4ed.js';
2
- export { S as Stat } from './types-dbHzZ4ed.js';
3
-
4
- interface CacheOptions {
5
- /** Maximum bytes of object data held in memory. Default 50 MiB. */
6
- maxBytes?: number;
7
- /**
8
- * Largest single entry admitted to the cache. Defaults to a tenth of
9
- * `maxBytes` so one huge packfile cannot evict the whole working set.
10
- */
11
- maxEntryBytes?: number;
12
- /** Entry time-to-live in milliseconds. Default 60 000. */
13
- ttlMs?: number;
14
- /**
15
- * Override the TTL for a specific key (get/head) or list prefix (list),
16
- * in milliseconds. Return `undefined` to fall back to `ttlMs`. Git refs
17
- * (`refs/heads/<branch>`, `HEAD`) are mutable — the same key's value
18
- * changes on every push — unlike content-addressed object keys, which
19
- * never change for a given key and are safe to cache for the full
20
- * `ttlMs`. Without this, a long `ttlMs` tuned for objects also caches
21
- * ref reads that long, so a warm process can keep serving a
22
- * pre-push ref value for the rest of that TTL even though nothing
23
- * changed *this* process's own cache (see `invalidate`) — it just never
24
- * knew to. Give ref-like keys a short override (a few seconds) instead:
25
- * a ref read is one small object, so re-reading it far more often than
26
- * `ttlMs` is cheap, and every read downstream of a fresh ref (tree,
27
- * commit, blob — all keyed by the sha it resolves to) still gets the
28
- * full-length cache/coalescing benefit.
29
- */
30
- ttlForKey?: (key: string) => number | undefined;
31
- /**
32
- * Also cache "key does not exist" results. Loose-object probes on packed
33
- * repositories are almost always misses, so this saves many round trips —
34
- * but only enable it when a single process is the only writer, otherwise
35
- * another instance's push can be masked for up to `ttlMs`.
36
- */
37
- cacheMisses?: boolean;
38
- /**
39
- * Also cache `list()` results (directory listings and `limit: 1`
40
- * existence probes). Writes through this store keep cached listings
41
- * consistent; after writing to the backend by any other means, call
42
- * `invalidate()` with the affected prefix. Default false.
43
- */
44
- cacheLists?: boolean;
45
- /**
46
- * Collapse concurrent `get`/`head`/`list` calls for the same key into a
47
- * single backend request. Default true.
48
- */
49
- coalesce?: boolean;
50
- /**
51
- * Return defensive copies from `get` (and copy on admit), so a caller
52
- * mutating returned bytes can't corrupt the cache. Default true. Set
53
- * false when no reader mutates results (isomorphic-git doesn't): every
54
- * hit otherwise copies the whole entry, which for packfiles is megabytes
55
- * per read.
56
- */
57
- copy?: boolean;
58
- /** Called when a read is answered from cache. */
59
- onHit?: (key: string) => void;
60
- /** Called when a read has to go to the backing store. */
61
- onMiss?: (key: string) => void;
62
- }
63
- /** An {@link ObjectStore} wrapper that also supports explicit invalidation. */
64
- interface CachedObjectStore extends ObjectStore {
65
- /**
66
- * Drop every cached entry — contents, misses, and listings — whose key
67
- * falls under `prefix` (exact keys included). Call this after the backing
68
- * store was modified by something other than this wrapper.
69
- */
70
- invalidate(prefix: string): void;
71
- }
72
- /**
73
- * Wrap an {@link ObjectStore} with an in-process LRU read cache.
74
- *
75
- * Git object keys are content-addressed and therefore immutable, which makes
76
- * them ideal cache entries; mutable keys (refs, packed-refs) are bounded by
77
- * `ttlMs`. Writes and deletes through this wrapper invalidate their key and
78
- * any cached listings they affect — with one asymmetry: a non-empty `limit: 1`
79
- * probe (a "directory exists" answer) survives writes underneath it, because
80
- * adding a key below a prefix cannot make that prefix stop existing, while
81
- * empty probes and full listings are always dropped.
82
- */
83
- declare function createCachedStore(store: ObjectStore, options?: CacheOptions): CachedObjectStore;
84
-
85
- /**
86
- * Edge-compatible utilities replacing node:crypto, node:zlib, and Buffer.
87
- *
88
- * Every function here uses only Web APIs (SubtleCrypto, CompressionStream,
89
- * TextEncoder/TextDecoder) — no Node built-ins. They work on Cloudflare
90
- * Workers, Vercel Edge, Deno Deploy, and Node >= 18.
91
- */
92
- /**
93
- * Encode a UTF-8 string to bytes.
94
- *
95
- * Return type pinned to `Uint8Array<ArrayBuffer>` (not the bare `Uint8Array`,
96
- * whose default type argument differs across TypeScript versions) so it's
97
- * always assignable to Fetch API `BodyInit` regardless of a consumer's own
98
- * TypeScript/lib version.
99
- */
100
- declare function encodeUtf8(data: string): Uint8Array<ArrayBuffer>;
101
- /** Decode bytes as UTF-8. */
102
- declare function decodeUtf8(data: Uint8Array): string;
103
- /** Decode bytes as ASCII. */
104
- declare function decodeAscii(data: Uint8Array): string;
105
- /** Concatenate any number of Uint8Arrays into one. */
106
- declare function concat(...parts: Uint8Array[]): Uint8Array<ArrayBuffer>;
107
- /** Uint8Array → lowercase hex string. */
108
- declare function toHex(data: Uint8Array): string;
109
- /** Uint8Array → base64 string. */
110
- declare function toBase64(data: Uint8Array): string;
111
- /** Hex string → Uint8Array. */
112
- declare function fromHex(hex: string): Uint8Array<ArrayBuffer>;
113
- /** SHA-1 hash via Web Crypto API. Returns a hex string. */
114
- declare function sha1(data: Uint8Array | string): Promise<string>;
115
- /**
116
- * Deflate compress via the CompressionStream Web API.
117
- * Falls back to throwing if CompressionStream is unavailable (very old runtimes).
118
- */
119
- declare function deflate(data: Uint8Array): Promise<Uint8Array<ArrayBuffer>>;
120
- /** Check if a Uint8Array contains a null byte. */
121
- declare function hasNullByte(data: Uint8Array): boolean;
122
- /**
123
- * Read a blob as text or binary metadata — the edge-compatible replacement
124
- * for the `Buffer.from(blob)` pattern used throughout diff.ts and history.ts.
125
- */
126
- declare function readBlobContent(blob: Uint8Array): {
127
- isBinary: boolean;
128
- text: string;
129
- bytes: Uint8Array;
130
- };
131
-
132
- /**
133
- * Node-style filesystem error carrying a `code` property, which is what
134
- * isomorphic-git inspects to distinguish "file not found" from real failures.
135
- */
136
- declare class FsError extends Error {
137
- readonly code: string;
138
- readonly syscall: string;
139
- readonly path: string;
140
- constructor(code: string, syscall: string, path: string);
141
- }
142
-
143
- /**
144
- * Git-server error types carrying an HTTP status and a retryability flag, so
145
- * transport layers can map internal failures to responses without inspecting
146
- * messages. Extend {@link GitError} for app-specific cases (storage backends,
147
- * quota, …) and {@link formatErrorResponse} keeps working for them.
148
- */
149
- declare class GitError extends Error {
150
- statusCode: number;
151
- retryable: boolean;
152
- constructor(message: string, statusCode?: number, retryable?: boolean);
153
- toJSON(): Record<string, unknown>;
154
- }
155
- /** A file/directory path not found within a tree (404). */
156
- declare class GitPathNotFoundError extends GitError {
157
- constructor(message: string);
158
- }
159
- /** A git object not found (404). */
160
- declare class GitObjectNotFoundError extends GitError {
161
- constructor(message: string);
162
- }
163
- /** A ref (branch/tag) not found (404). */
164
- declare class GitRefNotFoundError extends GitError {
165
- constructor(message: string);
166
- }
167
- /** The repository itself not found (404). */
168
- declare class GitRepositoryNotFoundError extends GitError {
169
- constructor(message: string);
170
- }
171
- interface MergeConflictDetail {
172
- file: string;
173
- baseLines?: string[];
174
- sourceLines?: string[];
175
- targetLines?: string[];
176
- }
177
- /** A merge conflict (409), carrying per-file conflict detail. */
178
- declare class GitConflictError extends GitError {
179
- conflicts: MergeConflictDetail[];
180
- constructor(message: string, conflicts?: MergeConflictDetail[]);
181
- toJSON(): Record<string, unknown>;
182
- }
183
- /** Authentication failed (401). */
184
- declare class GitAuthenticationError extends GitError {
185
- constructor(message: string);
186
- }
187
- /** Authorization failed (403). */
188
- declare class GitAuthorizationError extends GitError {
189
- constructor(message: string);
190
- }
191
- /** Too many failed attempts (429). */
192
- declare class GitRateLimitError extends GitError {
193
- constructor(message: string);
194
- }
195
- /** Malformed request (400). */
196
- declare class GitInvalidRequestError extends GitError {
197
- constructor(message: string);
198
- }
199
- /** Git wire-protocol violation (400). */
200
- declare class GitProtocolError extends GitError {
201
- constructor(message: string);
202
- }
203
- /**
204
- * Map any error to an HTTP response shape. 401s carry the WWW-Authenticate
205
- * header git clients need before they will prompt for credentials. Non-GitError
206
- * failures are masked as opaque 500s — internal messages don't leak.
207
- */
208
- declare function formatErrorResponse(error: unknown): {
209
- status: number;
210
- body: Record<string, unknown>;
211
- headers?: Record<string, string>;
212
- };
213
-
214
- /**
215
- * The filesystem returned by {@link createGitFs}: the isomorphic-git client
216
- * plus git-aware maintenance hooks.
217
- */
218
- interface GitFs extends GitFsClient {
219
- /**
220
- * Return every file below a directory in one object-store listing. Unlike
221
- * `readdir`, this deliberately does not use a delimiter: object storage can
222
- * enumerate a ref namespace recursively without the stat-per-entry walk a
223
- * POSIX filesystem needs to distinguish files from implicit directories.
224
- * Paths are relative to `dirpath` and never include directory entries.
225
- */
226
- listFilesRecursively(dirpath: string): Promise<string[]>;
227
- /**
228
- * Probe, with one bounded list, whether `gitdir` contains any loose
229
- * objects, and remember the answer. This is the only way a loose-object
230
- * hint is ever created; call it before full-history walks (commit logs,
231
- * reachability traversals) so fully packed repositories skip every
232
- * guaranteed-miss loose-object read. A later loose write flips the hint
233
- * back, so it cannot go stale mid-push.
234
- */
235
- detectLooseObjects(gitdir: string): Promise<void>;
236
- /**
237
- * Warm the cache with every pack file under `gitdir` in parallel (plus
238
- * the loose-object hint) before a sequential history walk. Skipped when
239
- * the pack directory holds more than `maxPacks * 2` entries — warming
240
- * only helps when the cache budget actually fits the packs.
241
- */
242
- prefetchPacks(gitdir: string, options?: {
243
- maxPacks?: number;
244
- }): Promise<void>;
245
- /**
246
- * Clear fs-level state (loose-object hints) under `pathPrefix`, and
247
- * forward to the store's `invalidate` when it has one. Call after the
248
- * backing store was modified by something other than this fs.
249
- */
250
- invalidate(pathPrefix: string): void;
251
- /**
252
- * Declare that `gitdir` exists, so `stat` answers "directory" for it with
253
- * zero store calls. isomorphic-git stats the gitdir on every command
254
- * (`discoverGitdir`); in object storage that is a HEAD that always misses
255
- * plus a listing. Register once the caller has confirmed the repository
256
- * exists by other means (e.g. its database row); `invalidate` forgets it.
257
- */
258
- registerGitdir(gitdir: string, facts?: GitdirFacts): void;
259
- }
260
- /**
261
- * Create a promise-based filesystem client for isomorphic-git backed by an
262
- * {@link ObjectStore}.
263
- *
264
- * Semantics:
265
- * - Directories are implicit, as in object storage: `mkdir` is a no-op and a
266
- * directory "exists" whenever at least one key lives under its prefix.
267
- * - Symbolic links are not supported (`readlink`/`symlink` throw). Bare
268
- * repositories never contain them.
269
- * - Designed for bare, server-side repositories (`git.init({bare: true})`,
270
- * plumbing commands, ref updates). Worktree checkouts belong on a real disk.
271
- */
272
- declare function createGitFs(store: ObjectStore, options?: GitFsOptions): GitFs;
273
-
274
- /**
275
- * Typed view of a git `objects/pack` directory listing.
276
- *
277
- * Every pack is a set of sibling files sharing one base name
278
- * (`pack-<hash>.pack`, `.idx`, and optionally `.keep`/`.bitmap`/`.rev`).
279
- * Parsing names once into {@link PackFileName} lets callers group, filter and
280
- * rename by kind instead of re-matching filename strings at each call site.
281
- *
282
- * Edge-compatible: no node: imports.
283
- */
284
- /** Every file kind git writes into `objects/pack`. */
285
- declare const PACK_FILE_KINDS: readonly ["pack", "idx", "keep", "bitmap", "rev"];
286
- type PackFileKind = (typeof PACK_FILE_KINDS)[number];
287
- /** Kinds isomorphic-git actually reads; the rest are git-CLI accelerators. */
288
- declare const READABLE_PACK_FILE_KINDS: ReadonlySet<PackFileKind>;
289
- interface PackFileName {
290
- /** Shared base of a pack's sibling files, e.g. `pack-1a2b…`. */
291
- readonly base: string;
292
- readonly kind: PackFileKind;
293
- /** The file name as listed, e.g. `pack-1a2b….idx`. */
294
- readonly name: string;
295
- }
296
- /** Parse a pack-directory entry; `null` for anything git didn't put there. */
297
- declare function parsePackFileName(name: string): PackFileName | null;
298
- /** File name of the `kind` sibling of the pack with this base name. */
299
- declare function packFileName(base: string, kind: PackFileKind): string;
300
- /** Parse a directory listing, dropping entries that aren't pack files. */
301
- declare function parsePackDirectory(entries: readonly string[]): PackFileName[];
302
-
303
- /**
304
- * Typed classification of paths inside a git directory, so callers can
305
- * reason about "a ref", "a loose object" or "the pack listing" as values
306
- * instead of matching path strings against patterns.
307
- *
308
- * Edge-compatible: no node: imports.
309
- */
310
-
311
- /** What a gitdir-relative path refers to. Listing prefixes end in `/`. */
312
- type GitdirEntry = {
313
- readonly kind: "head";
314
- } | {
315
- readonly kind: "config";
316
- }
317
- /** A ref file (`refs/heads/main`) or a refs listing (`refs/heads/`). */
318
- | {
319
- readonly kind: "refs";
320
- readonly path: string;
321
- }
322
- /** The `objects/` listing. */
323
- | {
324
- readonly kind: "objects-dir";
325
- }
326
- /** The `objects/pack/` listing. */
327
- | {
328
- readonly kind: "pack-dir";
329
- } | {
330
- readonly kind: "pack-file";
331
- readonly file: PackFileName;
332
- } | {
333
- readonly kind: "loose-object";
334
- readonly oid: string;
335
- } | {
336
- readonly kind: "other";
337
- };
338
- /** Classify a path relative to a gitdir (no leading slash). */
339
- declare function classifyGitdirPath(path: string): GitdirEntry;
340
- /**
341
- * Whether reads of this entry can change between pushes: refs, `HEAD`, and
342
- * the object/pack listings. Everything else is content-addressed (objects)
343
- * or written once (config, a given pack file name).
344
- */
345
- declare function isMutableGitdirEntry(entry: GitdirEntry): boolean;
346
- /**
347
- * A loose-object path anywhere in the fs, split into its gitdir and oid —
348
- * for callers that don't know where the gitdir boundary is: a loose object
349
- * is always `<gitdir>/objects/<2 hex>/<38 hex>`.
350
- */
351
- declare function parseLooseObjectPath(path: string): {
352
- readonly gitdir: string;
353
- readonly oid: string;
354
- } | null;
355
-
356
- /**
357
- * Git ref-name validation, mirroring isomorphic-git's own internal `isValidRef`
358
- * character-class rules (the check `git.branch` and top-level `git.writeRef`
359
- * run before touching disk).
360
- *
361
- * Several of isomorphic-git's OTHER ref-touching primitives — `git.commit`,
362
- * `git.merge`, `git.deleteBranch`, and top-level `git.resolveRef`/
363
- * `git.deleteRef` — do NOT run this check internally: they resolve straight
364
- * through `fs.write`/`fs.rm(join(gitdir, ref))` with no jail to the gitdir.
365
- * On a shared-storage server (many repos under one prefix or base directory),
366
- * every branch/ref name that originates from request input must be validated
367
- * against these predicates before it reaches any of those primitives —
368
- * otherwise a `"../"`-laden name lets a caller with write access to any single
369
- * repo read, corrupt, or delete another repo's ref/object files.
370
- */
371
- /** Validates a fully-qualified ref (must start with refs/heads/ or refs/tags/). */
372
- declare function isSafeFullRefName(ref: string): boolean;
373
- /**
374
- * Validates a bare branch name (no refs/ prefix). Rejects anything that looks
375
- * like a full ref path — a name of `"refs/heads/x"` would otherwise sail
376
- * through unprefixed at call sites that build `refs/heads/${name}` themselves
377
- * (doubling the prefix into something that still resolves), or be used as-is
378
- * at call sites that pass a name already containing `"refs/"` straight
379
- * through. Also rejects 40-hex SHA-shaped values so a stored branch name can
380
- * never be ambiguous with a commit SHA at write time; use
381
- * {@link isSafeRefName} on read paths that accept both shapes.
382
- */
383
- declare function isSafeBranchName(name: string): boolean;
384
- /** True for a full 40-hex-char commit SHA — the shape {@link isSafeBranchName} deliberately rejects. */
385
- declare function isFullSha(value: string): boolean;
386
- /**
387
- * Validates a "ref" field that may name either a branch or a commit SHA it's
388
- * pinned to — the shape read-path route params take (permalinks, raw links).
389
- * Both shapes still go through the traversal check.
390
- */
391
- declare function isSafeRefName(value: string): boolean;
392
- /**
393
- * Validates a repo-relative file path from request input: relative, no `..`
394
- * segments, no `.git/` prefix, no null bytes. Use this anywhere a path
395
- * segment comes straight off a URL or form field rather than re-deriving the
396
- * checks ad hoc.
397
- */
398
- declare function isSafeRepoPath(p: string): boolean;
399
- /**
400
- * Qualify a bare branch name to `refs/heads/<name>` before handing it to
401
- * isomorphic-git. `resolveRef`/`expand` try several candidate paths in
402
- * sequence for a bare name — `ref`, `refs/ref`, `refs/tags/ref`,
403
- * `refs/heads/ref`, … — missing (and, against object storage, paying a real
404
- * round trip for) the first three every time. For a branch-only ref model,
405
- * skip straight to the winner. Left untouched: already-qualified refs,
406
- * `"HEAD"` (its own first candidate, already optimal), and 40-hex oids
407
- * (resolved locally by isomorphic-git with no I/O at all).
408
- */
409
- declare function qualifyBranchRef(ref: string): string;
410
-
411
- /** Options accepted by {@link createRetryStore}. */
412
- interface RetryOptions {
413
- /** Retries after the first attempt (total attempts = retries + 1). Default 3. */
414
- retries?: number;
415
- /** Backoff base delay in milliseconds, doubled each attempt. Default 100. */
416
- initialDelayMs?: number;
417
- /** Upper bound for the backoff base delay. Default 5000. */
418
- maxDelayMs?: number;
419
- /** Random jitter added to each delay, as a fraction of it. Default 0.3. */
420
- jitter?: number;
421
- /**
422
- * Decide whether an error is worth retrying. The store contract maps
423
- * "not found" to `null` rather than throwing, so any thrown error is a
424
- * genuine failure; the default retries network faults, throttling, and
425
- * HTTP 5xx responses.
426
- */
427
- isRetryable?: (error: unknown) => boolean;
428
- /**
429
- * Circuit breaker configuration, or `false` to disable. After `threshold`
430
- * consecutive failures the store fails fast for `resetMs`, then lets one
431
- * request probe the backend again. Defaults: 5 failures, 30 000 ms.
432
- */
433
- breaker?: false | {
434
- threshold?: number;
435
- resetMs?: number;
436
- };
437
- /** Called before each retry sleep; useful for logging/metrics. */
438
- onRetry?: (info: {
439
- key: string;
440
- op: string;
441
- attempt: number;
442
- delayMs: number;
443
- }) => void;
444
- }
445
- /**
446
- * Thrown instead of calling the backend while the circuit breaker is open.
447
- * Carries `code: "EUNAVAILABLE"` so callers can map it to a 503.
448
- */
449
- declare class CircuitOpenError extends Error {
450
- readonly code = "EUNAVAILABLE";
451
- constructor();
452
- }
453
- /**
454
- * Wrap an {@link ObjectStore} with retries (exponential backoff + jitter) and
455
- * an optional per-instance circuit breaker.
456
- *
457
- * Place this decorator closest to the network store, underneath any cache:
458
- * the cache then never stores transient failures, and callers coalesced onto
459
- * one request share a single retried attempt.
460
- */
461
- declare function createRetryStore(store: ObjectStore, options?: RetryOptions): ObjectStore;
462
-
463
- /**
464
- * In-memory {@link ObjectStore}. Useful for tests, examples, and ephemeral
465
- * repositories; also the reference implementation for the list/delimiter
466
- * semantics other stores must match.
467
- */
468
- declare class MemoryObjectStore implements ObjectStore {
469
- private readonly objects;
470
- get(key: string): Promise<Uint8Array | null>;
471
- put(key: string, data: Uint8Array): Promise<void>;
472
- delete(key: string): Promise<void>;
473
- head(key: string): Promise<ObjectStat | null>;
474
- list(prefix: string, options?: ListOptions): Promise<ListResult>;
475
- /** Number of stored objects (test convenience, not part of ObjectStore). */
476
- get size(): number;
477
- }
478
-
479
- export { type CacheOptions, type CachedObjectStore, CircuitOpenError, FsError, GitAuthenticationError, GitAuthorizationError, GitConflictError, GitError, type GitFs, GitFsClient, GitFsOptions, GitInvalidRequestError, GitObjectNotFoundError, GitPathNotFoundError, GitProtocolError, GitRateLimitError, GitRefNotFoundError, GitRepositoryNotFoundError, type GitdirEntry, GitdirFacts, ListOptions, ListResult, MemoryObjectStore, type MergeConflictDetail, ObjectStat, ObjectStore, PACK_FILE_KINDS, type PackFileKind, type PackFileName, READABLE_PACK_FILE_KINDS, type RetryOptions, classifyGitdirPath, concat, createCachedStore, createGitFs, createRetryStore, decodeAscii, decodeUtf8, deflate, encodeUtf8, formatErrorResponse, fromHex, hasNullByte, isFullSha, isMutableGitdirEntry, isSafeBranchName, isSafeFullRefName, isSafeRefName, isSafeRepoPath, packFileName, parseLooseObjectPath, parsePackDirectory, parsePackFileName, qualifyBranchRef, readBlobContent, sha1, toBase64, toHex };