just-git 1.4.2 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -1
- package/dist/index.js +282 -282
- package/dist/server/index.d.ts +44 -1
- package/dist/server/index.js +77 -62
- package/package.json +1 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -126,6 +126,20 @@ interface Storage {
|
|
|
126
126
|
* The adapter uses this for compare-and-swap with symref resolution.
|
|
127
127
|
*/
|
|
128
128
|
atomicRefUpdate<T>(repoId: string, fn: (ops: RefOps) => MaybeAsync<T>): MaybeAsync<T>;
|
|
129
|
+
/**
|
|
130
|
+
* Record a fork relationship. `targetId` becomes a fork of `sourceId`.
|
|
131
|
+
* The adapter layer handles ref copying and root resolution.
|
|
132
|
+
*/
|
|
133
|
+
forkRepo?(sourceId: string, targetId: string): MaybeAsync<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Get the parent (root) repo ID for a fork, or `null` if the repo
|
|
136
|
+
* is not a fork.
|
|
137
|
+
*/
|
|
138
|
+
getForkParent?(repoId: string): MaybeAsync<string | null>;
|
|
139
|
+
/**
|
|
140
|
+
* List all direct fork IDs of a repo.
|
|
141
|
+
*/
|
|
142
|
+
listForks?(repoId: string): MaybeAsync<string[]>;
|
|
129
143
|
}
|
|
130
144
|
|
|
131
145
|
/** Options for {@link gcRepo}. */
|
|
@@ -474,8 +488,24 @@ interface GitServer<A = Auth> {
|
|
|
474
488
|
repo(id: string): Promise<GitRepo | null>;
|
|
475
489
|
/** Get a repo by ID, or throw if it doesn't exist. */
|
|
476
490
|
requireRepo(id: string): Promise<GitRepo>;
|
|
477
|
-
/** Delete a repo and all its data. */
|
|
491
|
+
/** Delete a repo and all its data. Throws if the repo has active forks. */
|
|
478
492
|
deleteRepo(id: string): Promise<void>;
|
|
493
|
+
/**
|
|
494
|
+
* Fork an existing repo. Copies refs from the source repo to the
|
|
495
|
+
* target. The fork shares the source's object pool — object reads
|
|
496
|
+
* fall through to the root repo's partition, while writes go to
|
|
497
|
+
* the fork's own partition.
|
|
498
|
+
*
|
|
499
|
+
* Forking a fork resolves to the root: `forkRepo("fork-of-A", "B")`
|
|
500
|
+
* records B as a fork of A's root, not of the intermediate fork.
|
|
501
|
+
*
|
|
502
|
+
* Requires a storage backend that implements fork methods.
|
|
503
|
+
*
|
|
504
|
+
* @throws If the source doesn't exist, the target already exists,
|
|
505
|
+
* the storage backend doesn't support forks, or the server is
|
|
506
|
+
* shutting down.
|
|
507
|
+
*/
|
|
508
|
+
forkRepo(sourceId: string, targetId: string, options?: CreateRepoOptions): Promise<GitRepo>;
|
|
479
509
|
/**
|
|
480
510
|
* Remove unreachable objects from a repo's storage.
|
|
481
511
|
*
|
|
@@ -967,6 +997,7 @@ declare class MemoryStorage implements Storage {
|
|
|
967
997
|
private repos;
|
|
968
998
|
private objects;
|
|
969
999
|
private refs;
|
|
1000
|
+
private forks;
|
|
970
1001
|
hasRepo(repoId: string): boolean;
|
|
971
1002
|
insertRepo(repoId: string): void;
|
|
972
1003
|
deleteRepo(repoId: string): void;
|
|
@@ -986,6 +1017,9 @@ declare class MemoryStorage implements Storage {
|
|
|
986
1017
|
removeRef(repoId: string, name: string): void;
|
|
987
1018
|
listRefs(repoId: string, prefix?: string): RawRefEntry[];
|
|
988
1019
|
atomicRefUpdate<T>(repoId: string, fn: (ops: RefOps) => T): T;
|
|
1020
|
+
forkRepo(sourceId: string, targetId: string): void;
|
|
1021
|
+
getForkParent(repoId: string): string | null;
|
|
1022
|
+
listForks(repoId: string): string[];
|
|
989
1023
|
/** List all created repo IDs. Convenience for tests and debugging. */
|
|
990
1024
|
repoIds(): string[];
|
|
991
1025
|
private getObjMap;
|
|
@@ -1037,6 +1071,9 @@ declare class BunSqliteStorage implements Storage {
|
|
|
1037
1071
|
removeRef(repoId: string, name: string): void;
|
|
1038
1072
|
listRefs(repoId: string, prefix?: string): RawRefEntry[];
|
|
1039
1073
|
atomicRefUpdate<T>(repoId: string, fn: (ops: RefOps) => T): T;
|
|
1074
|
+
forkRepo(sourceId: string, targetId: string): void;
|
|
1075
|
+
getForkParent(repoId: string): string | null;
|
|
1076
|
+
listForks(repoId: string): string[];
|
|
1040
1077
|
}
|
|
1041
1078
|
|
|
1042
1079
|
/** Minimal prepared statement interface matching `better-sqlite3`. */
|
|
@@ -1084,6 +1121,9 @@ declare class BetterSqlite3Storage implements Storage {
|
|
|
1084
1121
|
removeRef(repoId: string, name: string): void;
|
|
1085
1122
|
listRefs(repoId: string, prefix?: string): RawRefEntry[];
|
|
1086
1123
|
atomicRefUpdate<T>(repoId: string, fn: (ops: RefOps) => T): T;
|
|
1124
|
+
forkRepo(sourceId: string, targetId: string): void;
|
|
1125
|
+
getForkParent(repoId: string): string | null;
|
|
1126
|
+
listForks(repoId: string): string[];
|
|
1087
1127
|
}
|
|
1088
1128
|
|
|
1089
1129
|
/** Minimal pool interface matching the `pg` package's `Pool` class. */
|
|
@@ -1134,6 +1174,9 @@ declare class PgStorage implements Storage {
|
|
|
1134
1174
|
removeRef(repoId: string, name: string): Promise<void>;
|
|
1135
1175
|
listRefs(repoId: string, prefix?: string): Promise<RawRefEntry[]>;
|
|
1136
1176
|
atomicRefUpdate<T>(repoId: string, fn: (ops: RefOps) => Promise<T> | T): Promise<T>;
|
|
1177
|
+
forkRepo(sourceId: string, targetId: string): Promise<void>;
|
|
1178
|
+
getForkParent(repoId: string): Promise<string | null>;
|
|
1179
|
+
listForks(repoId: string): Promise<string[]>;
|
|
1137
1180
|
}
|
|
1138
1181
|
|
|
1139
1182
|
export { type AdvertiseRefsEvent, type AdvertiseResult, type ApplyReceivePackOptions, type Auth, type AuthProvider, type BetterSqlite3Database, BetterSqlite3Storage, type BunSqliteDatabase, BunSqliteStorage, type CreateRepoOptions, type GcOptions, type GcResult, GitRepo, type GitServer, type GitServerConfig, type MaybeAsync, MemoryStorage, type NodeHttpRequest, type NodeHttpResponse, type PgPool, PgStorage, type PostReceiveEvent, type PreReceiveEvent, type PushCommand, RawObject, type RawRefEntry, type ReceivePackResult, Ref, type RefAdvertisement, type RefOps, type RefResult, type RefUpdate, type RefUpdateRequest, type RefUpdateResult, Rejection, type ServerHooks, type ServerPolicy, type SshChannel, type SshSessionInfo, type Storage, type UpdateEvent, type V2CommandRequest, type V2FetchRequest, type V2FetchResponseOptions, type V2LsRefsRef, advertiseRefsWithHooks, applyCasRefUpdates, applyReceivePack, buildRefAdvertisementBytes, buildRefListBytes, buildRefListPktLines, buildV2CapabilityAdvertisement, buildV2CapabilityAdvertisementBytes, buildV2FetchResponse, buildV2LsRefsResponse, collectRefs, composeHooks, createServer, handleLsRefs, handleUploadPack, handleV2Fetch, ingestReceivePack, ingestReceivePackFromStream, parseV2CommandRequest, parseV2FetchArgs, resolveRefUpdates };
|