@getpaseo/protocol 0.2.2 → 0.2.4
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/generated/validation/ws-outbound.aot.js +35126 -34207
- package/dist/git-remote.d.ts +7 -0
- package/dist/git-remote.js +11 -2
- package/dist/messages.d.ts +919 -4
- package/dist/messages.js +86 -1
- package/dist/validation/ws-outbound-schema-metadata.d.ts +193 -0
- package/package.json +1 -1
package/dist/git-remote.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export interface GitRemoteLocation {
|
|
2
2
|
transport: "scp" | "ssh" | "http" | "https";
|
|
3
3
|
host: string;
|
|
4
|
+
/**
|
|
5
|
+
* Explicit non-default port from the remote (e.g. a self-hosted forge on
|
|
6
|
+
* `:60443`), or undefined for a default-port or scp-form remote. Kept separate
|
|
7
|
+
* from `host` so host-identity matching (forge detection, cloud-host checks)
|
|
8
|
+
* stays port-agnostic; only consumers that reconstruct a URL (web links) use it.
|
|
9
|
+
*/
|
|
10
|
+
port?: string;
|
|
4
11
|
path: string;
|
|
5
12
|
}
|
|
6
13
|
export interface GitHubRemoteIdentity {
|
package/dist/git-remote.js
CHANGED
|
@@ -5,6 +5,11 @@ const TRANSPORT_BY_PROTOCOL = {
|
|
|
5
5
|
"http:": "http",
|
|
6
6
|
"ssh:": "ssh",
|
|
7
7
|
};
|
|
8
|
+
const DEFAULT_PORT_BY_PROTOCOL = {
|
|
9
|
+
"https:": "443",
|
|
10
|
+
"http:": "80",
|
|
11
|
+
"ssh:": "22",
|
|
12
|
+
};
|
|
8
13
|
export function parseGitHubRemoteUrl(remoteUrl) {
|
|
9
14
|
const location = parseGitRemoteLocation(remoteUrl);
|
|
10
15
|
if (!location || !isGitHubHost(location.host))
|
|
@@ -27,7 +32,9 @@ export function parseGitRemoteLocation(remoteUrl) {
|
|
|
27
32
|
const trimmed = remoteUrl.trim();
|
|
28
33
|
if (!trimmed)
|
|
29
34
|
return null;
|
|
30
|
-
|
|
35
|
+
// scp form has no scheme. Testing it first would match `ssh://git@host:22/x`
|
|
36
|
+
// — `[^@]+` happily eats `ssh://git` — and swallow the port into the path.
|
|
37
|
+
const scpLike = trimmed.includes("://") ? null : trimmed.match(/^[^@]+@([^:]+):(.+)$/u);
|
|
31
38
|
if (scpLike) {
|
|
32
39
|
const host = normalizeHost(scpLike[1] ?? "");
|
|
33
40
|
const path = normalizeRemotePath(scpLike[2] ?? "");
|
|
@@ -56,7 +63,9 @@ export function parseGitRemoteLocation(remoteUrl) {
|
|
|
56
63
|
const normalizedPath = normalizeRemotePath(path);
|
|
57
64
|
if (!isValidRemoteHost(host) || !normalizedPath)
|
|
58
65
|
return null;
|
|
59
|
-
|
|
66
|
+
const protocol = parsed.protocol.toLowerCase();
|
|
67
|
+
const port = parsed.port && parsed.port !== DEFAULT_PORT_BY_PROTOCOL[protocol] ? parsed.port : undefined;
|
|
68
|
+
return { transport, host, port, path: normalizedPath };
|
|
60
69
|
}
|
|
61
70
|
export function parseGitHubRemoteIdentity(path) {
|
|
62
71
|
const segments = path.split("/").filter(Boolean);
|