feat: remove the file things since we now are in node

This commit is contained in:
BluJ
2023-05-04 13:10:35 -06:00
parent db517d3a84
commit a2c5b1defb
8 changed files with 74 additions and 178 deletions

View File

@@ -30,27 +30,11 @@ T extends object ? {} & {[P in keyof T]: T[P]} :
export type _<T> = FlattenIntersection<T>
/** Used to check if the file exists before hand */
export const exists = (
effects: T.Effects,
props: { path: string; volumeId: string },
) =>
effects.metadata(props).then(
(_) => true,
(_) => false,
)
export const isKnownError = (e: unknown): e is T.KnownError =>
e instanceof Object && ("error" in e || "error-code" in e)
type Cdr<A> = A extends [unknown, ...infer Cdr] ? Cdr : []
declare const affine: unique symbol
function withAffine<B>() {
return {} as { [affine]: B }
}
export type WrapperDataOptionals<WrapperData, Path extends string> = {
validator?: Parser<unknown, ExtractWrapperData<WrapperData, Path>>
/** Defaults to what ever the package currently in */
@@ -95,7 +79,6 @@ export type Utils<WD, WrapperOverWrite = { const: never }> = {
bindLan: (port: number) => Promise<LocalBinding>
networkBuilder: () => NetworkBuilder
torHostName: (id: string) => TorHostname
exists: (props: { path: string; volumeId: string }) => Promise<boolean>
nullIfEmpty: typeof nullIfEmpty
}
export const utils = <WrapperData = never, WrapperOverWrite = { const: never }>(
@@ -106,7 +89,6 @@ export const utils = <WrapperData = never, WrapperOverWrite = { const: never }>(
readFile: <A>(fileHelper: FileHelper<A>) => fileHelper.read(effects),
writeFile: <A>(fileHelper: FileHelper<A>, data: A) =>
fileHelper.write(data, effects),
exists: (props: { path: string; volumeId: string }) => exists(effects, props),
nullIfEmpty,
getWrapperData: <WrapperData = never, Path extends string = never>(
packageId: string,