@legit-sdk/core 0.4.5 → 0.6.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/dist/index.d.ts +317 -65
- package/dist/index.js +186 -98
- package/dist/server.d.ts +5 -2
- package/dist/server.js +14 -9
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -557,6 +557,7 @@ declare class CompositeFs {
|
|
|
557
557
|
} | BufferEncoding | null): Promise<void>;
|
|
558
558
|
}
|
|
559
559
|
|
|
560
|
+
declare function mergeLegitRouteFolders(a: LegitRouteFolder, b: LegitRouteFolder): LegitRouteFolder;
|
|
560
561
|
declare function openLegitFsWithMemoryFs(props?: Parameters<typeof openLegitFs>[0]): Promise<CompositeFs & {
|
|
561
562
|
auth: LegitAuth;
|
|
562
563
|
sync: {
|
|
@@ -572,11 +573,32 @@ declare function openLegitFsWithMemoryFs(props?: Parameters<typeof openLegitFs>[
|
|
|
572
573
|
shareCurrentBranch: () => Promise<string>;
|
|
573
574
|
setCurrentBranch: (branch: string) => Promise<void>;
|
|
574
575
|
getCurrentBranch: () => Promise<string>;
|
|
576
|
+
/**
|
|
577
|
+
*
|
|
578
|
+
* This function takes a legit archive - earlier compressed with saveArchive and writes it to storage fs.
|
|
579
|
+
*
|
|
580
|
+
* Refs that can be fast forwarded should get updeted - referecences that cannot be fast forwarded create a ref named branchname-conflict-uuid.
|
|
581
|
+
* New Refs should be added. (TODO how do we handle deleted refs to prevent them from coming back?)
|
|
582
|
+
*
|
|
583
|
+
* The git config should get ignored for now
|
|
584
|
+
*
|
|
585
|
+
* @param legitArchieve a zlib compressed legit repo
|
|
586
|
+
*/
|
|
587
|
+
loadArchive: ({ legitArchive: legitArchive, clearExisting, }: {
|
|
588
|
+
legitArchive: Uint8Array;
|
|
589
|
+
clearExisting?: boolean;
|
|
590
|
+
}) => Promise<void>;
|
|
591
|
+
/**
|
|
592
|
+
* creates a legit archieve - a compressed representation of the legit repo (the .git folder in the storage fs)
|
|
593
|
+
*
|
|
594
|
+
* @returns
|
|
595
|
+
*/
|
|
596
|
+
saveArchive: () => Promise<Uint8Array>;
|
|
575
597
|
}>;
|
|
576
598
|
/**
|
|
577
599
|
* Creates and configures a LegitFs instance with CompositeFs, GitSubFs, HiddenFileSubFs, and EphemeralSubFs.
|
|
578
600
|
*/
|
|
579
|
-
declare function openLegitFs({ storageFs, gitRoot, anonymousBranch, showKeepFiles, initialAuthor, serverUrl, publicKey, ephemaralGitConfig, additionalFilterLayers, }: {
|
|
601
|
+
declare function openLegitFs({ storageFs, gitRoot, anonymousBranch, showKeepFiles, initialAuthor, serverUrl, publicKey, ephemaralGitConfig, additionalFilterLayers, routeOverrides, }: {
|
|
580
602
|
storageFs: typeof nodeFs;
|
|
581
603
|
gitRoot: string;
|
|
582
604
|
anonymousBranch?: string;
|
|
@@ -586,6 +608,7 @@ declare function openLegitFs({ storageFs, gitRoot, anonymousBranch, showKeepFile
|
|
|
586
608
|
publicKey?: string;
|
|
587
609
|
ephemaralGitConfig?: boolean;
|
|
588
610
|
additionalFilterLayers?: CompositeSubFs[];
|
|
611
|
+
routeOverrides?: LegitRouteFolder;
|
|
589
612
|
}): Promise<CompositeFs & {
|
|
590
613
|
auth: LegitAuth;
|
|
591
614
|
sync: {
|
|
@@ -601,6 +624,27 @@ declare function openLegitFs({ storageFs, gitRoot, anonymousBranch, showKeepFile
|
|
|
601
624
|
shareCurrentBranch: () => Promise<string>;
|
|
602
625
|
setCurrentBranch: (branch: string) => Promise<void>;
|
|
603
626
|
getCurrentBranch: () => Promise<string>;
|
|
627
|
+
/**
|
|
628
|
+
*
|
|
629
|
+
* This function takes a legit archive - earlier compressed with saveArchive and writes it to storage fs.
|
|
630
|
+
*
|
|
631
|
+
* Refs that can be fast forwarded should get updeted - referecences that cannot be fast forwarded create a ref named branchname-conflict-uuid.
|
|
632
|
+
* New Refs should be added. (TODO how do we handle deleted refs to prevent them from coming back?)
|
|
633
|
+
*
|
|
634
|
+
* The git config should get ignored for now
|
|
635
|
+
*
|
|
636
|
+
* @param legitArchieve a zlib compressed legit repo
|
|
637
|
+
*/
|
|
638
|
+
loadArchive: ({ legitArchive: legitArchive, clearExisting, }: {
|
|
639
|
+
legitArchive: Uint8Array;
|
|
640
|
+
clearExisting?: boolean;
|
|
641
|
+
}) => Promise<void>;
|
|
642
|
+
/**
|
|
643
|
+
* creates a legit archieve - a compressed representation of the legit repo (the .git folder in the storage fs)
|
|
644
|
+
*
|
|
645
|
+
* @returns
|
|
646
|
+
*/
|
|
647
|
+
saveArchive: () => Promise<Uint8Array>;
|
|
604
648
|
}>;
|
|
605
649
|
|
|
606
650
|
type FileAccess = {
|
|
@@ -791,66 +835,6 @@ declare class CopyOnWriteSubFs extends BaseCompositeSubFs {
|
|
|
791
835
|
writeFile(filePath: string, data: TData, options: IWriteFileOptions | string): Promise<void>;
|
|
792
836
|
}
|
|
793
837
|
|
|
794
|
-
/**
|
|
795
|
-
* FS utilized to provide pass-through access to the underlying filesystem
|
|
796
|
-
*/
|
|
797
|
-
declare class PassThroughSubFs extends BaseCompositeSubFs {
|
|
798
|
-
private openFh;
|
|
799
|
-
private memFs;
|
|
800
|
-
private targetFs;
|
|
801
|
-
constructor({ name, parentFs, rootPath, }: {
|
|
802
|
-
name: string;
|
|
803
|
-
parentFs: CompositeFs;
|
|
804
|
-
rootPath: string;
|
|
805
|
-
});
|
|
806
|
-
responsible(filePath: string): Promise<boolean>;
|
|
807
|
-
fileType(): number;
|
|
808
|
-
open(filePath: string, flags: string, mode?: number): Promise<CompositFsFileHandle>;
|
|
809
|
-
access(filePath: PathLike$1, mode?: number): Promise<void>;
|
|
810
|
-
stat(path: PathLike$1, opts?: {
|
|
811
|
-
bigint?: false;
|
|
812
|
-
}): Promise<nodeFs.Stats>;
|
|
813
|
-
stat(path: PathLike$1, opts: {
|
|
814
|
-
bigint: true;
|
|
815
|
-
}): Promise<nodeFs.BigIntStats>;
|
|
816
|
-
stat(path: PathLike$1, opts?: {
|
|
817
|
-
bigint?: boolean;
|
|
818
|
-
}): Promise<nodeFs.Stats | nodeFs.BigIntStats>;
|
|
819
|
-
lstat(path: PathLike$1, opts?: {
|
|
820
|
-
bigint?: false;
|
|
821
|
-
}): Promise<nodeFs.Stats>;
|
|
822
|
-
lstat(path: PathLike$1, opts: {
|
|
823
|
-
bigint: true;
|
|
824
|
-
}): Promise<nodeFs.BigIntStats>;
|
|
825
|
-
lstat(path: PathLike$1, opts?: {
|
|
826
|
-
bigint?: boolean;
|
|
827
|
-
}): Promise<nodeFs.Stats | nodeFs.BigIntStats>;
|
|
828
|
-
opendir(folderPath: nodeFs.PathLike, options?: nodeFs.OpenDirOptions): Promise<CompositeFsDir>;
|
|
829
|
-
link(existingPath: PathLike$1, newPath: PathLike$1): Promise<void>;
|
|
830
|
-
mkdir(dirPath: PathLike$1, options?: nodeFs.MakeDirectoryOptions | nodeFs.Mode | null): Promise<void>;
|
|
831
|
-
readdir(path: PathLike$1, ...args: any[]): Promise<any>;
|
|
832
|
-
readlink(path: PathLike$1, ...args: any[]): Promise<any>;
|
|
833
|
-
unlink(path: PathLike$1): Promise<void>;
|
|
834
|
-
rename(oldPath: PathLike$1, newPath: PathLike$1): Promise<void>;
|
|
835
|
-
rmdir(path: PathLike$1, options?: nodeFs.RmDirOptions): Promise<void>;
|
|
836
|
-
symlink(target: PathLike$1, path: PathLike$1, type?: string | null): Promise<void>;
|
|
837
|
-
lookup(filePath: string): Promise<number>;
|
|
838
|
-
close(fh: CompositFsFileHandle): Promise<void>;
|
|
839
|
-
dataSync(fh: CompositFsFileHandle): Promise<void>;
|
|
840
|
-
read(fh: CompositFsFileHandle, buffer: Buffer | Uint8Array, offset: number, length: number, position: number): Promise<TFileHandleReadResult>;
|
|
841
|
-
fchmod(fh: CompositFsFileHandle, mode: TMode): Promise<void>;
|
|
842
|
-
fchown(fh: CompositFsFileHandle, uid: number, gid: number): Promise<void>;
|
|
843
|
-
write(fh: CompositFsFileHandle, buffer: Buffer | ArrayBufferView | DataView, offset?: number, length?: number, position?: number): Promise<TFileHandleWriteResult>;
|
|
844
|
-
ftruncate(fh: CompositFsFileHandle, len?: number): Promise<void>;
|
|
845
|
-
resolvePath(fd: number): string;
|
|
846
|
-
fstat(fh: CompositFsFileHandle, options?: IStatOptions): Promise<IStats>;
|
|
847
|
-
futimes(fh: CompositFsFileHandle, atime: TTime, mtime: TTime): Promise<void>;
|
|
848
|
-
writev(fh: CompositFsFileHandle, buffers: ArrayBufferView[], position?: number | null): Promise<TFileHandleWritevResult>;
|
|
849
|
-
readv(fh: CompositFsFileHandle, buffers: ArrayBufferView[], position?: number | null): Promise<TFileHandleReadvResult>;
|
|
850
|
-
readFile(path: PathLike$1 | IFileHandle, options?: IReadFileOptions | string): Promise<TDataOut>;
|
|
851
|
-
writeFile(path: string, data: TData, options: IWriteFileOptions | string): Promise<void>;
|
|
852
|
-
}
|
|
853
|
-
|
|
854
838
|
type VirtualFile = {
|
|
855
839
|
type: 'file';
|
|
856
840
|
content?: string | Buffer;
|
|
@@ -866,9 +850,7 @@ type VirtualFile = {
|
|
|
866
850
|
interface VirtualFileArgs {
|
|
867
851
|
cacheFs: IFs;
|
|
868
852
|
filePath: string;
|
|
869
|
-
gitRoot: string;
|
|
870
853
|
userSpaceFs: CompositeFs;
|
|
871
|
-
nodeFs?: any;
|
|
872
854
|
pathParams: any;
|
|
873
855
|
author: {
|
|
874
856
|
name: string;
|
|
@@ -1021,6 +1003,33 @@ declare class CompositeSubFsAdapter extends BaseCompositeSubFs implements Compos
|
|
|
1021
1003
|
fileType(): number;
|
|
1022
1004
|
}
|
|
1023
1005
|
|
|
1006
|
+
/**
|
|
1007
|
+
* Creates a CompositeSubFsAdapter for legit virtual folder operations
|
|
1008
|
+
*
|
|
1009
|
+
* This adapter handles the .legit folder, which serves as the root
|
|
1010
|
+
* for all legit-related virtual files and operations.
|
|
1011
|
+
*
|
|
1012
|
+
* @example
|
|
1013
|
+
* ```ts
|
|
1014
|
+
* const adapter = createLegitVirtualFileAdapter({
|
|
1015
|
+
* gitStorageFs: memFs,
|
|
1016
|
+
* gitRoot: '/my-repo',
|
|
1017
|
+
* });
|
|
1018
|
+
*
|
|
1019
|
+
* // Use in CompositeFs routes
|
|
1020
|
+
* const compositeFs = new CompositeFs({
|
|
1021
|
+
* routes: {
|
|
1022
|
+
* '.legit': adapter,
|
|
1023
|
+
* },
|
|
1024
|
+
* });
|
|
1025
|
+
* ```
|
|
1026
|
+
*/
|
|
1027
|
+
declare function createLegitVirtualFileAdapter({ gitStorageFs, gitRoot, rootPath, }: {
|
|
1028
|
+
gitStorageFs: any;
|
|
1029
|
+
gitRoot: string;
|
|
1030
|
+
rootPath?: string;
|
|
1031
|
+
}): CompositeSubFsAdapter;
|
|
1032
|
+
|
|
1024
1033
|
type Operation = {
|
|
1025
1034
|
oid: string;
|
|
1026
1035
|
parentOids: string[];
|
|
@@ -1074,5 +1083,248 @@ type HistoryItem = {
|
|
|
1074
1083
|
author: User;
|
|
1075
1084
|
};
|
|
1076
1085
|
|
|
1077
|
-
|
|
1078
|
-
|
|
1086
|
+
declare abstract class ASimpleCompositeSubfs extends BaseCompositeSubFs implements CompositeSubFs {
|
|
1087
|
+
private memFs;
|
|
1088
|
+
private openFh;
|
|
1089
|
+
constructor({ name, rootPath }: {
|
|
1090
|
+
name: string;
|
|
1091
|
+
rootPath: string;
|
|
1092
|
+
});
|
|
1093
|
+
/**
|
|
1094
|
+
* Check if write operations are supported by this adapter
|
|
1095
|
+
* Subclasses can override this to return false for read-only adapters
|
|
1096
|
+
*/
|
|
1097
|
+
isWriteSupported(): boolean;
|
|
1098
|
+
responsible(_filePath: string): Promise<boolean>;
|
|
1099
|
+
/**
|
|
1100
|
+
* Get route parameters from the operation context
|
|
1101
|
+
* CompositeFs sets this context when routing to this adapter
|
|
1102
|
+
*/
|
|
1103
|
+
private getRouteParams;
|
|
1104
|
+
/**
|
|
1105
|
+
* Get static siblings from the operation context
|
|
1106
|
+
* These are static entries that should appear in directory listings
|
|
1107
|
+
*/
|
|
1108
|
+
private getStaticSiblings;
|
|
1109
|
+
/**
|
|
1110
|
+
* Opens a virtual file using the configured handler.
|
|
1111
|
+
*
|
|
1112
|
+
* The handler receives route parameters via context set by CompositeFs.
|
|
1113
|
+
*/
|
|
1114
|
+
open(filePath: string, flags: string, mode?: number): Promise<CompositFsFileHandle>;
|
|
1115
|
+
abstract createDirectory(args: {
|
|
1116
|
+
path: string;
|
|
1117
|
+
recursive?: boolean;
|
|
1118
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1119
|
+
}): Promise<void>;
|
|
1120
|
+
abstract readFileContent(args: {
|
|
1121
|
+
path: string;
|
|
1122
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1123
|
+
}): Promise<{
|
|
1124
|
+
content: string | Buffer;
|
|
1125
|
+
oid?: string;
|
|
1126
|
+
} | undefined>;
|
|
1127
|
+
abstract writeFileContent(args: {
|
|
1128
|
+
path: string;
|
|
1129
|
+
content: Buffer | string;
|
|
1130
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1131
|
+
}): Promise<void>;
|
|
1132
|
+
abstract readDirectory(args: {
|
|
1133
|
+
path: string;
|
|
1134
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1135
|
+
}): Promise<nodeFs.Dirent[]>;
|
|
1136
|
+
abstract renamePath(args: {
|
|
1137
|
+
oldPath: string;
|
|
1138
|
+
newPath: string;
|
|
1139
|
+
oldContext: ASimpleCompositeSubfs['context'];
|
|
1140
|
+
newContext: ASimpleCompositeSubfs['context'];
|
|
1141
|
+
}): Promise<void>;
|
|
1142
|
+
abstract deleteFile(args: {
|
|
1143
|
+
path: string;
|
|
1144
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1145
|
+
}): Promise<void>;
|
|
1146
|
+
abstract removeDirectory(args: {
|
|
1147
|
+
path: string;
|
|
1148
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1149
|
+
}): Promise<void>;
|
|
1150
|
+
mkdir(path: PathLike, options?: nodeFs.MakeDirectoryOptions | nodeFs.Mode | null): Promise<void>;
|
|
1151
|
+
access(path: PathLike, _mode?: number): Promise<void>;
|
|
1152
|
+
futimes(fh: CompositFsFileHandle, atime: TTime, mtime: TTime): Promise<void>;
|
|
1153
|
+
fstat(fh: CompositFsFileHandle, options?: IStatOptions): Promise<IStats>;
|
|
1154
|
+
ftruncate(fh: CompositFsFileHandle, len?: number): Promise<void>;
|
|
1155
|
+
stat(path: PathLike, opts?: {
|
|
1156
|
+
bigint?: false;
|
|
1157
|
+
}): Promise<nodeFs.Stats>;
|
|
1158
|
+
stat(path: PathLike, opts: {
|
|
1159
|
+
bigint: true;
|
|
1160
|
+
}): Promise<nodeFs.BigIntStats>;
|
|
1161
|
+
stat(path: PathLike, opts?: {
|
|
1162
|
+
bigint?: boolean;
|
|
1163
|
+
}): Promise<nodeFs.Stats | nodeFs.BigIntStats>;
|
|
1164
|
+
abstract getStats(args: {
|
|
1165
|
+
path: string;
|
|
1166
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1167
|
+
}): Promise<nodeFs.Stats>;
|
|
1168
|
+
lstat(path: PathLike, opts?: {
|
|
1169
|
+
bigint?: false;
|
|
1170
|
+
}): Promise<nodeFs.Stats>;
|
|
1171
|
+
lstat(path: PathLike, opts: {
|
|
1172
|
+
bigint: true;
|
|
1173
|
+
}): Promise<nodeFs.BigIntStats>;
|
|
1174
|
+
lstat(path: PathLike, opts?: {
|
|
1175
|
+
bigint?: boolean;
|
|
1176
|
+
}): Promise<nodeFs.Stats | nodeFs.BigIntStats>;
|
|
1177
|
+
readdir(path: PathLike, options?: (nodeFs.ObjectEncodingOptions & {
|
|
1178
|
+
withFileTypes?: false | undefined;
|
|
1179
|
+
recursive?: boolean | undefined;
|
|
1180
|
+
}) | BufferEncoding | null): Promise<string[]>;
|
|
1181
|
+
readdir(path: PathLike, options?: {
|
|
1182
|
+
encoding: 'buffer';
|
|
1183
|
+
withFileTypes?: false | undefined;
|
|
1184
|
+
recursive?: boolean | undefined;
|
|
1185
|
+
} | 'buffer' | null): Promise<Buffer[]>;
|
|
1186
|
+
readdir(path: PathLike, options?: (nodeFs.ObjectEncodingOptions & {
|
|
1187
|
+
withFileTypes?: false | undefined;
|
|
1188
|
+
recursive?: boolean | undefined;
|
|
1189
|
+
}) | BufferEncoding | null): Promise<string[] | Buffer[]>;
|
|
1190
|
+
readdir(path: PathLike, options: nodeFs.ObjectEncodingOptions & {
|
|
1191
|
+
withFileTypes: true;
|
|
1192
|
+
recursive?: boolean | undefined;
|
|
1193
|
+
}): Promise<nodeFs.Dirent[]>;
|
|
1194
|
+
read(fh: CompositFsFileHandle, buffer: Buffer | Uint8Array, offset: number, length: number, position: number): Promise<TFileHandleReadResult>;
|
|
1195
|
+
/**
|
|
1196
|
+
*
|
|
1197
|
+
* Writes (parts) of a buffer to a specific position in the file
|
|
1198
|
+
*
|
|
1199
|
+
* - a write leads to a new commit and on flush since the point in time a flush may occur may vary a read operation may
|
|
1200
|
+
* not see changed done on the read lays.
|
|
1201
|
+
*
|
|
1202
|
+
*
|
|
1203
|
+
* @param fh
|
|
1204
|
+
* @param buffer
|
|
1205
|
+
* @param offset
|
|
1206
|
+
* @param length
|
|
1207
|
+
* @param position
|
|
1208
|
+
* @returns
|
|
1209
|
+
*/
|
|
1210
|
+
write(fh: CompositFsFileHandle, buffer: Buffer | ArrayBufferView | DataView, offset?: number, length?: number, position?: number): Promise<TFileHandleWriteResult>;
|
|
1211
|
+
close(fh: CompositFsFileHandle): Promise<void>;
|
|
1212
|
+
dataSync(fh: CompositFsFileHandle): Promise<void>;
|
|
1213
|
+
readFile(path: PathLike | IFileHandle, options?: IReadFileOptions | string): Promise<TDataOut>;
|
|
1214
|
+
writeFile(path: string, data: TData, options?: IWriteFileOptions | string): Promise<void>;
|
|
1215
|
+
rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
|
|
1216
|
+
fchmod(_fh: CompositFsFileHandle, _mode: TMode): Promise<void>;
|
|
1217
|
+
unlink(path: PathLike): Promise<void>;
|
|
1218
|
+
rmdir(path: PathLike, ..._args: any[]): Promise<void>;
|
|
1219
|
+
fileType(): number;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
interface MemoryFile {
|
|
1223
|
+
type: 'file';
|
|
1224
|
+
content: Buffer;
|
|
1225
|
+
mode: number;
|
|
1226
|
+
createdAt: Date;
|
|
1227
|
+
modifiedAt: Date;
|
|
1228
|
+
}
|
|
1229
|
+
interface MemoryDirectory {
|
|
1230
|
+
type: 'directory';
|
|
1231
|
+
entries: Set<string>;
|
|
1232
|
+
mode: number;
|
|
1233
|
+
createdAt: Date;
|
|
1234
|
+
modifiedAt: Date;
|
|
1235
|
+
}
|
|
1236
|
+
type MemoryNode = MemoryFile | MemoryDirectory;
|
|
1237
|
+
type FileSystemData = string | {
|
|
1238
|
+
[key: string]: FileSystemData;
|
|
1239
|
+
};
|
|
1240
|
+
/**
|
|
1241
|
+
* SimpleMemorySubFs - A simple in-memory filesystem implementation
|
|
1242
|
+
*
|
|
1243
|
+
* This class extends ASimpleCompositeSubfs and stores all files and directories
|
|
1244
|
+
* in a JavaScript Map in memory. It's useful for testing, caching, or temporary
|
|
1245
|
+
* file storage that doesn't need to persist.
|
|
1246
|
+
*/
|
|
1247
|
+
declare class SimpleMemorySubFs extends ASimpleCompositeSubfs {
|
|
1248
|
+
private storage;
|
|
1249
|
+
private nextFileType;
|
|
1250
|
+
/**
|
|
1251
|
+
* Debug method to inspect internal storage
|
|
1252
|
+
*/
|
|
1253
|
+
_debugGetStorage(): Map<string, MemoryNode>;
|
|
1254
|
+
constructor({ name, rootPath, initialData, }: {
|
|
1255
|
+
name: string;
|
|
1256
|
+
rootPath: string;
|
|
1257
|
+
initialData?: FileSystemData;
|
|
1258
|
+
});
|
|
1259
|
+
/**
|
|
1260
|
+
* Populate the filesystem from initial data structure
|
|
1261
|
+
* @param data - The data structure to populate from (string = file, object = folder)
|
|
1262
|
+
* @param currentPath - The current path in the filesystem
|
|
1263
|
+
*/
|
|
1264
|
+
private populateFromInitialData;
|
|
1265
|
+
fileType(): number;
|
|
1266
|
+
createDirectory(args: {
|
|
1267
|
+
path: string;
|
|
1268
|
+
recursive?: boolean;
|
|
1269
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1270
|
+
}): Promise<void>;
|
|
1271
|
+
getStats(args: {
|
|
1272
|
+
path: string;
|
|
1273
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1274
|
+
}): Promise<nodeFs.Stats>;
|
|
1275
|
+
readFileContent(args: {
|
|
1276
|
+
path: string;
|
|
1277
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1278
|
+
}): Promise<{
|
|
1279
|
+
content: string | Buffer;
|
|
1280
|
+
oid?: string;
|
|
1281
|
+
} | undefined>;
|
|
1282
|
+
writeFileContent(args: {
|
|
1283
|
+
path: string;
|
|
1284
|
+
content: Buffer | string;
|
|
1285
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1286
|
+
}): Promise<void>;
|
|
1287
|
+
readDirectory(args: {
|
|
1288
|
+
path: string;
|
|
1289
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1290
|
+
}): Promise<nodeFs.Dirent[]>;
|
|
1291
|
+
renamePath(args: {
|
|
1292
|
+
oldPath: string;
|
|
1293
|
+
newPath: string;
|
|
1294
|
+
oldContext: ASimpleCompositeSubfs['context'];
|
|
1295
|
+
newContext: ASimpleCompositeSubfs['context'];
|
|
1296
|
+
}): Promise<void>;
|
|
1297
|
+
deleteFile(args: {
|
|
1298
|
+
path: string;
|
|
1299
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1300
|
+
}): Promise<void>;
|
|
1301
|
+
removeDirectory(args: {
|
|
1302
|
+
path: string;
|
|
1303
|
+
context: ASimpleCompositeSubfs['context'];
|
|
1304
|
+
}): Promise<void>;
|
|
1305
|
+
/**
|
|
1306
|
+
* Normalize a path to ensure consistent format
|
|
1307
|
+
*/
|
|
1308
|
+
private normalizePath;
|
|
1309
|
+
/**
|
|
1310
|
+
* Get the parent directory path
|
|
1311
|
+
*/
|
|
1312
|
+
private getParentPath;
|
|
1313
|
+
/**
|
|
1314
|
+
* Get the base name of a path
|
|
1315
|
+
*/
|
|
1316
|
+
private getBaseName;
|
|
1317
|
+
/**
|
|
1318
|
+
* Join path segments
|
|
1319
|
+
*/
|
|
1320
|
+
private joinPath;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
declare function toDirEntry(args: {
|
|
1324
|
+
parent: string;
|
|
1325
|
+
name: string;
|
|
1326
|
+
isDir: boolean;
|
|
1327
|
+
}): nodeFs.Dirent;
|
|
1328
|
+
|
|
1329
|
+
export { ASimpleCompositeSubfs, CompositeFs, CompositeSubFsAdapter, CopyOnWriteSubFs, EphemeralSubFs, HiddenFileSubFs, SimpleMemorySubFs, createBranchOperationsAdapter, createFsOperationFileLogger, createLegitSyncService, createLegitVirtualFileAdapter, getLegitFsAccess, mergeLegitRouteFolders, openLegitFs, openLegitFsWithMemoryFs, toDirEntry };
|
|
1330
|
+
export type { FileSystemData, FsOperationLogger, HistoryItem, Operation, User };
|