gitx.do 0.1.0 → 0.1.2
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 +40 -353
- package/dist/do/logger.d.ts +50 -0
- package/dist/do/logger.d.ts.map +1 -0
- package/dist/do/logger.js +122 -0
- package/dist/do/logger.js.map +1 -0
- package/dist/{durable-object → do}/schema.d.ts +3 -3
- package/dist/do/schema.d.ts.map +1 -0
- package/dist/{durable-object → do}/schema.js +4 -3
- package/dist/do/schema.js.map +1 -0
- package/dist/do/types.d.ts +267 -0
- package/dist/do/types.d.ts.map +1 -0
- package/dist/do/types.js +62 -0
- package/dist/do/types.js.map +1 -0
- package/dist/index.d.ts +15 -415
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -483
- package/dist/index.js.map +1 -1
- package/package.json +13 -21
- package/dist/cli/commands/add.d.ts +0 -174
- package/dist/cli/commands/add.d.ts.map +0 -1
- package/dist/cli/commands/add.js +0 -131
- package/dist/cli/commands/add.js.map +0 -1
- package/dist/cli/commands/blame.d.ts +0 -259
- package/dist/cli/commands/blame.d.ts.map +0 -1
- package/dist/cli/commands/blame.js +0 -609
- package/dist/cli/commands/blame.js.map +0 -1
- package/dist/cli/commands/branch.d.ts +0 -249
- package/dist/cli/commands/branch.d.ts.map +0 -1
- package/dist/cli/commands/branch.js +0 -693
- package/dist/cli/commands/branch.js.map +0 -1
- package/dist/cli/commands/commit.d.ts +0 -182
- package/dist/cli/commands/commit.d.ts.map +0 -1
- package/dist/cli/commands/commit.js +0 -437
- package/dist/cli/commands/commit.js.map +0 -1
- package/dist/cli/commands/diff.d.ts +0 -464
- package/dist/cli/commands/diff.d.ts.map +0 -1
- package/dist/cli/commands/diff.js +0 -958
- package/dist/cli/commands/diff.js.map +0 -1
- package/dist/cli/commands/log.d.ts +0 -239
- package/dist/cli/commands/log.d.ts.map +0 -1
- package/dist/cli/commands/log.js +0 -535
- package/dist/cli/commands/log.js.map +0 -1
- package/dist/cli/commands/merge.d.ts +0 -106
- package/dist/cli/commands/merge.d.ts.map +0 -1
- package/dist/cli/commands/merge.js +0 -55
- package/dist/cli/commands/merge.js.map +0 -1
- package/dist/cli/commands/review.d.ts +0 -457
- package/dist/cli/commands/review.d.ts.map +0 -1
- package/dist/cli/commands/review.js +0 -533
- package/dist/cli/commands/review.js.map +0 -1
- package/dist/cli/commands/status.d.ts +0 -269
- package/dist/cli/commands/status.d.ts.map +0 -1
- package/dist/cli/commands/status.js +0 -493
- package/dist/cli/commands/status.js.map +0 -1
- package/dist/cli/commands/web.d.ts +0 -199
- package/dist/cli/commands/web.d.ts.map +0 -1
- package/dist/cli/commands/web.js +0 -696
- package/dist/cli/commands/web.js.map +0 -1
- package/dist/cli/fs-adapter.d.ts +0 -656
- package/dist/cli/fs-adapter.d.ts.map +0 -1
- package/dist/cli/fs-adapter.js +0 -1179
- package/dist/cli/fs-adapter.js.map +0 -1
- package/dist/cli/fsx-cli-adapter.d.ts +0 -359
- package/dist/cli/fsx-cli-adapter.d.ts.map +0 -1
- package/dist/cli/fsx-cli-adapter.js +0 -619
- package/dist/cli/fsx-cli-adapter.js.map +0 -1
- package/dist/cli/index.d.ts +0 -387
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -523
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/ui/components/DiffView.d.ts +0 -7
- package/dist/cli/ui/components/DiffView.d.ts.map +0 -1
- package/dist/cli/ui/components/DiffView.js +0 -11
- package/dist/cli/ui/components/DiffView.js.map +0 -1
- package/dist/cli/ui/components/ErrorDisplay.d.ts +0 -6
- package/dist/cli/ui/components/ErrorDisplay.d.ts.map +0 -1
- package/dist/cli/ui/components/ErrorDisplay.js +0 -11
- package/dist/cli/ui/components/ErrorDisplay.js.map +0 -1
- package/dist/cli/ui/components/FuzzySearch.d.ts +0 -9
- package/dist/cli/ui/components/FuzzySearch.d.ts.map +0 -1
- package/dist/cli/ui/components/FuzzySearch.js +0 -12
- package/dist/cli/ui/components/FuzzySearch.js.map +0 -1
- package/dist/cli/ui/components/LoadingSpinner.d.ts +0 -6
- package/dist/cli/ui/components/LoadingSpinner.d.ts.map +0 -1
- package/dist/cli/ui/components/LoadingSpinner.js +0 -10
- package/dist/cli/ui/components/LoadingSpinner.js.map +0 -1
- package/dist/cli/ui/components/NavigationList.d.ts +0 -9
- package/dist/cli/ui/components/NavigationList.d.ts.map +0 -1
- package/dist/cli/ui/components/NavigationList.js +0 -11
- package/dist/cli/ui/components/NavigationList.js.map +0 -1
- package/dist/cli/ui/components/ScrollableContent.d.ts +0 -8
- package/dist/cli/ui/components/ScrollableContent.d.ts.map +0 -1
- package/dist/cli/ui/components/ScrollableContent.js +0 -11
- package/dist/cli/ui/components/ScrollableContent.js.map +0 -1
- package/dist/cli/ui/components/index.d.ts +0 -7
- package/dist/cli/ui/components/index.d.ts.map +0 -1
- package/dist/cli/ui/components/index.js +0 -9
- package/dist/cli/ui/components/index.js.map +0 -1
- package/dist/cli/ui/terminal-ui.d.ts +0 -52
- package/dist/cli/ui/terminal-ui.d.ts.map +0 -1
- package/dist/cli/ui/terminal-ui.js +0 -121
- package/dist/cli/ui/terminal-ui.js.map +0 -1
- package/dist/do/BashModule.d.ts +0 -871
- package/dist/do/BashModule.d.ts.map +0 -1
- package/dist/do/BashModule.js +0 -1143
- package/dist/do/BashModule.js.map +0 -1
- package/dist/do/FsModule.d.ts +0 -601
- package/dist/do/FsModule.d.ts.map +0 -1
- package/dist/do/FsModule.js +0 -1120
- package/dist/do/FsModule.js.map +0 -1
- package/dist/do/GitModule.d.ts +0 -635
- package/dist/do/GitModule.d.ts.map +0 -1
- package/dist/do/GitModule.js +0 -781
- package/dist/do/GitModule.js.map +0 -1
- package/dist/do/GitRepoDO.d.ts +0 -281
- package/dist/do/GitRepoDO.d.ts.map +0 -1
- package/dist/do/GitRepoDO.js +0 -479
- package/dist/do/GitRepoDO.js.map +0 -1
- package/dist/do/bash-ast.d.ts +0 -246
- package/dist/do/bash-ast.d.ts.map +0 -1
- package/dist/do/bash-ast.js +0 -888
- package/dist/do/bash-ast.js.map +0 -1
- package/dist/do/container-executor.d.ts +0 -491
- package/dist/do/container-executor.d.ts.map +0 -1
- package/dist/do/container-executor.js +0 -730
- package/dist/do/container-executor.js.map +0 -1
- package/dist/do/index.d.ts +0 -53
- package/dist/do/index.d.ts.map +0 -1
- package/dist/do/index.js +0 -91
- package/dist/do/index.js.map +0 -1
- package/dist/do/tiered-storage.d.ts +0 -403
- package/dist/do/tiered-storage.d.ts.map +0 -1
- package/dist/do/tiered-storage.js +0 -689
- package/dist/do/tiered-storage.js.map +0 -1
- package/dist/do/withBash.d.ts +0 -231
- package/dist/do/withBash.d.ts.map +0 -1
- package/dist/do/withBash.js +0 -244
- package/dist/do/withBash.js.map +0 -1
- package/dist/do/withFs.d.ts +0 -237
- package/dist/do/withFs.d.ts.map +0 -1
- package/dist/do/withFs.js +0 -387
- package/dist/do/withFs.js.map +0 -1
- package/dist/do/withGit.d.ts +0 -180
- package/dist/do/withGit.d.ts.map +0 -1
- package/dist/do/withGit.js +0 -271
- package/dist/do/withGit.js.map +0 -1
- package/dist/durable-object/object-store.d.ts +0 -633
- package/dist/durable-object/object-store.d.ts.map +0 -1
- package/dist/durable-object/object-store.js +0 -1161
- package/dist/durable-object/object-store.js.map +0 -1
- package/dist/durable-object/schema.d.ts.map +0 -1
- package/dist/durable-object/schema.js.map +0 -1
- package/dist/durable-object/wal.d.ts +0 -416
- package/dist/durable-object/wal.d.ts.map +0 -1
- package/dist/durable-object/wal.js +0 -445
- package/dist/durable-object/wal.js.map +0 -1
- package/dist/mcp/adapter.d.ts +0 -772
- package/dist/mcp/adapter.d.ts.map +0 -1
- package/dist/mcp/adapter.js +0 -895
- package/dist/mcp/adapter.js.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts +0 -22
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.js +0 -140
- package/dist/mcp/sandbox/miniflare-evaluator.js.map +0 -1
- package/dist/mcp/sandbox/object-store-proxy.d.ts +0 -32
- package/dist/mcp/sandbox/object-store-proxy.d.ts.map +0 -1
- package/dist/mcp/sandbox/object-store-proxy.js +0 -30
- package/dist/mcp/sandbox/object-store-proxy.js.map +0 -1
- package/dist/mcp/sandbox/template.d.ts +0 -17
- package/dist/mcp/sandbox/template.d.ts.map +0 -1
- package/dist/mcp/sandbox/template.js +0 -71
- package/dist/mcp/sandbox/template.js.map +0 -1
- package/dist/mcp/sandbox.d.ts +0 -764
- package/dist/mcp/sandbox.d.ts.map +0 -1
- package/dist/mcp/sandbox.js +0 -1362
- package/dist/mcp/sandbox.js.map +0 -1
- package/dist/mcp/sdk-adapter.d.ts +0 -835
- package/dist/mcp/sdk-adapter.d.ts.map +0 -1
- package/dist/mcp/sdk-adapter.js +0 -974
- package/dist/mcp/sdk-adapter.js.map +0 -1
- package/dist/mcp/tools/do.d.ts +0 -32
- package/dist/mcp/tools/do.d.ts.map +0 -1
- package/dist/mcp/tools/do.js +0 -115
- package/dist/mcp/tools/do.js.map +0 -1
- package/dist/mcp/tools.d.ts +0 -548
- package/dist/mcp/tools.d.ts.map +0 -1
- package/dist/mcp/tools.js +0 -1934
- package/dist/mcp/tools.js.map +0 -1
- package/dist/ops/blame.d.ts +0 -551
- package/dist/ops/blame.d.ts.map +0 -1
- package/dist/ops/blame.js +0 -1037
- package/dist/ops/blame.js.map +0 -1
- package/dist/ops/branch.d.ts +0 -766
- package/dist/ops/branch.d.ts.map +0 -1
- package/dist/ops/branch.js +0 -950
- package/dist/ops/branch.js.map +0 -1
- package/dist/ops/commit-traversal.d.ts +0 -349
- package/dist/ops/commit-traversal.d.ts.map +0 -1
- package/dist/ops/commit-traversal.js +0 -821
- package/dist/ops/commit-traversal.js.map +0 -1
- package/dist/ops/commit.d.ts +0 -555
- package/dist/ops/commit.d.ts.map +0 -1
- package/dist/ops/commit.js +0 -826
- package/dist/ops/commit.js.map +0 -1
- package/dist/ops/merge-base.d.ts +0 -397
- package/dist/ops/merge-base.d.ts.map +0 -1
- package/dist/ops/merge-base.js +0 -691
- package/dist/ops/merge-base.js.map +0 -1
- package/dist/ops/merge.d.ts +0 -855
- package/dist/ops/merge.d.ts.map +0 -1
- package/dist/ops/merge.js +0 -1551
- package/dist/ops/merge.js.map +0 -1
- package/dist/ops/tag.d.ts +0 -247
- package/dist/ops/tag.d.ts.map +0 -1
- package/dist/ops/tag.js +0 -649
- package/dist/ops/tag.js.map +0 -1
- package/dist/ops/tree-builder.d.ts +0 -178
- package/dist/ops/tree-builder.d.ts.map +0 -1
- package/dist/ops/tree-builder.js +0 -271
- package/dist/ops/tree-builder.js.map +0 -1
- package/dist/ops/tree-diff.d.ts +0 -291
- package/dist/ops/tree-diff.d.ts.map +0 -1
- package/dist/ops/tree-diff.js +0 -705
- package/dist/ops/tree-diff.js.map +0 -1
- package/dist/pack/delta.d.ts +0 -248
- package/dist/pack/delta.d.ts.map +0 -1
- package/dist/pack/delta.js +0 -736
- package/dist/pack/delta.js.map +0 -1
- package/dist/pack/format.d.ts +0 -446
- package/dist/pack/format.d.ts.map +0 -1
- package/dist/pack/format.js +0 -572
- package/dist/pack/format.js.map +0 -1
- package/dist/pack/full-generation.d.ts +0 -612
- package/dist/pack/full-generation.d.ts.map +0 -1
- package/dist/pack/full-generation.js +0 -1378
- package/dist/pack/full-generation.js.map +0 -1
- package/dist/pack/generation.d.ts +0 -441
- package/dist/pack/generation.d.ts.map +0 -1
- package/dist/pack/generation.js +0 -707
- package/dist/pack/generation.js.map +0 -1
- package/dist/pack/index.d.ts +0 -502
- package/dist/pack/index.d.ts.map +0 -1
- package/dist/pack/index.js +0 -833
- package/dist/pack/index.js.map +0 -1
- package/dist/refs/branch.d.ts +0 -668
- package/dist/refs/branch.d.ts.map +0 -1
- package/dist/refs/branch.js +0 -897
- package/dist/refs/branch.js.map +0 -1
- package/dist/refs/storage.d.ts +0 -833
- package/dist/refs/storage.d.ts.map +0 -1
- package/dist/refs/storage.js +0 -1023
- package/dist/refs/storage.js.map +0 -1
- package/dist/refs/tag.d.ts +0 -860
- package/dist/refs/tag.d.ts.map +0 -1
- package/dist/refs/tag.js +0 -996
- package/dist/refs/tag.js.map +0 -1
- package/dist/storage/backend.d.ts +0 -425
- package/dist/storage/backend.d.ts.map +0 -1
- package/dist/storage/backend.js +0 -41
- package/dist/storage/backend.js.map +0 -1
- package/dist/storage/fsx-adapter.d.ts +0 -204
- package/dist/storage/fsx-adapter.d.ts.map +0 -1
- package/dist/storage/fsx-adapter.js +0 -470
- package/dist/storage/fsx-adapter.js.map +0 -1
- package/dist/storage/lru-cache.d.ts +0 -691
- package/dist/storage/lru-cache.d.ts.map +0 -1
- package/dist/storage/lru-cache.js +0 -813
- package/dist/storage/lru-cache.js.map +0 -1
- package/dist/storage/object-index.d.ts +0 -585
- package/dist/storage/object-index.d.ts.map +0 -1
- package/dist/storage/object-index.js +0 -532
- package/dist/storage/object-index.js.map +0 -1
- package/dist/storage/r2-pack.d.ts +0 -1257
- package/dist/storage/r2-pack.d.ts.map +0 -1
- package/dist/storage/r2-pack.js +0 -1770
- package/dist/storage/r2-pack.js.map +0 -1
- package/dist/tiered/cdc-pipeline.d.ts +0 -1888
- package/dist/tiered/cdc-pipeline.d.ts.map +0 -1
- package/dist/tiered/cdc-pipeline.js +0 -1880
- package/dist/tiered/cdc-pipeline.js.map +0 -1
- package/dist/tiered/migration.d.ts +0 -1104
- package/dist/tiered/migration.d.ts.map +0 -1
- package/dist/tiered/migration.js +0 -1214
- package/dist/tiered/migration.js.map +0 -1
- package/dist/tiered/parquet-writer.d.ts +0 -1145
- package/dist/tiered/parquet-writer.d.ts.map +0 -1
- package/dist/tiered/parquet-writer.js +0 -1183
- package/dist/tiered/parquet-writer.js.map +0 -1
- package/dist/tiered/read-path.d.ts +0 -835
- package/dist/tiered/read-path.d.ts.map +0 -1
- package/dist/tiered/read-path.js +0 -487
- package/dist/tiered/read-path.js.map +0 -1
- package/dist/types/capability.d.ts +0 -1385
- package/dist/types/capability.d.ts.map +0 -1
- package/dist/types/capability.js +0 -36
- package/dist/types/capability.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -18
- package/dist/types/index.js.map +0 -1
- package/dist/types/objects.d.ts +0 -692
- package/dist/types/objects.d.ts.map +0 -1
- package/dist/types/objects.js +0 -837
- package/dist/types/objects.js.map +0 -1
- package/dist/types/storage.d.ts +0 -603
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types/storage.js +0 -191
- package/dist/types/storage.js.map +0 -1
- package/dist/types/worker-loader.d.ts +0 -60
- package/dist/types/worker-loader.d.ts.map +0 -1
- package/dist/types/worker-loader.js +0 -62
- package/dist/types/worker-loader.js.map +0 -1
- package/dist/utils/hash.d.ts +0 -197
- package/dist/utils/hash.d.ts.map +0 -1
- package/dist/utils/hash.js +0 -268
- package/dist/utils/hash.js.map +0 -1
- package/dist/utils/sha1.d.ts +0 -290
- package/dist/utils/sha1.d.ts.map +0 -1
- package/dist/utils/sha1.js +0 -582
- package/dist/utils/sha1.js.map +0 -1
- package/dist/wire/capabilities.d.ts +0 -1044
- package/dist/wire/capabilities.d.ts.map +0 -1
- package/dist/wire/capabilities.js +0 -941
- package/dist/wire/capabilities.js.map +0 -1
- package/dist/wire/path-security.d.ts +0 -157
- package/dist/wire/path-security.d.ts.map +0 -1
- package/dist/wire/path-security.js +0 -307
- package/dist/wire/path-security.js.map +0 -1
- package/dist/wire/pkt-line.d.ts +0 -345
- package/dist/wire/pkt-line.d.ts.map +0 -1
- package/dist/wire/pkt-line.js +0 -381
- package/dist/wire/pkt-line.js.map +0 -1
- package/dist/wire/receive-pack.d.ts +0 -1059
- package/dist/wire/receive-pack.d.ts.map +0 -1
- package/dist/wire/receive-pack.js +0 -1414
- package/dist/wire/receive-pack.js.map +0 -1
- package/dist/wire/smart-http.d.ts +0 -799
- package/dist/wire/smart-http.d.ts.map +0 -1
- package/dist/wire/smart-http.js +0 -945
- package/dist/wire/smart-http.js.map +0 -1
- package/dist/wire/upload-pack.d.ts +0 -727
- package/dist/wire/upload-pack.d.ts.map +0 -1
- package/dist/wire/upload-pack.js +0 -1138
- package/dist/wire/upload-pack.js.map +0 -1
|
@@ -1,727 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Git upload-pack Protocol Implementation
|
|
3
|
-
*
|
|
4
|
-
* This module implements the server-side of Git's upload-pack service, which is
|
|
5
|
-
* used by `git-fetch` and `git-clone` to retrieve objects from a remote repository.
|
|
6
|
-
*
|
|
7
|
-
* @module wire/upload-pack
|
|
8
|
-
*
|
|
9
|
-
* ## Protocol Flow
|
|
10
|
-
*
|
|
11
|
-
* 1. **Ref Advertisement**: Server advertises available refs with capabilities
|
|
12
|
-
* 2. **Want Phase**: Client sends "want" lines for objects it needs
|
|
13
|
-
* 3. **Negotiation**: Client sends "have" lines, server responds with ACK/NAK
|
|
14
|
-
* 4. **Done**: Client signals negotiation complete with "done"
|
|
15
|
-
* 5. **Packfile**: Server generates and sends packfile with requested objects
|
|
16
|
-
*
|
|
17
|
-
* ## Features
|
|
18
|
-
*
|
|
19
|
-
* - Side-band multiplexing for progress reporting
|
|
20
|
-
* - Thin pack support for bandwidth efficiency
|
|
21
|
-
* - Shallow clone support with depth limiting
|
|
22
|
-
* - Multi-ack negotiation for optimal object transfer
|
|
23
|
-
*
|
|
24
|
-
* @see {@link https://git-scm.com/docs/protocol-v2} Git Protocol v2
|
|
25
|
-
* @see {@link https://git-scm.com/docs/pack-protocol} Git Pack Protocol
|
|
26
|
-
*
|
|
27
|
-
* @example Basic fetch operation
|
|
28
|
-
* ```typescript
|
|
29
|
-
* import { createSession, advertiseRefs, handleFetch } from './wire/upload-pack'
|
|
30
|
-
*
|
|
31
|
-
* // Create session and advertise refs
|
|
32
|
-
* const session = createSession('my-repo', await store.getRefs())
|
|
33
|
-
* const advertisement = await advertiseRefs(store)
|
|
34
|
-
*
|
|
35
|
-
* // Process fetch request
|
|
36
|
-
* const response = await handleFetch(session, requestBody, store)
|
|
37
|
-
* ```
|
|
38
|
-
*/
|
|
39
|
-
import type { ObjectType } from '../types/objects';
|
|
40
|
-
/**
|
|
41
|
-
* A reference (branch, tag, etc.) with its SHA and optional peeled value.
|
|
42
|
-
*
|
|
43
|
-
* @description
|
|
44
|
-
* Represents a Git reference that can be advertised to clients. For annotated
|
|
45
|
-
* tags, the `peeled` field contains the SHA of the underlying commit.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* const branch: Ref = {
|
|
50
|
-
* name: 'refs/heads/main',
|
|
51
|
-
* sha: 'abc123def456...'
|
|
52
|
-
* }
|
|
53
|
-
*
|
|
54
|
-
* const annotatedTag: Ref = {
|
|
55
|
-
* name: 'refs/tags/v1.0.0',
|
|
56
|
-
* sha: 'tag-object-sha...',
|
|
57
|
-
* peeled: 'target-commit-sha...'
|
|
58
|
-
* }
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
export interface Ref {
|
|
62
|
-
/** Full ref name (e.g., 'refs/heads/main', 'refs/tags/v1.0.0') */
|
|
63
|
-
name: string;
|
|
64
|
-
/** SHA-1 hash of the object this ref points to */
|
|
65
|
-
sha: string;
|
|
66
|
-
/** For annotated tags, the SHA of the target object (commit) */
|
|
67
|
-
peeled?: string;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Capabilities supported by the upload-pack service.
|
|
71
|
-
*
|
|
72
|
-
* @description
|
|
73
|
-
* These capabilities are advertised to clients and negotiated during the
|
|
74
|
-
* initial handshake. Clients select which capabilities to use based on
|
|
75
|
-
* what the server supports.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```typescript
|
|
79
|
-
* const caps: UploadPackCapabilities = {
|
|
80
|
-
* sideBand64k: true,
|
|
81
|
-
* thinPack: true,
|
|
82
|
-
* shallow: true,
|
|
83
|
-
* includeTag: true,
|
|
84
|
-
* multiAckDetailed: true,
|
|
85
|
-
* agent: 'my-server/1.0'
|
|
86
|
-
* }
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
export interface UploadPackCapabilities {
|
|
90
|
-
/** Side-band multiplexing for progress reporting (8KB limit) */
|
|
91
|
-
sideBand?: boolean;
|
|
92
|
-
/** Side-band-64k multiplexing (64KB limit, preferred) */
|
|
93
|
-
sideBand64k?: boolean;
|
|
94
|
-
/** Thin pack support - allows deltas against objects client has */
|
|
95
|
-
thinPack?: boolean;
|
|
96
|
-
/** Include tags that point to fetched objects automatically */
|
|
97
|
-
includeTag?: boolean;
|
|
98
|
-
/** Shallow clone support (limited history depth) */
|
|
99
|
-
shallow?: boolean;
|
|
100
|
-
/** Deepen relative to current shallow boundary */
|
|
101
|
-
deepenRelative?: boolean;
|
|
102
|
-
/** Don't send progress messages */
|
|
103
|
-
noProgress?: boolean;
|
|
104
|
-
/** Object filtering (partial clone) support */
|
|
105
|
-
filter?: boolean;
|
|
106
|
-
/** Allow fetching reachable SHA-1 not advertised in refs */
|
|
107
|
-
allowReachableSha1InWant?: boolean;
|
|
108
|
-
/** Allow fetching any SHA-1 (dangerous, usually disabled) */
|
|
109
|
-
allowAnySha1InWant?: boolean;
|
|
110
|
-
/** Multi-ack for negotiation optimization */
|
|
111
|
-
multiAck?: boolean;
|
|
112
|
-
/** Multi-ack with detailed status */
|
|
113
|
-
multiAckDetailed?: boolean;
|
|
114
|
-
/** Object format (sha1 or sha256) */
|
|
115
|
-
objectFormat?: 'sha1' | 'sha256';
|
|
116
|
-
/** Server agent identification string */
|
|
117
|
-
agent?: string;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Session state for an upload-pack operation.
|
|
121
|
-
*
|
|
122
|
-
* @description
|
|
123
|
-
* Maintains state across the multi-phase upload-pack protocol. For stateless
|
|
124
|
-
* protocols like HTTP, some state must be reconstructed from each request.
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```typescript
|
|
128
|
-
* const session = createSession('my-repo', refs, false)
|
|
129
|
-
* // session.wants, session.haves populated during negotiation
|
|
130
|
-
* // session.negotiationComplete set to true when ready for packfile
|
|
131
|
-
* ```
|
|
132
|
-
*/
|
|
133
|
-
export interface UploadPackSession {
|
|
134
|
-
/** Repository identifier for logging/tracking */
|
|
135
|
-
repoId: string;
|
|
136
|
-
/** Advertised references from the repository */
|
|
137
|
-
refs: Ref[];
|
|
138
|
-
/** Capabilities negotiated with the client */
|
|
139
|
-
capabilities: UploadPackCapabilities;
|
|
140
|
-
/** Object SHAs the client wants to receive */
|
|
141
|
-
wants: string[];
|
|
142
|
-
/** Object SHAs the client already has */
|
|
143
|
-
haves: string[];
|
|
144
|
-
/** Common ancestor commits found during negotiation */
|
|
145
|
-
commonAncestors: string[];
|
|
146
|
-
/** Shallow boundary commits (for shallow clones) */
|
|
147
|
-
shallowCommits: string[];
|
|
148
|
-
/** Depth limit for shallow clone */
|
|
149
|
-
depth?: number;
|
|
150
|
-
/** Deepen-since timestamp for shallow clone */
|
|
151
|
-
deepenSince?: number;
|
|
152
|
-
/** Refs to exclude when deepening */
|
|
153
|
-
deepenNot?: string[];
|
|
154
|
-
/** Whether negotiation is complete and packfile should be sent */
|
|
155
|
-
negotiationComplete: boolean;
|
|
156
|
-
/** Whether this is a stateless request (HTTP protocol) */
|
|
157
|
-
stateless: boolean;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Result of want/have negotiation.
|
|
161
|
-
*
|
|
162
|
-
* @description
|
|
163
|
-
* Contains the ACK/NAK responses to send to the client and information
|
|
164
|
-
* about which objects need to be included in the packfile.
|
|
165
|
-
*/
|
|
166
|
-
export interface WantHaveNegotiation {
|
|
167
|
-
/** ACK responses for common objects found */
|
|
168
|
-
acks: Array<{
|
|
169
|
-
sha: string;
|
|
170
|
-
status: 'common' | 'ready' | 'continue';
|
|
171
|
-
}>;
|
|
172
|
-
/** Whether server has nothing in common with client (NAK) */
|
|
173
|
-
nak: boolean;
|
|
174
|
-
/** Common ancestor commits found during negotiation */
|
|
175
|
-
commonAncestors: string[];
|
|
176
|
-
/** Object SHAs that need to be sent to the client */
|
|
177
|
-
objectsToSend: string[];
|
|
178
|
-
/** Whether negotiation is complete and packfile should be sent */
|
|
179
|
-
ready: boolean;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Side-band channel types for multiplexed output.
|
|
183
|
-
*
|
|
184
|
-
* @description
|
|
185
|
-
* When side-band is enabled, the server can send data on multiple channels:
|
|
186
|
-
* - Channel 1: Packfile data
|
|
187
|
-
* - Channel 2: Progress messages (displayed to user)
|
|
188
|
-
* - Channel 3: Error messages (fatal, abort transfer)
|
|
189
|
-
*/
|
|
190
|
-
export declare enum SideBandChannel {
|
|
191
|
-
/** Packfile data - the actual objects being transferred */
|
|
192
|
-
PACK_DATA = 1,
|
|
193
|
-
/** Progress messages - informational output for the user */
|
|
194
|
-
PROGRESS = 2,
|
|
195
|
-
/** Error messages - fatal errors that abort the transfer */
|
|
196
|
-
ERROR = 3
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Progress callback for packfile generation.
|
|
200
|
-
*
|
|
201
|
-
* @description
|
|
202
|
-
* Called during packfile generation to report progress. Messages are
|
|
203
|
-
* typically sent via side-band channel 2 to the client.
|
|
204
|
-
*
|
|
205
|
-
* @param message - Progress message to display
|
|
206
|
-
*/
|
|
207
|
-
export type ProgressCallback = (message: string) => void;
|
|
208
|
-
/**
|
|
209
|
-
* Options for packfile generation.
|
|
210
|
-
*
|
|
211
|
-
* @description
|
|
212
|
-
* Controls how the packfile is generated, including delta compression
|
|
213
|
-
* settings and progress reporting.
|
|
214
|
-
*/
|
|
215
|
-
export interface PackfileOptions {
|
|
216
|
-
/** Generate thin pack (use deltas against client's objects) */
|
|
217
|
-
thinPack?: boolean;
|
|
218
|
-
/** Include tags pointing to requested objects */
|
|
219
|
-
includeTag?: boolean;
|
|
220
|
-
/** Progress callback for status updates */
|
|
221
|
-
onProgress?: ProgressCallback;
|
|
222
|
-
/** Objects client already has (for thin pack delta bases) */
|
|
223
|
-
clientHasObjects?: string[];
|
|
224
|
-
/** Maximum delta chain depth */
|
|
225
|
-
maxDeltaDepth?: number;
|
|
226
|
-
/** Window size for delta compression algorithm */
|
|
227
|
-
deltaWindowSize?: number;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Result of packfile generation.
|
|
231
|
-
*
|
|
232
|
-
* @description
|
|
233
|
-
* Contains the generated packfile along with metadata about what
|
|
234
|
-
* was included.
|
|
235
|
-
*/
|
|
236
|
-
export interface PackfileResult {
|
|
237
|
-
/** The generated packfile binary data */
|
|
238
|
-
packfile: Uint8Array;
|
|
239
|
-
/** Number of objects in the pack */
|
|
240
|
-
objectCount: number;
|
|
241
|
-
/** List of object SHAs included in the pack */
|
|
242
|
-
includedObjects: string[];
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Object storage interface for retrieving git objects.
|
|
246
|
-
*
|
|
247
|
-
* @description
|
|
248
|
-
* Defines the methods required from an object store to support
|
|
249
|
-
* upload-pack operations. Implementations typically wrap a Git
|
|
250
|
-
* object database or similar storage.
|
|
251
|
-
*
|
|
252
|
-
* @example
|
|
253
|
-
* ```typescript
|
|
254
|
-
* class MyObjectStore implements ObjectStore {
|
|
255
|
-
* async getObject(sha: string) {
|
|
256
|
-
* return this.database.get(sha)
|
|
257
|
-
* }
|
|
258
|
-
* async hasObject(sha: string) {
|
|
259
|
-
* return this.database.has(sha)
|
|
260
|
-
* }
|
|
261
|
-
* // ... other methods
|
|
262
|
-
* }
|
|
263
|
-
* ```
|
|
264
|
-
*/
|
|
265
|
-
export interface ObjectStore {
|
|
266
|
-
/**
|
|
267
|
-
* Get an object by its SHA.
|
|
268
|
-
* @param sha - The SHA-1 hash of the object
|
|
269
|
-
* @returns The object type and data, or null if not found
|
|
270
|
-
*/
|
|
271
|
-
getObject(sha: string): Promise<{
|
|
272
|
-
type: ObjectType;
|
|
273
|
-
data: Uint8Array;
|
|
274
|
-
} | null>;
|
|
275
|
-
/**
|
|
276
|
-
* Check if an object exists in the store.
|
|
277
|
-
* @param sha - The SHA-1 hash to check
|
|
278
|
-
* @returns true if the object exists
|
|
279
|
-
*/
|
|
280
|
-
hasObject(sha: string): Promise<boolean>;
|
|
281
|
-
/**
|
|
282
|
-
* Get the parent commit SHAs for a commit.
|
|
283
|
-
* @param sha - The commit SHA
|
|
284
|
-
* @returns Array of parent commit SHAs
|
|
285
|
-
*/
|
|
286
|
-
getCommitParents(sha: string): Promise<string[]>;
|
|
287
|
-
/**
|
|
288
|
-
* Get all refs in the repository.
|
|
289
|
-
* @returns Array of Ref objects
|
|
290
|
-
*/
|
|
291
|
-
getRefs(): Promise<Ref[]>;
|
|
292
|
-
/**
|
|
293
|
-
* Get all objects reachable from a given SHA.
|
|
294
|
-
* @param sha - Starting object SHA
|
|
295
|
-
* @param depth - Optional depth limit
|
|
296
|
-
* @returns Array of reachable object SHAs
|
|
297
|
-
*/
|
|
298
|
-
getReachableObjects(sha: string, depth?: number): Promise<string[]>;
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* Shallow clone information.
|
|
302
|
-
*
|
|
303
|
-
* @description
|
|
304
|
-
* Contains information about shallow boundary changes during
|
|
305
|
-
* fetch operations with depth limiting.
|
|
306
|
-
*/
|
|
307
|
-
export interface ShallowInfo {
|
|
308
|
-
/** Commits at the new shallow boundary */
|
|
309
|
-
shallowCommits: string[];
|
|
310
|
-
/** Commits that are no longer shallow (deepened) */
|
|
311
|
-
unshallowCommits: string[];
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Build capability string for ref advertisement.
|
|
315
|
-
*
|
|
316
|
-
* @description
|
|
317
|
-
* Converts a capabilities object into a space-separated string suitable
|
|
318
|
-
* for inclusion in the ref advertisement. Boolean capabilities become
|
|
319
|
-
* simple names, while capabilities with values become "name=value".
|
|
320
|
-
*
|
|
321
|
-
* @param capabilities - Capabilities to advertise
|
|
322
|
-
* @returns Space-separated capability string
|
|
323
|
-
*
|
|
324
|
-
* @example
|
|
325
|
-
* ```typescript
|
|
326
|
-
* const caps: UploadPackCapabilities = {
|
|
327
|
-
* sideBand64k: true,
|
|
328
|
-
* thinPack: true,
|
|
329
|
-
* agent: 'my-server/1.0'
|
|
330
|
-
* }
|
|
331
|
-
* const str = buildCapabilityString(caps)
|
|
332
|
-
* // 'side-band-64k thin-pack agent=my-server/1.0'
|
|
333
|
-
* ```
|
|
334
|
-
*/
|
|
335
|
-
export declare function buildCapabilityString(capabilities: UploadPackCapabilities): string;
|
|
336
|
-
/**
|
|
337
|
-
* Parse capabilities from first want line.
|
|
338
|
-
*
|
|
339
|
-
* @description
|
|
340
|
-
* Parses a space-separated capability string (typically from the first
|
|
341
|
-
* want line of a fetch request) into a structured capabilities object.
|
|
342
|
-
*
|
|
343
|
-
* @param capsString - Space-separated capabilities from client
|
|
344
|
-
* @returns Parsed capabilities object
|
|
345
|
-
*
|
|
346
|
-
* @example
|
|
347
|
-
* ```typescript
|
|
348
|
-
* const caps = parseCapabilities('side-band-64k thin-pack agent=git/2.30.0')
|
|
349
|
-
* // caps.sideBand64k === true
|
|
350
|
-
* // caps.thinPack === true
|
|
351
|
-
* // caps.agent === 'git/2.30.0'
|
|
352
|
-
* ```
|
|
353
|
-
*/
|
|
354
|
-
export declare function parseCapabilities(capsString: string): UploadPackCapabilities;
|
|
355
|
-
/**
|
|
356
|
-
* Create a new upload-pack session.
|
|
357
|
-
*
|
|
358
|
-
* @description
|
|
359
|
-
* Initializes a new session for an upload-pack operation. The session
|
|
360
|
-
* tracks state across the negotiation and packfile generation phases.
|
|
361
|
-
*
|
|
362
|
-
* @param repoId - Repository identifier for logging/tracking
|
|
363
|
-
* @param refs - Available refs to advertise
|
|
364
|
-
* @param stateless - Whether this is a stateless (HTTP) request
|
|
365
|
-
* @returns New session object
|
|
366
|
-
*
|
|
367
|
-
* @example
|
|
368
|
-
* ```typescript
|
|
369
|
-
* const refs = await store.getRefs()
|
|
370
|
-
* const session = createSession('my-repo', refs, true) // HTTP
|
|
371
|
-
* // session.negotiationComplete === false initially
|
|
372
|
-
* ```
|
|
373
|
-
*/
|
|
374
|
-
export declare function createSession(repoId: string, refs: Ref[], stateless?: boolean): UploadPackSession;
|
|
375
|
-
/**
|
|
376
|
-
* Parse a want line from the client.
|
|
377
|
-
*
|
|
378
|
-
* @description
|
|
379
|
-
* Parses a "want" line which has the format:
|
|
380
|
-
* `want <sha> [capabilities...]`
|
|
381
|
-
*
|
|
382
|
-
* The first want line typically includes capabilities, subsequent ones don't.
|
|
383
|
-
*
|
|
384
|
-
* @param line - The want line (e.g., "want abc123... side-band-64k")
|
|
385
|
-
* @returns Parsed SHA and capabilities
|
|
386
|
-
*
|
|
387
|
-
* @throws {Error} If the line format is invalid or SHA is malformed
|
|
388
|
-
*
|
|
389
|
-
* @example
|
|
390
|
-
* ```typescript
|
|
391
|
-
* // First want line with capabilities
|
|
392
|
-
* const { sha, capabilities } = parseWantLine(
|
|
393
|
-
* 'want abc123... side-band-64k thin-pack'
|
|
394
|
-
* )
|
|
395
|
-
* // sha === 'abc123...'
|
|
396
|
-
* // capabilities.sideBand64k === true
|
|
397
|
-
*
|
|
398
|
-
* // Subsequent want line
|
|
399
|
-
* const { sha: sha2 } = parseWantLine('want def456...')
|
|
400
|
-
* ```
|
|
401
|
-
*/
|
|
402
|
-
export declare function parseWantLine(line: string): {
|
|
403
|
-
sha: string;
|
|
404
|
-
capabilities: UploadPackCapabilities;
|
|
405
|
-
};
|
|
406
|
-
/**
|
|
407
|
-
* Parse a have line from the client.
|
|
408
|
-
*
|
|
409
|
-
* @description
|
|
410
|
-
* Parses a "have" line which has the simple format:
|
|
411
|
-
* `have <sha>`
|
|
412
|
-
*
|
|
413
|
-
* @param line - The have line (e.g., "have abc123...")
|
|
414
|
-
* @returns The parsed SHA
|
|
415
|
-
*
|
|
416
|
-
* @throws {Error} If the line format is invalid or SHA is malformed
|
|
417
|
-
*
|
|
418
|
-
* @example
|
|
419
|
-
* ```typescript
|
|
420
|
-
* const sha = parseHaveLine('have abc123def456...')
|
|
421
|
-
* // sha === 'abc123def456...'
|
|
422
|
-
* ```
|
|
423
|
-
*/
|
|
424
|
-
export declare function parseHaveLine(line: string): string;
|
|
425
|
-
/**
|
|
426
|
-
* Advertise refs to the client.
|
|
427
|
-
*
|
|
428
|
-
* @description
|
|
429
|
-
* Generates the ref advertisement response for the initial phase of
|
|
430
|
-
* upload-pack. This includes:
|
|
431
|
-
* - HEAD reference with capabilities
|
|
432
|
-
* - Sorted refs with symref information
|
|
433
|
-
* - Peeled refs for annotated tags
|
|
434
|
-
*
|
|
435
|
-
* @param store - Object store to get refs from
|
|
436
|
-
* @param capabilities - Optional server capabilities to advertise
|
|
437
|
-
* @returns Pkt-line formatted ref advertisement
|
|
438
|
-
*
|
|
439
|
-
* @example
|
|
440
|
-
* ```typescript
|
|
441
|
-
* const advertisement = await advertiseRefs(store, {
|
|
442
|
-
* sideBand64k: true,
|
|
443
|
-
* thinPack: true
|
|
444
|
-
* })
|
|
445
|
-
* // Send as response to GET /info/refs?service=git-upload-pack
|
|
446
|
-
* ```
|
|
447
|
-
*/
|
|
448
|
-
export declare function advertiseRefs(store: ObjectStore, capabilities?: Partial<UploadPackCapabilities>): Promise<string>;
|
|
449
|
-
/**
|
|
450
|
-
* Format an ACK response.
|
|
451
|
-
*
|
|
452
|
-
* @description
|
|
453
|
-
* Creates a pkt-line formatted ACK response for negotiation:
|
|
454
|
-
* - Simple ACK: `ACK <sha>` (when negotiation is complete)
|
|
455
|
-
* - Status ACK: `ACK <sha> <status>` (during multi_ack negotiation)
|
|
456
|
-
*
|
|
457
|
-
* @param sha - The SHA being acknowledged
|
|
458
|
-
* @param status - ACK status (common, ready, continue, or none for simple ACK)
|
|
459
|
-
* @returns Pkt-line formatted ACK
|
|
460
|
-
*
|
|
461
|
-
* @example
|
|
462
|
-
* ```typescript
|
|
463
|
-
* // Simple ACK
|
|
464
|
-
* const ack = formatAck('abc123...')
|
|
465
|
-
* // '0014ACK abc123...\n'
|
|
466
|
-
*
|
|
467
|
-
* // Multi-ack with status
|
|
468
|
-
* const ackContinue = formatAck('abc123...', 'continue')
|
|
469
|
-
* // '001dACK abc123... continue\n'
|
|
470
|
-
* ```
|
|
471
|
-
*/
|
|
472
|
-
export declare function formatAck(sha: string, status?: 'common' | 'ready' | 'continue'): string;
|
|
473
|
-
/**
|
|
474
|
-
* Format a NAK response.
|
|
475
|
-
*
|
|
476
|
-
* @description
|
|
477
|
-
* Creates a pkt-line formatted NAK response. NAK indicates that the
|
|
478
|
-
* server has no objects in common with the client's "have" list.
|
|
479
|
-
*
|
|
480
|
-
* @returns Pkt-line formatted NAK
|
|
481
|
-
*
|
|
482
|
-
* @example
|
|
483
|
-
* ```typescript
|
|
484
|
-
* const nak = formatNak()
|
|
485
|
-
* // '0008NAK\n'
|
|
486
|
-
* ```
|
|
487
|
-
*/
|
|
488
|
-
export declare function formatNak(): string;
|
|
489
|
-
/**
|
|
490
|
-
* Process client wants and update session.
|
|
491
|
-
*
|
|
492
|
-
* @description
|
|
493
|
-
* Validates and processes the "want" SHAs from a client fetch request.
|
|
494
|
-
* Verifies that all wanted objects exist in the repository.
|
|
495
|
-
*
|
|
496
|
-
* @param session - Current session state
|
|
497
|
-
* @param wants - Array of want SHAs from the client
|
|
498
|
-
* @param store - Object store to verify objects exist
|
|
499
|
-
* @returns Updated session
|
|
500
|
-
*
|
|
501
|
-
* @throws {Error} If any wanted object doesn't exist
|
|
502
|
-
*
|
|
503
|
-
* @example
|
|
504
|
-
* ```typescript
|
|
505
|
-
* const session = createSession('repo', refs)
|
|
506
|
-
* await processWants(session, ['abc123...', 'def456...'], store)
|
|
507
|
-
* // session.wants now contains the validated wants
|
|
508
|
-
* ```
|
|
509
|
-
*/
|
|
510
|
-
export declare function processWants(session: UploadPackSession, wants: string[], store: ObjectStore): Promise<UploadPackSession>;
|
|
511
|
-
/**
|
|
512
|
-
* Process client haves and perform negotiation.
|
|
513
|
-
*
|
|
514
|
-
* @description
|
|
515
|
-
* Processes the "have" SHAs from the client to find common ancestors.
|
|
516
|
-
* This determines which objects need to be sent vs which the client
|
|
517
|
-
* already has.
|
|
518
|
-
*
|
|
519
|
-
* @param session - Current session state
|
|
520
|
-
* @param haves - Array of have SHAs from the client
|
|
521
|
-
* @param store - Object store to check for common objects
|
|
522
|
-
* @param done - Whether client is done sending haves
|
|
523
|
-
* @returns Negotiation result with ACKs/NAKs and objects to send
|
|
524
|
-
*
|
|
525
|
-
* @example
|
|
526
|
-
* ```typescript
|
|
527
|
-
* const result = await processHaves(session, ['abc123...'], store, true)
|
|
528
|
-
* if (result.nak) {
|
|
529
|
-
* // No common objects, will send full pack
|
|
530
|
-
* } else {
|
|
531
|
-
* // Can send incremental pack
|
|
532
|
-
* }
|
|
533
|
-
* ```
|
|
534
|
-
*/
|
|
535
|
-
export declare function processHaves(session: UploadPackSession, haves: string[], store: ObjectStore, done: boolean): Promise<WantHaveNegotiation>;
|
|
536
|
-
/**
|
|
537
|
-
* Calculate objects needed by client.
|
|
538
|
-
*
|
|
539
|
-
* @description
|
|
540
|
-
* Given the client's wants and haves, determines the minimal set of
|
|
541
|
-
* objects that need to be sent. Walks the object graph from wants,
|
|
542
|
-
* stopping at objects the client already has.
|
|
543
|
-
*
|
|
544
|
-
* @param store - Object store
|
|
545
|
-
* @param wants - Objects client wants
|
|
546
|
-
* @param haves - Objects client has
|
|
547
|
-
* @returns Set of object SHAs to include in packfile
|
|
548
|
-
*
|
|
549
|
-
* @example
|
|
550
|
-
* ```typescript
|
|
551
|
-
* const missing = await calculateMissingObjects(
|
|
552
|
-
* store,
|
|
553
|
-
* ['new-commit-sha'],
|
|
554
|
-
* ['old-commit-sha']
|
|
555
|
-
* )
|
|
556
|
-
* // missing contains only objects reachable from new-commit
|
|
557
|
-
* // but not reachable from old-commit
|
|
558
|
-
* ```
|
|
559
|
-
*/
|
|
560
|
-
export declare function calculateMissingObjects(store: ObjectStore, wants: string[], haves: string[]): Promise<Set<string>>;
|
|
561
|
-
/**
|
|
562
|
-
* Process shallow/deepen commands.
|
|
563
|
-
*
|
|
564
|
-
* @description
|
|
565
|
-
* Handles shallow clone requests by processing depth limits, deepen-since
|
|
566
|
-
* timestamps, and deepen-not refs. Updates the session with shallow
|
|
567
|
-
* boundary information.
|
|
568
|
-
*
|
|
569
|
-
* @param session - Current session
|
|
570
|
-
* @param shallowLines - Shallow commit lines from client
|
|
571
|
-
* @param depth - Requested commit depth
|
|
572
|
-
* @param deepenSince - Timestamp to deepen since
|
|
573
|
-
* @param deepenNot - Refs to not deepen past
|
|
574
|
-
* @param store - Object store
|
|
575
|
-
* @returns Shallow info with boundary commits
|
|
576
|
-
*
|
|
577
|
-
* @example
|
|
578
|
-
* ```typescript
|
|
579
|
-
* const shallowInfo = await processShallow(
|
|
580
|
-
* session,
|
|
581
|
-
* [], // No previous shallow commits
|
|
582
|
-
* 3, // Depth of 3 commits
|
|
583
|
-
* undefined,
|
|
584
|
-
* undefined,
|
|
585
|
-
* store
|
|
586
|
-
* )
|
|
587
|
-
* // shallowInfo.shallowCommits contains boundary commits
|
|
588
|
-
* ```
|
|
589
|
-
*/
|
|
590
|
-
export declare function processShallow(session: UploadPackSession, shallowLines: string[], depth?: number, deepenSince?: number, deepenNot?: string[], store?: ObjectStore): Promise<ShallowInfo>;
|
|
591
|
-
/**
|
|
592
|
-
* Format shallow/unshallow lines for response.
|
|
593
|
-
*
|
|
594
|
-
* @description
|
|
595
|
-
* Creates pkt-line formatted shallow/unshallow responses to send
|
|
596
|
-
* to the client before the packfile.
|
|
597
|
-
*
|
|
598
|
-
* @param shallowInfo - Shallow info to format
|
|
599
|
-
* @returns Pkt-line formatted shallow response
|
|
600
|
-
*
|
|
601
|
-
* @example
|
|
602
|
-
* ```typescript
|
|
603
|
-
* const response = formatShallowResponse({
|
|
604
|
-
* shallowCommits: ['abc123...'],
|
|
605
|
-
* unshallowCommits: []
|
|
606
|
-
* })
|
|
607
|
-
* // '001cshallow abc123...\n'
|
|
608
|
-
* ```
|
|
609
|
-
*/
|
|
610
|
-
export declare function formatShallowResponse(shallowInfo: ShallowInfo): string;
|
|
611
|
-
/**
|
|
612
|
-
* Wrap data in side-band format.
|
|
613
|
-
*
|
|
614
|
-
* @description
|
|
615
|
-
* Wraps data in side-band format for multiplexed transmission.
|
|
616
|
-
* The format is: pkt-line length + channel byte + data
|
|
617
|
-
*
|
|
618
|
-
* @param channel - Side-band channel (1=data, 2=progress, 3=error)
|
|
619
|
-
* @param data - Data to wrap
|
|
620
|
-
* @returns Pkt-line formatted side-band data
|
|
621
|
-
*
|
|
622
|
-
* @example
|
|
623
|
-
* ```typescript
|
|
624
|
-
* // Wrap packfile data for channel 1
|
|
625
|
-
* const wrapped = wrapSideBand(SideBandChannel.PACK_DATA, packfile)
|
|
626
|
-
*
|
|
627
|
-
* // Wrap progress message for channel 2
|
|
628
|
-
* const progress = wrapSideBand(
|
|
629
|
-
* SideBandChannel.PROGRESS,
|
|
630
|
-
* encoder.encode('Counting objects: 100%\n')
|
|
631
|
-
* )
|
|
632
|
-
* ```
|
|
633
|
-
*/
|
|
634
|
-
export declare function wrapSideBand(channel: SideBandChannel, data: Uint8Array): Uint8Array;
|
|
635
|
-
/**
|
|
636
|
-
* Send progress message via side-band.
|
|
637
|
-
*
|
|
638
|
-
* @description
|
|
639
|
-
* Creates a side-band channel 2 message for progress reporting.
|
|
640
|
-
* Messages are displayed to the user during fetch operations.
|
|
641
|
-
*
|
|
642
|
-
* @param message - Progress message (newline added if not present)
|
|
643
|
-
* @returns Pkt-line formatted progress message
|
|
644
|
-
*
|
|
645
|
-
* @example
|
|
646
|
-
* ```typescript
|
|
647
|
-
* const progress = formatProgress('Counting objects: 42')
|
|
648
|
-
* // Side-band channel 2 packet with the message
|
|
649
|
-
* ```
|
|
650
|
-
*/
|
|
651
|
-
export declare function formatProgress(message: string): Uint8Array;
|
|
652
|
-
/**
|
|
653
|
-
* Generate a packfile containing the requested objects.
|
|
654
|
-
*
|
|
655
|
-
* @description
|
|
656
|
-
* Creates a Git packfile containing all objects needed by the client.
|
|
657
|
-
* The packfile format includes:
|
|
658
|
-
* - 12-byte header (PACK + version + object count)
|
|
659
|
-
* - Compressed objects with type/size headers
|
|
660
|
-
* - 20-byte SHA-1 checksum
|
|
661
|
-
*
|
|
662
|
-
* @param store - Object store to get objects from
|
|
663
|
-
* @param wants - Objects the client wants
|
|
664
|
-
* @param haves - Objects the client already has
|
|
665
|
-
* @param options - Packfile generation options
|
|
666
|
-
* @returns Packfile result with binary data and metadata
|
|
667
|
-
*
|
|
668
|
-
* @example
|
|
669
|
-
* ```typescript
|
|
670
|
-
* const result = await generatePackfile(
|
|
671
|
-
* store,
|
|
672
|
-
* ['commit-sha-1', 'commit-sha-2'],
|
|
673
|
-
* ['base-commit-sha'],
|
|
674
|
-
* { thinPack: true, onProgress: console.log }
|
|
675
|
-
* )
|
|
676
|
-
* // result.packfile contains the binary packfile
|
|
677
|
-
* // result.objectCount is the number of objects
|
|
678
|
-
* ```
|
|
679
|
-
*/
|
|
680
|
-
export declare function generatePackfile(store: ObjectStore, wants: string[], haves: string[], options?: PackfileOptions): Promise<PackfileResult>;
|
|
681
|
-
/**
|
|
682
|
-
* Generate thin pack with deltas against client's objects.
|
|
683
|
-
*
|
|
684
|
-
* @description
|
|
685
|
-
* Creates a thin pack that can use objects the client already has
|
|
686
|
-
* as delta bases, resulting in smaller transfer sizes.
|
|
687
|
-
*
|
|
688
|
-
* @param store - Object store
|
|
689
|
-
* @param objects - Objects to include
|
|
690
|
-
* @param clientHasObjects - Objects client already has (for delta bases)
|
|
691
|
-
* @returns Thin packfile
|
|
692
|
-
*
|
|
693
|
-
* @example
|
|
694
|
-
* ```typescript
|
|
695
|
-
* const result = await generateThinPack(
|
|
696
|
-
* store,
|
|
697
|
-
* ['new-blob-sha'],
|
|
698
|
-
* ['similar-blob-sha'] // Client has this, can be delta base
|
|
699
|
-
* )
|
|
700
|
-
* ```
|
|
701
|
-
*/
|
|
702
|
-
export declare function generateThinPack(store: ObjectStore, objects: string[], clientHasObjects: string[]): Promise<PackfileResult>;
|
|
703
|
-
/**
|
|
704
|
-
* Handle a complete fetch request.
|
|
705
|
-
*
|
|
706
|
-
* @description
|
|
707
|
-
* This is the main entry point that handles the full upload-pack protocol flow:
|
|
708
|
-
* 1. Parse client request (wants, haves, capabilities, shallow commands)
|
|
709
|
-
* 2. Negotiate common ancestors via ACK/NAK
|
|
710
|
-
* 3. Generate and return packfile with requested objects
|
|
711
|
-
*
|
|
712
|
-
* @param session - Upload pack session
|
|
713
|
-
* @param request - Raw request data (pkt-line formatted)
|
|
714
|
-
* @param store - Object store
|
|
715
|
-
* @returns Response data (ACKs/NAKs + packfile)
|
|
716
|
-
*
|
|
717
|
-
* @example
|
|
718
|
-
* ```typescript
|
|
719
|
-
* const session = createSession('repo', refs)
|
|
720
|
-
* const requestBody = '0032want abc123... side-band-64k\n00000009done\n'
|
|
721
|
-
*
|
|
722
|
-
* const response = await handleFetch(session, requestBody, store)
|
|
723
|
-
* // response contains NAK + packfile data
|
|
724
|
-
* ```
|
|
725
|
-
*/
|
|
726
|
-
export declare function handleFetch(session: UploadPackSession, request: string, store: ObjectStore): Promise<Uint8Array>;
|
|
727
|
-
//# sourceMappingURL=upload-pack.d.ts.map
|