git-wire
Import
Section titled “Import”import * as api from "@fungi.computer/agar/git-wire";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| type alias | ReceivePack | The decoded receive-pack command section; pack bytes remain unopened. |
| function | readPacketLines() | Split pkt-lines from the start of bytes; stops at the first flush when asked. |
| function | pktLine() | Encode one UTF-8 text packet with its byte-counted four-byte Git header. |
| function | acceptedRefs() | Refs the provider accepted, read from report-status (with or without side-band). |
| function | parseReceivePack() | Fail closed on any command the maintained Git wire contract does not support. |
| function | refusalReport() | Whole-push refusal in report-status, including the negotiated side-band framing. |
| function | sideBandData() | Data channel of an upload-pack side-band reply; fatal server messages refuse. |
| function | advertisedRefs() | Ref names and object IDs from the maintained smart-HTTP advertisement framing. |
| function | advertisedCapabilities() | Capabilities from the ref advertisement’s first NUL-delimited capability list. |
ReceivePacktype alias
Section titled “ReceivePack”type ReceivePack = | Readonly<{ kind: "ok"; updates: readonly GitRefUpdate[]; capabilities: readonly string[]; }> | Readonly<{ kind: "probe"; }> | Readonly<{ kind: "invalid"; reason: "unparsable" | "push-cert" | "too-many"; }>;The decoded receive-pack command section; pack bytes remain unopened.
readPacketLines()function
Section titled “readPacketLines()”function readPacketLines( bytes, stopAtFlush, strict?,): Uint8Array<ArrayBufferLike>[];Split pkt-lines from the start of bytes; stops at the first flush when asked.
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
bytes |
Uint8Array |
undefined |
stopAtFlush |
boolean |
undefined |
strict |
boolean |
false |
Returns
Section titled “Returns”Uint8Array<ArrayBufferLike>[]
pktLine()function
Section titled “pktLine()”function pktLine(text): string;Encode one UTF-8 text packet with its byte-counted four-byte Git header.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
text |
string |
Returns
Section titled “Returns”string
acceptedRefs()function
Section titled “acceptedRefs()”function acceptedRefs(response, sideBand): ReadonlySet<string>;Refs the provider accepted, read from report-status (with or without side-band).
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
response |
Uint8Array |
sideBand |
boolean |
Returns
Section titled “Returns”ReadonlySet<string>
parseReceivePack()function
Section titled “parseReceivePack()”function parseReceivePack(body): ReceivePack;Fail closed on any command the maintained Git wire contract does not support.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
Uint8Array |
Returns
Section titled “Returns”refusalReport()function
Section titled “refusalReport()”function refusalReport(verdict, updates, capabilities): Uint8Array;Whole-push refusal in report-status, including the negotiated side-band framing.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
verdict |
| { allowed: true; } | { allowed: false; refused: object[]; } & object |
updates |
readonly object[] |
capabilities |
readonly string[] |
Returns
Section titled “Returns”Uint8Array
sideBandData()function
Section titled “sideBandData()”function sideBandData(body): Uint8Array;Data channel of an upload-pack side-band reply; fatal server messages refuse.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
Uint8Array |
Returns
Section titled “Returns”Uint8Array
advertisedRefs()function
Section titled “advertisedRefs()”function advertisedRefs(body): ReadonlyMap<string, string>;Ref names and object IDs from the maintained smart-HTTP advertisement framing.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
Uint8Array |
Returns
Section titled “Returns”ReadonlyMap<string, string>
advertisedCapabilities()function
Section titled “advertisedCapabilities()”function advertisedCapabilities(body): ReadonlySet<string>;Capabilities from the ref advertisement’s first NUL-delimited capability list.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
body |
Uint8Array |
Returns
Section titled “Returns”ReadonlySet<string>