gitx.do 0.0.1 → 0.0.3
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/dist/cli/commands/blame.d.ts +259 -0
- package/dist/cli/commands/blame.d.ts.map +1 -0
- package/dist/cli/commands/blame.js +609 -0
- package/dist/cli/commands/blame.js.map +1 -0
- package/dist/cli/commands/branch.d.ts +249 -0
- package/dist/cli/commands/branch.d.ts.map +1 -0
- package/dist/cli/commands/branch.js +693 -0
- package/dist/cli/commands/branch.js.map +1 -0
- package/dist/cli/commands/commit.d.ts +182 -0
- package/dist/cli/commands/commit.d.ts.map +1 -0
- package/dist/cli/commands/commit.js +437 -0
- package/dist/cli/commands/commit.js.map +1 -0
- package/dist/cli/commands/diff.d.ts +464 -0
- package/dist/cli/commands/diff.d.ts.map +1 -0
- package/dist/cli/commands/diff.js +958 -0
- package/dist/cli/commands/diff.js.map +1 -0
- package/dist/cli/commands/log.d.ts +239 -0
- package/dist/cli/commands/log.d.ts.map +1 -0
- package/dist/cli/commands/log.js +535 -0
- package/dist/cli/commands/log.js.map +1 -0
- package/dist/cli/commands/review.d.ts +457 -0
- package/dist/cli/commands/review.d.ts.map +1 -0
- package/dist/cli/commands/review.js +533 -0
- package/dist/cli/commands/review.js.map +1 -0
- package/dist/cli/commands/status.d.ts +269 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +493 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/web.d.ts +199 -0
- package/dist/cli/commands/web.d.ts.map +1 -0
- package/dist/cli/commands/web.js +696 -0
- package/dist/cli/commands/web.js.map +1 -0
- package/dist/cli/fs-adapter.d.ts +656 -0
- package/dist/cli/fs-adapter.d.ts.map +1 -0
- package/dist/cli/fs-adapter.js +1179 -0
- package/dist/cli/fs-adapter.js.map +1 -0
- package/dist/cli/index.d.ts +387 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +523 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/ui/components/DiffView.d.ts +7 -0
- package/dist/cli/ui/components/DiffView.d.ts.map +1 -0
- package/dist/cli/ui/components/DiffView.js +11 -0
- package/dist/cli/ui/components/DiffView.js.map +1 -0
- package/dist/cli/ui/components/ErrorDisplay.d.ts +6 -0
- package/dist/cli/ui/components/ErrorDisplay.d.ts.map +1 -0
- package/dist/cli/ui/components/ErrorDisplay.js +11 -0
- package/dist/cli/ui/components/ErrorDisplay.js.map +1 -0
- package/dist/cli/ui/components/FuzzySearch.d.ts +9 -0
- package/dist/cli/ui/components/FuzzySearch.d.ts.map +1 -0
- package/dist/cli/ui/components/FuzzySearch.js +12 -0
- package/dist/cli/ui/components/FuzzySearch.js.map +1 -0
- package/dist/cli/ui/components/LoadingSpinner.d.ts +6 -0
- package/dist/cli/ui/components/LoadingSpinner.d.ts.map +1 -0
- package/dist/cli/ui/components/LoadingSpinner.js +10 -0
- package/dist/cli/ui/components/LoadingSpinner.js.map +1 -0
- package/dist/cli/ui/components/NavigationList.d.ts +9 -0
- package/dist/cli/ui/components/NavigationList.d.ts.map +1 -0
- package/dist/cli/ui/components/NavigationList.js +11 -0
- package/dist/cli/ui/components/NavigationList.js.map +1 -0
- package/dist/cli/ui/components/ScrollableContent.d.ts +8 -0
- package/dist/cli/ui/components/ScrollableContent.d.ts.map +1 -0
- package/dist/cli/ui/components/ScrollableContent.js +11 -0
- package/dist/cli/ui/components/ScrollableContent.js.map +1 -0
- package/dist/cli/ui/components/index.d.ts +7 -0
- package/dist/cli/ui/components/index.d.ts.map +1 -0
- package/dist/cli/ui/components/index.js +9 -0
- package/dist/cli/ui/components/index.js.map +1 -0
- package/dist/cli/ui/terminal-ui.d.ts +52 -0
- package/dist/cli/ui/terminal-ui.d.ts.map +1 -0
- package/dist/cli/ui/terminal-ui.js +121 -0
- package/dist/cli/ui/terminal-ui.js.map +1 -0
- package/dist/durable-object/object-store.d.ts +401 -23
- package/dist/durable-object/object-store.d.ts.map +1 -1
- package/dist/durable-object/object-store.js +414 -25
- package/dist/durable-object/object-store.js.map +1 -1
- package/dist/durable-object/schema.d.ts +188 -0
- package/dist/durable-object/schema.d.ts.map +1 -1
- package/dist/durable-object/schema.js +160 -0
- package/dist/durable-object/schema.js.map +1 -1
- package/dist/durable-object/wal.d.ts +336 -31
- package/dist/durable-object/wal.d.ts.map +1 -1
- package/dist/durable-object/wal.js +272 -27
- package/dist/durable-object/wal.js.map +1 -1
- package/dist/index.d.ts +379 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +379 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp/adapter.d.ts +579 -38
- package/dist/mcp/adapter.d.ts.map +1 -1
- package/dist/mcp/adapter.js +426 -33
- package/dist/mcp/adapter.js.map +1 -1
- package/dist/mcp/sandbox.d.ts +532 -29
- package/dist/mcp/sandbox.d.ts.map +1 -1
- package/dist/mcp/sandbox.js +389 -22
- package/dist/mcp/sandbox.js.map +1 -1
- package/dist/mcp/sdk-adapter.d.ts +478 -56
- package/dist/mcp/sdk-adapter.d.ts.map +1 -1
- package/dist/mcp/sdk-adapter.js +346 -44
- package/dist/mcp/sdk-adapter.js.map +1 -1
- package/dist/mcp/tools.d.ts +445 -30
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +363 -33
- package/dist/mcp/tools.js.map +1 -1
- package/dist/ops/blame.d.ts +424 -21
- package/dist/ops/blame.d.ts.map +1 -1
- package/dist/ops/blame.js +303 -20
- package/dist/ops/blame.js.map +1 -1
- package/dist/ops/branch.d.ts +583 -32
- package/dist/ops/branch.d.ts.map +1 -1
- package/dist/ops/branch.js +365 -23
- package/dist/ops/branch.js.map +1 -1
- package/dist/ops/commit-traversal.d.ts +164 -24
- package/dist/ops/commit-traversal.d.ts.map +1 -1
- package/dist/ops/commit-traversal.js +68 -2
- package/dist/ops/commit-traversal.js.map +1 -1
- package/dist/ops/commit.d.ts +387 -53
- package/dist/ops/commit.d.ts.map +1 -1
- package/dist/ops/commit.js +249 -29
- package/dist/ops/commit.js.map +1 -1
- package/dist/ops/merge-base.d.ts +195 -21
- package/dist/ops/merge-base.d.ts.map +1 -1
- package/dist/ops/merge-base.js +122 -12
- package/dist/ops/merge-base.js.map +1 -1
- package/dist/ops/merge.d.ts +600 -130
- package/dist/ops/merge.d.ts.map +1 -1
- package/dist/ops/merge.js +408 -60
- package/dist/ops/merge.js.map +1 -1
- package/dist/ops/tag.d.ts +67 -2
- package/dist/ops/tag.d.ts.map +1 -1
- package/dist/ops/tag.js +42 -1
- package/dist/ops/tag.js.map +1 -1
- package/dist/ops/tree-builder.d.ts +102 -6
- package/dist/ops/tree-builder.d.ts.map +1 -1
- package/dist/ops/tree-builder.js +30 -5
- package/dist/ops/tree-builder.js.map +1 -1
- package/dist/ops/tree-diff.d.ts +50 -2
- package/dist/ops/tree-diff.d.ts.map +1 -1
- package/dist/ops/tree-diff.js +50 -2
- package/dist/ops/tree-diff.js.map +1 -1
- package/dist/pack/delta.d.ts +211 -39
- package/dist/pack/delta.d.ts.map +1 -1
- package/dist/pack/delta.js +232 -46
- package/dist/pack/delta.js.map +1 -1
- package/dist/pack/format.d.ts +390 -28
- package/dist/pack/format.d.ts.map +1 -1
- package/dist/pack/format.js +344 -33
- package/dist/pack/format.js.map +1 -1
- package/dist/pack/full-generation.d.ts +313 -28
- package/dist/pack/full-generation.d.ts.map +1 -1
- package/dist/pack/full-generation.js +238 -19
- package/dist/pack/full-generation.js.map +1 -1
- package/dist/pack/generation.d.ts +346 -23
- package/dist/pack/generation.d.ts.map +1 -1
- package/dist/pack/generation.js +269 -21
- package/dist/pack/generation.js.map +1 -1
- package/dist/pack/index.d.ts +407 -86
- package/dist/pack/index.d.ts.map +1 -1
- package/dist/pack/index.js +351 -70
- package/dist/pack/index.js.map +1 -1
- package/dist/refs/branch.d.ts +517 -71
- package/dist/refs/branch.d.ts.map +1 -1
- package/dist/refs/branch.js +410 -26
- package/dist/refs/branch.js.map +1 -1
- package/dist/refs/storage.d.ts +610 -57
- package/dist/refs/storage.d.ts.map +1 -1
- package/dist/refs/storage.js +481 -29
- package/dist/refs/storage.js.map +1 -1
- package/dist/refs/tag.d.ts +677 -67
- package/dist/refs/tag.d.ts.map +1 -1
- package/dist/refs/tag.js +497 -30
- package/dist/refs/tag.js.map +1 -1
- package/dist/storage/lru-cache.d.ts +556 -53
- package/dist/storage/lru-cache.d.ts.map +1 -1
- package/dist/storage/lru-cache.js +439 -36
- package/dist/storage/lru-cache.js.map +1 -1
- package/dist/storage/object-index.d.ts +483 -38
- package/dist/storage/object-index.d.ts.map +1 -1
- package/dist/storage/object-index.js +388 -22
- package/dist/storage/object-index.js.map +1 -1
- package/dist/storage/r2-pack.d.ts +957 -94
- package/dist/storage/r2-pack.d.ts.map +1 -1
- package/dist/storage/r2-pack.js +756 -48
- package/dist/storage/r2-pack.js.map +1 -1
- package/dist/tiered/cdc-pipeline.d.ts +1610 -38
- package/dist/tiered/cdc-pipeline.d.ts.map +1 -1
- package/dist/tiered/cdc-pipeline.js +1131 -22
- package/dist/tiered/cdc-pipeline.js.map +1 -1
- package/dist/tiered/migration.d.ts +903 -41
- package/dist/tiered/migration.d.ts.map +1 -1
- package/dist/tiered/migration.js +646 -24
- package/dist/tiered/migration.js.map +1 -1
- package/dist/tiered/parquet-writer.d.ts +944 -47
- package/dist/tiered/parquet-writer.d.ts.map +1 -1
- package/dist/tiered/parquet-writer.js +667 -39
- package/dist/tiered/parquet-writer.js.map +1 -1
- package/dist/tiered/read-path.d.ts +728 -34
- package/dist/tiered/read-path.d.ts.map +1 -1
- package/dist/tiered/read-path.js +310 -27
- package/dist/tiered/read-path.js.map +1 -1
- package/dist/types/objects.d.ts +457 -0
- package/dist/types/objects.d.ts.map +1 -1
- package/dist/types/objects.js +305 -4
- package/dist/types/objects.js.map +1 -1
- package/dist/types/storage.d.ts +407 -35
- package/dist/types/storage.d.ts.map +1 -1
- package/dist/types/storage.js +27 -3
- package/dist/types/storage.js.map +1 -1
- package/dist/utils/hash.d.ts +133 -12
- package/dist/utils/hash.d.ts.map +1 -1
- package/dist/utils/hash.js +133 -12
- package/dist/utils/hash.js.map +1 -1
- package/dist/utils/sha1.d.ts +102 -9
- package/dist/utils/sha1.d.ts.map +1 -1
- package/dist/utils/sha1.js +114 -11
- package/dist/utils/sha1.js.map +1 -1
- package/dist/wire/capabilities.d.ts +896 -88
- package/dist/wire/capabilities.d.ts.map +1 -1
- package/dist/wire/capabilities.js +566 -62
- package/dist/wire/capabilities.js.map +1 -1
- package/dist/wire/pkt-line.d.ts +293 -15
- package/dist/wire/pkt-line.d.ts.map +1 -1
- package/dist/wire/pkt-line.js +251 -15
- package/dist/wire/pkt-line.js.map +1 -1
- package/dist/wire/receive-pack.d.ts +814 -64
- package/dist/wire/receive-pack.d.ts.map +1 -1
- package/dist/wire/receive-pack.js +542 -41
- package/dist/wire/receive-pack.js.map +1 -1
- package/dist/wire/smart-http.d.ts +575 -97
- package/dist/wire/smart-http.d.ts.map +1 -1
- package/dist/wire/smart-http.js +337 -46
- package/dist/wire/smart-http.js.map +1 -1
- package/dist/wire/upload-pack.d.ts +492 -98
- package/dist/wire/upload-pack.d.ts.map +1 -1
- package/dist/wire/upload-pack.js +347 -59
- package/dist/wire/upload-pack.js.map +1 -1
- package/package.json +10 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-pack.d.ts","sourceRoot":"","sources":["../../src/wire/upload-pack.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"upload-pack.d.ts","sourceRoot":"","sources":["../../src/wire/upload-pack.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAQlD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,GAAG;IAClB,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAA;IACZ,kDAAkD;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B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC,UAAU,CAAC,CAmGrB"}
|
package/dist/wire/upload-pack.js
CHANGED
|
@@ -1,31 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Git upload-pack
|
|
2
|
+
* @fileoverview Git upload-pack Protocol Implementation
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* objects from a remote repository.
|
|
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
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* 1. Server advertises refs (ref advertisement)
|
|
9
|
-
* 2. Client sends "want" lines for desired objects
|
|
10
|
-
* 3. Client sends "have" lines for objects it already has
|
|
11
|
-
* 4. Server responds with ACK/NAK
|
|
12
|
-
* 5. Server sends packfile with requested objects
|
|
7
|
+
* @module wire/upload-pack
|
|
13
8
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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
|
+
* ```
|
|
16
38
|
*/
|
|
17
39
|
import { encodePktLine, FLUSH_PKT } from './pkt-line';
|
|
18
40
|
import * as pako from 'pako';
|
|
19
41
|
/**
|
|
20
|
-
* Side-band channel types
|
|
42
|
+
* Side-band channel types for multiplexed output.
|
|
43
|
+
*
|
|
44
|
+
* @description
|
|
45
|
+
* When side-band is enabled, the server can send data on multiple channels:
|
|
46
|
+
* - Channel 1: Packfile data
|
|
47
|
+
* - Channel 2: Progress messages (displayed to user)
|
|
48
|
+
* - Channel 3: Error messages (fatal, abort transfer)
|
|
21
49
|
*/
|
|
22
50
|
export var SideBandChannel;
|
|
23
51
|
(function (SideBandChannel) {
|
|
24
|
-
/** Packfile data */
|
|
52
|
+
/** Packfile data - the actual objects being transferred */
|
|
25
53
|
SideBandChannel[SideBandChannel["PACK_DATA"] = 1] = "PACK_DATA";
|
|
26
|
-
/** Progress messages */
|
|
54
|
+
/** Progress messages - informational output for the user */
|
|
27
55
|
SideBandChannel[SideBandChannel["PROGRESS"] = 2] = "PROGRESS";
|
|
28
|
-
/** Error messages */
|
|
56
|
+
/** Error messages - fatal errors that abort the transfer */
|
|
29
57
|
SideBandChannel[SideBandChannel["ERROR"] = 3] = "ERROR";
|
|
30
58
|
})(SideBandChannel || (SideBandChannel = {}));
|
|
31
59
|
// ============================================================================
|
|
@@ -33,16 +61,32 @@ export var SideBandChannel;
|
|
|
33
61
|
// ============================================================================
|
|
34
62
|
const encoder = new TextEncoder();
|
|
35
63
|
const decoder = new TextDecoder();
|
|
36
|
-
|
|
64
|
+
/** SHA-1 regex for validation */
|
|
37
65
|
const SHA1_REGEX = /^[0-9a-f]{40}$/i;
|
|
38
66
|
// ============================================================================
|
|
39
67
|
// Capability Functions
|
|
40
68
|
// ============================================================================
|
|
41
69
|
/**
|
|
42
|
-
* Build capability string for ref advertisement
|
|
70
|
+
* Build capability string for ref advertisement.
|
|
71
|
+
*
|
|
72
|
+
* @description
|
|
73
|
+
* Converts a capabilities object into a space-separated string suitable
|
|
74
|
+
* for inclusion in the ref advertisement. Boolean capabilities become
|
|
75
|
+
* simple names, while capabilities with values become "name=value".
|
|
43
76
|
*
|
|
44
77
|
* @param capabilities - Capabilities to advertise
|
|
45
78
|
* @returns Space-separated capability string
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* const caps: UploadPackCapabilities = {
|
|
83
|
+
* sideBand64k: true,
|
|
84
|
+
* thinPack: true,
|
|
85
|
+
* agent: 'my-server/1.0'
|
|
86
|
+
* }
|
|
87
|
+
* const str = buildCapabilityString(caps)
|
|
88
|
+
* // 'side-band-64k thin-pack agent=my-server/1.0'
|
|
89
|
+
* ```
|
|
46
90
|
*/
|
|
47
91
|
export function buildCapabilityString(capabilities) {
|
|
48
92
|
const caps = [];
|
|
@@ -77,10 +121,22 @@ export function buildCapabilityString(capabilities) {
|
|
|
77
121
|
return caps.join(' ');
|
|
78
122
|
}
|
|
79
123
|
/**
|
|
80
|
-
* Parse capabilities from first want line
|
|
124
|
+
* Parse capabilities from first want line.
|
|
81
125
|
*
|
|
82
|
-
* @
|
|
83
|
-
*
|
|
126
|
+
* @description
|
|
127
|
+
* Parses a space-separated capability string (typically from the first
|
|
128
|
+
* want line of a fetch request) into a structured capabilities object.
|
|
129
|
+
*
|
|
130
|
+
* @param capsString - Space-separated capabilities from client
|
|
131
|
+
* @returns Parsed capabilities object
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* const caps = parseCapabilities('side-band-64k thin-pack agent=git/2.30.0')
|
|
136
|
+
* // caps.sideBand64k === true
|
|
137
|
+
* // caps.thinPack === true
|
|
138
|
+
* // caps.agent === 'git/2.30.0'
|
|
139
|
+
* ```
|
|
84
140
|
*/
|
|
85
141
|
export function parseCapabilities(capsString) {
|
|
86
142
|
const caps = {};
|
|
@@ -125,12 +181,23 @@ export function parseCapabilities(capsString) {
|
|
|
125
181
|
// Session Management
|
|
126
182
|
// ============================================================================
|
|
127
183
|
/**
|
|
128
|
-
* Create a new upload-pack session
|
|
184
|
+
* Create a new upload-pack session.
|
|
185
|
+
*
|
|
186
|
+
* @description
|
|
187
|
+
* Initializes a new session for an upload-pack operation. The session
|
|
188
|
+
* tracks state across the negotiation and packfile generation phases.
|
|
129
189
|
*
|
|
130
|
-
* @param repoId - Repository identifier
|
|
131
|
-
* @param refs - Available refs
|
|
190
|
+
* @param repoId - Repository identifier for logging/tracking
|
|
191
|
+
* @param refs - Available refs to advertise
|
|
132
192
|
* @param stateless - Whether this is a stateless (HTTP) request
|
|
133
193
|
* @returns New session object
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const refs = await store.getRefs()
|
|
198
|
+
* const session = createSession('my-repo', refs, true) // HTTP
|
|
199
|
+
* // session.negotiationComplete === false initially
|
|
200
|
+
* ```
|
|
134
201
|
*/
|
|
135
202
|
export function createSession(repoId, refs, stateless = false) {
|
|
136
203
|
return {
|
|
@@ -149,10 +216,31 @@ export function createSession(repoId, refs, stateless = false) {
|
|
|
149
216
|
// Want/Have Parsing
|
|
150
217
|
// ============================================================================
|
|
151
218
|
/**
|
|
152
|
-
* Parse a want line from the client
|
|
219
|
+
* Parse a want line from the client.
|
|
220
|
+
*
|
|
221
|
+
* @description
|
|
222
|
+
* Parses a "want" line which has the format:
|
|
223
|
+
* `want <sha> [capabilities...]`
|
|
224
|
+
*
|
|
225
|
+
* The first want line typically includes capabilities, subsequent ones don't.
|
|
153
226
|
*
|
|
154
|
-
* @param line - The want line (e.g., "want
|
|
227
|
+
* @param line - The want line (e.g., "want abc123... side-band-64k")
|
|
155
228
|
* @returns Parsed SHA and capabilities
|
|
229
|
+
*
|
|
230
|
+
* @throws {Error} If the line format is invalid or SHA is malformed
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```typescript
|
|
234
|
+
* // First want line with capabilities
|
|
235
|
+
* const { sha, capabilities } = parseWantLine(
|
|
236
|
+
* 'want abc123... side-band-64k thin-pack'
|
|
237
|
+
* )
|
|
238
|
+
* // sha === 'abc123...'
|
|
239
|
+
* // capabilities.sideBand64k === true
|
|
240
|
+
*
|
|
241
|
+
* // Subsequent want line
|
|
242
|
+
* const { sha: sha2 } = parseWantLine('want def456...')
|
|
243
|
+
* ```
|
|
156
244
|
*/
|
|
157
245
|
export function parseWantLine(line) {
|
|
158
246
|
const trimmed = line.trim();
|
|
@@ -171,10 +259,22 @@ export function parseWantLine(line) {
|
|
|
171
259
|
return { sha, capabilities };
|
|
172
260
|
}
|
|
173
261
|
/**
|
|
174
|
-
* Parse a have line from the client
|
|
262
|
+
* Parse a have line from the client.
|
|
175
263
|
*
|
|
176
|
-
* @
|
|
177
|
-
*
|
|
264
|
+
* @description
|
|
265
|
+
* Parses a "have" line which has the simple format:
|
|
266
|
+
* `have <sha>`
|
|
267
|
+
*
|
|
268
|
+
* @param line - The have line (e.g., "have abc123...")
|
|
269
|
+
* @returns The parsed SHA
|
|
270
|
+
*
|
|
271
|
+
* @throws {Error} If the line format is invalid or SHA is malformed
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```typescript
|
|
275
|
+
* const sha = parseHaveLine('have abc123def456...')
|
|
276
|
+
* // sha === 'abc123def456...'
|
|
277
|
+
* ```
|
|
178
278
|
*/
|
|
179
279
|
export function parseHaveLine(line) {
|
|
180
280
|
const trimmed = line.trim();
|
|
@@ -191,11 +291,27 @@ export function parseHaveLine(line) {
|
|
|
191
291
|
// Ref Advertisement
|
|
192
292
|
// ============================================================================
|
|
193
293
|
/**
|
|
194
|
-
* Advertise refs to the client
|
|
294
|
+
* Advertise refs to the client.
|
|
295
|
+
*
|
|
296
|
+
* @description
|
|
297
|
+
* Generates the ref advertisement response for the initial phase of
|
|
298
|
+
* upload-pack. This includes:
|
|
299
|
+
* - HEAD reference with capabilities
|
|
300
|
+
* - Sorted refs with symref information
|
|
301
|
+
* - Peeled refs for annotated tags
|
|
195
302
|
*
|
|
196
303
|
* @param store - Object store to get refs from
|
|
197
|
-
* @param capabilities -
|
|
304
|
+
* @param capabilities - Optional server capabilities to advertise
|
|
198
305
|
* @returns Pkt-line formatted ref advertisement
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```typescript
|
|
309
|
+
* const advertisement = await advertiseRefs(store, {
|
|
310
|
+
* sideBand64k: true,
|
|
311
|
+
* thinPack: true
|
|
312
|
+
* })
|
|
313
|
+
* // Send as response to GET /info/refs?service=git-upload-pack
|
|
314
|
+
* ```
|
|
199
315
|
*/
|
|
200
316
|
export async function advertiseRefs(store, capabilities) {
|
|
201
317
|
const refs = await store.getRefs();
|
|
@@ -265,11 +381,27 @@ export async function advertiseRefs(store, capabilities) {
|
|
|
265
381
|
// ACK/NAK Formatting
|
|
266
382
|
// ============================================================================
|
|
267
383
|
/**
|
|
268
|
-
* Format an ACK response
|
|
384
|
+
* Format an ACK response.
|
|
385
|
+
*
|
|
386
|
+
* @description
|
|
387
|
+
* Creates a pkt-line formatted ACK response for negotiation:
|
|
388
|
+
* - Simple ACK: `ACK <sha>` (when negotiation is complete)
|
|
389
|
+
* - Status ACK: `ACK <sha> <status>` (during multi_ack negotiation)
|
|
269
390
|
*
|
|
270
391
|
* @param sha - The SHA being acknowledged
|
|
271
392
|
* @param status - ACK status (common, ready, continue, or none for simple ACK)
|
|
272
393
|
* @returns Pkt-line formatted ACK
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```typescript
|
|
397
|
+
* // Simple ACK
|
|
398
|
+
* const ack = formatAck('abc123...')
|
|
399
|
+
* // '0014ACK abc123...\n'
|
|
400
|
+
*
|
|
401
|
+
* // Multi-ack with status
|
|
402
|
+
* const ackContinue = formatAck('abc123...', 'continue')
|
|
403
|
+
* // '001dACK abc123... continue\n'
|
|
404
|
+
* ```
|
|
273
405
|
*/
|
|
274
406
|
export function formatAck(sha, status) {
|
|
275
407
|
const lowerSha = sha.toLowerCase();
|
|
@@ -283,9 +415,19 @@ export function formatAck(sha, status) {
|
|
|
283
415
|
return encodePktLine(ackLine);
|
|
284
416
|
}
|
|
285
417
|
/**
|
|
286
|
-
* Format a NAK response
|
|
418
|
+
* Format a NAK response.
|
|
419
|
+
*
|
|
420
|
+
* @description
|
|
421
|
+
* Creates a pkt-line formatted NAK response. NAK indicates that the
|
|
422
|
+
* server has no objects in common with the client's "have" list.
|
|
287
423
|
*
|
|
288
424
|
* @returns Pkt-line formatted NAK
|
|
425
|
+
*
|
|
426
|
+
* @example
|
|
427
|
+
* ```typescript
|
|
428
|
+
* const nak = formatNak()
|
|
429
|
+
* // '0008NAK\n'
|
|
430
|
+
* ```
|
|
289
431
|
*/
|
|
290
432
|
export function formatNak() {
|
|
291
433
|
return encodePktLine('NAK\n');
|
|
@@ -294,12 +436,25 @@ export function formatNak() {
|
|
|
294
436
|
// Want/Have Processing
|
|
295
437
|
// ============================================================================
|
|
296
438
|
/**
|
|
297
|
-
* Process client wants and update session
|
|
439
|
+
* Process client wants and update session.
|
|
440
|
+
*
|
|
441
|
+
* @description
|
|
442
|
+
* Validates and processes the "want" SHAs from a client fetch request.
|
|
443
|
+
* Verifies that all wanted objects exist in the repository.
|
|
298
444
|
*
|
|
299
445
|
* @param session - Current session state
|
|
300
|
-
* @param wants - Array of want SHAs
|
|
446
|
+
* @param wants - Array of want SHAs from the client
|
|
301
447
|
* @param store - Object store to verify objects exist
|
|
302
448
|
* @returns Updated session
|
|
449
|
+
*
|
|
450
|
+
* @throws {Error} If any wanted object doesn't exist
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```typescript
|
|
454
|
+
* const session = createSession('repo', refs)
|
|
455
|
+
* await processWants(session, ['abc123...', 'def456...'], store)
|
|
456
|
+
* // session.wants now contains the validated wants
|
|
457
|
+
* ```
|
|
303
458
|
*/
|
|
304
459
|
export async function processWants(session, wants, store) {
|
|
305
460
|
// Deduplicate wants
|
|
@@ -316,13 +471,28 @@ export async function processWants(session, wants, store) {
|
|
|
316
471
|
return session;
|
|
317
472
|
}
|
|
318
473
|
/**
|
|
319
|
-
* Process client haves and perform negotiation
|
|
474
|
+
* Process client haves and perform negotiation.
|
|
475
|
+
*
|
|
476
|
+
* @description
|
|
477
|
+
* Processes the "have" SHAs from the client to find common ancestors.
|
|
478
|
+
* This determines which objects need to be sent vs which the client
|
|
479
|
+
* already has.
|
|
320
480
|
*
|
|
321
481
|
* @param session - Current session state
|
|
322
|
-
* @param haves - Array of have SHAs
|
|
482
|
+
* @param haves - Array of have SHAs from the client
|
|
323
483
|
* @param store - Object store to check for common objects
|
|
324
484
|
* @param done - Whether client is done sending haves
|
|
325
|
-
* @returns Negotiation result
|
|
485
|
+
* @returns Negotiation result with ACKs/NAKs and objects to send
|
|
486
|
+
*
|
|
487
|
+
* @example
|
|
488
|
+
* ```typescript
|
|
489
|
+
* const result = await processHaves(session, ['abc123...'], store, true)
|
|
490
|
+
* if (result.nak) {
|
|
491
|
+
* // No common objects, will send full pack
|
|
492
|
+
* } else {
|
|
493
|
+
* // Can send incremental pack
|
|
494
|
+
* }
|
|
495
|
+
* ```
|
|
326
496
|
*/
|
|
327
497
|
export async function processHaves(session, haves, store, done) {
|
|
328
498
|
const result = {
|
|
@@ -370,14 +540,28 @@ export async function processHaves(session, haves, store, done) {
|
|
|
370
540
|
// Object Calculation
|
|
371
541
|
// ============================================================================
|
|
372
542
|
/**
|
|
373
|
-
* Calculate objects needed by client
|
|
543
|
+
* Calculate objects needed by client.
|
|
374
544
|
*
|
|
375
|
-
*
|
|
545
|
+
* @description
|
|
546
|
+
* Given the client's wants and haves, determines the minimal set of
|
|
547
|
+
* objects that need to be sent. Walks the object graph from wants,
|
|
548
|
+
* stopping at objects the client already has.
|
|
376
549
|
*
|
|
377
550
|
* @param store - Object store
|
|
378
551
|
* @param wants - Objects client wants
|
|
379
552
|
* @param haves - Objects client has
|
|
380
553
|
* @returns Set of object SHAs to include in packfile
|
|
554
|
+
*
|
|
555
|
+
* @example
|
|
556
|
+
* ```typescript
|
|
557
|
+
* const missing = await calculateMissingObjects(
|
|
558
|
+
* store,
|
|
559
|
+
* ['new-commit-sha'],
|
|
560
|
+
* ['old-commit-sha']
|
|
561
|
+
* )
|
|
562
|
+
* // missing contains only objects reachable from new-commit
|
|
563
|
+
* // but not reachable from old-commit
|
|
564
|
+
* ```
|
|
381
565
|
*/
|
|
382
566
|
export async function calculateMissingObjects(store, wants, haves) {
|
|
383
567
|
const missing = new Set();
|
|
@@ -441,15 +625,33 @@ export async function calculateMissingObjects(store, wants, haves) {
|
|
|
441
625
|
// Shallow Clone Support
|
|
442
626
|
// ============================================================================
|
|
443
627
|
/**
|
|
444
|
-
* Process shallow/deepen commands
|
|
628
|
+
* Process shallow/deepen commands.
|
|
629
|
+
*
|
|
630
|
+
* @description
|
|
631
|
+
* Handles shallow clone requests by processing depth limits, deepen-since
|
|
632
|
+
* timestamps, and deepen-not refs. Updates the session with shallow
|
|
633
|
+
* boundary information.
|
|
445
634
|
*
|
|
446
635
|
* @param session - Current session
|
|
447
636
|
* @param shallowLines - Shallow commit lines from client
|
|
448
|
-
* @param depth - Requested depth
|
|
637
|
+
* @param depth - Requested commit depth
|
|
449
638
|
* @param deepenSince - Timestamp to deepen since
|
|
450
639
|
* @param deepenNot - Refs to not deepen past
|
|
451
640
|
* @param store - Object store
|
|
452
641
|
* @returns Shallow info with boundary commits
|
|
642
|
+
*
|
|
643
|
+
* @example
|
|
644
|
+
* ```typescript
|
|
645
|
+
* const shallowInfo = await processShallow(
|
|
646
|
+
* session,
|
|
647
|
+
* [], // No previous shallow commits
|
|
648
|
+
* 3, // Depth of 3 commits
|
|
649
|
+
* undefined,
|
|
650
|
+
* undefined,
|
|
651
|
+
* store
|
|
652
|
+
* )
|
|
653
|
+
* // shallowInfo.shallowCommits contains boundary commits
|
|
654
|
+
* ```
|
|
453
655
|
*/
|
|
454
656
|
export async function processShallow(session, shallowLines, depth, deepenSince, deepenNot, store) {
|
|
455
657
|
const result = {
|
|
@@ -512,10 +714,23 @@ export async function processShallow(session, shallowLines, depth, deepenSince,
|
|
|
512
714
|
return result;
|
|
513
715
|
}
|
|
514
716
|
/**
|
|
515
|
-
* Format shallow/unshallow lines for response
|
|
717
|
+
* Format shallow/unshallow lines for response.
|
|
718
|
+
*
|
|
719
|
+
* @description
|
|
720
|
+
* Creates pkt-line formatted shallow/unshallow responses to send
|
|
721
|
+
* to the client before the packfile.
|
|
516
722
|
*
|
|
517
723
|
* @param shallowInfo - Shallow info to format
|
|
518
724
|
* @returns Pkt-line formatted shallow response
|
|
725
|
+
*
|
|
726
|
+
* @example
|
|
727
|
+
* ```typescript
|
|
728
|
+
* const response = formatShallowResponse({
|
|
729
|
+
* shallowCommits: ['abc123...'],
|
|
730
|
+
* unshallowCommits: []
|
|
731
|
+
* })
|
|
732
|
+
* // '001cshallow abc123...\n'
|
|
733
|
+
* ```
|
|
519
734
|
*/
|
|
520
735
|
export function formatShallowResponse(shallowInfo) {
|
|
521
736
|
const lines = [];
|
|
@@ -531,11 +746,27 @@ export function formatShallowResponse(shallowInfo) {
|
|
|
531
746
|
// Side-band Multiplexing
|
|
532
747
|
// ============================================================================
|
|
533
748
|
/**
|
|
534
|
-
* Wrap data in side-band format
|
|
749
|
+
* Wrap data in side-band format.
|
|
750
|
+
*
|
|
751
|
+
* @description
|
|
752
|
+
* Wraps data in side-band format for multiplexed transmission.
|
|
753
|
+
* The format is: pkt-line length + channel byte + data
|
|
535
754
|
*
|
|
536
755
|
* @param channel - Side-band channel (1=data, 2=progress, 3=error)
|
|
537
756
|
* @param data - Data to wrap
|
|
538
757
|
* @returns Pkt-line formatted side-band data
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* ```typescript
|
|
761
|
+
* // Wrap packfile data for channel 1
|
|
762
|
+
* const wrapped = wrapSideBand(SideBandChannel.PACK_DATA, packfile)
|
|
763
|
+
*
|
|
764
|
+
* // Wrap progress message for channel 2
|
|
765
|
+
* const progress = wrapSideBand(
|
|
766
|
+
* SideBandChannel.PROGRESS,
|
|
767
|
+
* encoder.encode('Counting objects: 100%\n')
|
|
768
|
+
* )
|
|
769
|
+
* ```
|
|
539
770
|
*/
|
|
540
771
|
export function wrapSideBand(channel, data) {
|
|
541
772
|
// Total length = 4 (pkt-line header) + 1 (channel byte) + data length
|
|
@@ -551,10 +782,20 @@ export function wrapSideBand(channel, data) {
|
|
|
551
782
|
return result;
|
|
552
783
|
}
|
|
553
784
|
/**
|
|
554
|
-
* Send progress message via side-band
|
|
785
|
+
* Send progress message via side-band.
|
|
786
|
+
*
|
|
787
|
+
* @description
|
|
788
|
+
* Creates a side-band channel 2 message for progress reporting.
|
|
789
|
+
* Messages are displayed to the user during fetch operations.
|
|
555
790
|
*
|
|
556
|
-
* @param message - Progress message
|
|
791
|
+
* @param message - Progress message (newline added if not present)
|
|
557
792
|
* @returns Pkt-line formatted progress message
|
|
793
|
+
*
|
|
794
|
+
* @example
|
|
795
|
+
* ```typescript
|
|
796
|
+
* const progress = formatProgress('Counting objects: 42')
|
|
797
|
+
* // Side-band channel 2 packet with the message
|
|
798
|
+
* ```
|
|
558
799
|
*/
|
|
559
800
|
export function formatProgress(message) {
|
|
560
801
|
// Ensure message ends with newline
|
|
@@ -566,13 +807,32 @@ export function formatProgress(message) {
|
|
|
566
807
|
// Packfile Generation
|
|
567
808
|
// ============================================================================
|
|
568
809
|
/**
|
|
569
|
-
* Generate a packfile containing the requested objects
|
|
810
|
+
* Generate a packfile containing the requested objects.
|
|
811
|
+
*
|
|
812
|
+
* @description
|
|
813
|
+
* Creates a Git packfile containing all objects needed by the client.
|
|
814
|
+
* The packfile format includes:
|
|
815
|
+
* - 12-byte header (PACK + version + object count)
|
|
816
|
+
* - Compressed objects with type/size headers
|
|
817
|
+
* - 20-byte SHA-1 checksum
|
|
570
818
|
*
|
|
571
819
|
* @param store - Object store to get objects from
|
|
572
820
|
* @param wants - Objects the client wants
|
|
573
821
|
* @param haves - Objects the client already has
|
|
574
822
|
* @param options - Packfile generation options
|
|
575
|
-
* @returns Packfile result
|
|
823
|
+
* @returns Packfile result with binary data and metadata
|
|
824
|
+
*
|
|
825
|
+
* @example
|
|
826
|
+
* ```typescript
|
|
827
|
+
* const result = await generatePackfile(
|
|
828
|
+
* store,
|
|
829
|
+
* ['commit-sha-1', 'commit-sha-2'],
|
|
830
|
+
* ['base-commit-sha'],
|
|
831
|
+
* { thinPack: true, onProgress: console.log }
|
|
832
|
+
* )
|
|
833
|
+
* // result.packfile contains the binary packfile
|
|
834
|
+
* // result.objectCount is the number of objects
|
|
835
|
+
* ```
|
|
576
836
|
*/
|
|
577
837
|
export async function generatePackfile(store, wants, haves, options) {
|
|
578
838
|
const onProgress = options?.onProgress;
|
|
@@ -624,12 +884,25 @@ export async function generatePackfile(store, wants, haves, options) {
|
|
|
624
884
|
};
|
|
625
885
|
}
|
|
626
886
|
/**
|
|
627
|
-
* Generate thin pack with deltas against client's objects
|
|
887
|
+
* Generate thin pack with deltas against client's objects.
|
|
888
|
+
*
|
|
889
|
+
* @description
|
|
890
|
+
* Creates a thin pack that can use objects the client already has
|
|
891
|
+
* as delta bases, resulting in smaller transfer sizes.
|
|
628
892
|
*
|
|
629
893
|
* @param store - Object store
|
|
630
894
|
* @param objects - Objects to include
|
|
631
895
|
* @param clientHasObjects - Objects client already has (for delta bases)
|
|
632
896
|
* @returns Thin packfile
|
|
897
|
+
*
|
|
898
|
+
* @example
|
|
899
|
+
* ```typescript
|
|
900
|
+
* const result = await generateThinPack(
|
|
901
|
+
* store,
|
|
902
|
+
* ['new-blob-sha'],
|
|
903
|
+
* ['similar-blob-sha'] // Client has this, can be delta base
|
|
904
|
+
* )
|
|
905
|
+
* ```
|
|
633
906
|
*/
|
|
634
907
|
export async function generateThinPack(store, objects, clientHasObjects) {
|
|
635
908
|
// For thin packs, we can use client's objects as delta bases
|
|
@@ -653,7 +926,8 @@ export async function generateThinPack(store, objects, clientHasObjects) {
|
|
|
653
926
|
// Packfile Building Helpers
|
|
654
927
|
// ============================================================================
|
|
655
928
|
/**
|
|
656
|
-
* Object type to packfile type number mapping
|
|
929
|
+
* Object type to packfile type number mapping.
|
|
930
|
+
* @internal
|
|
657
931
|
*/
|
|
658
932
|
const OBJECT_TYPE_MAP = {
|
|
659
933
|
commit: 1,
|
|
@@ -662,7 +936,8 @@ const OBJECT_TYPE_MAP = {
|
|
|
662
936
|
tag: 4
|
|
663
937
|
};
|
|
664
938
|
/**
|
|
665
|
-
* Create packfile header
|
|
939
|
+
* Create packfile header.
|
|
940
|
+
* @internal
|
|
666
941
|
*/
|
|
667
942
|
function createPackfileHeader(objectCount) {
|
|
668
943
|
const header = new Uint8Array(12);
|
|
@@ -684,7 +959,8 @@ function createPackfileHeader(objectCount) {
|
|
|
684
959
|
return header;
|
|
685
960
|
}
|
|
686
961
|
/**
|
|
687
|
-
* Encode object header in packfile format
|
|
962
|
+
* Encode object header in packfile format.
|
|
963
|
+
* @internal
|
|
688
964
|
*/
|
|
689
965
|
function encodePackfileObjectHeader(type, size) {
|
|
690
966
|
const bytes = [];
|
|
@@ -700,7 +976,8 @@ function encodePackfileObjectHeader(type, size) {
|
|
|
700
976
|
return new Uint8Array(bytes);
|
|
701
977
|
}
|
|
702
978
|
/**
|
|
703
|
-
* Build complete packfile from objects
|
|
979
|
+
* Build complete packfile from objects.
|
|
980
|
+
* @internal
|
|
704
981
|
*/
|
|
705
982
|
async function buildPackfile(objects, _onProgress, _clientHasObjects) {
|
|
706
983
|
const parts = [];
|
|
@@ -737,7 +1014,8 @@ async function buildPackfile(objects, _onProgress, _clientHasObjects) {
|
|
|
737
1014
|
return result;
|
|
738
1015
|
}
|
|
739
1016
|
/**
|
|
740
|
-
* Calculate SHA-1 hash using Web Crypto API
|
|
1017
|
+
* Calculate SHA-1 hash using Web Crypto API.
|
|
1018
|
+
* @internal
|
|
741
1019
|
*/
|
|
742
1020
|
async function sha1(data) {
|
|
743
1021
|
const hashBuffer = await crypto.subtle.digest('SHA-1', data);
|
|
@@ -747,17 +1025,27 @@ async function sha1(data) {
|
|
|
747
1025
|
// Full Fetch Handler
|
|
748
1026
|
// ============================================================================
|
|
749
1027
|
/**
|
|
750
|
-
* Handle a complete fetch request
|
|
1028
|
+
* Handle a complete fetch request.
|
|
751
1029
|
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
754
|
-
*
|
|
755
|
-
*
|
|
1030
|
+
* @description
|
|
1031
|
+
* This is the main entry point that handles the full upload-pack protocol flow:
|
|
1032
|
+
* 1. Parse client request (wants, haves, capabilities, shallow commands)
|
|
1033
|
+
* 2. Negotiate common ancestors via ACK/NAK
|
|
1034
|
+
* 3. Generate and return packfile with requested objects
|
|
756
1035
|
*
|
|
757
1036
|
* @param session - Upload pack session
|
|
758
|
-
* @param request - Raw request data
|
|
1037
|
+
* @param request - Raw request data (pkt-line formatted)
|
|
759
1038
|
* @param store - Object store
|
|
760
1039
|
* @returns Response data (ACKs/NAKs + packfile)
|
|
1040
|
+
*
|
|
1041
|
+
* @example
|
|
1042
|
+
* ```typescript
|
|
1043
|
+
* const session = createSession('repo', refs)
|
|
1044
|
+
* const requestBody = '0032want abc123... side-band-64k\n00000009done\n'
|
|
1045
|
+
*
|
|
1046
|
+
* const response = await handleFetch(session, requestBody, store)
|
|
1047
|
+
* // response contains NAK + packfile data
|
|
1048
|
+
* ```
|
|
761
1049
|
*/
|
|
762
1050
|
export async function handleFetch(session, request, store) {
|
|
763
1051
|
const lines = request.split('\n').filter(l => l.trim() && l !== '0000');
|