From fc0ef23bdb6742bf747037df8bac0074e18d0caa Mon Sep 17 00:00:00 2001 From: rhpidfyre Date: Sat, 8 Mar 2025 17:40:47 -0500 Subject: [PATCH] types/entry.d.ts not needed --- src/rt/rfwfs/index.ts | 2 +- src/rt/rfwfs/main.ts | 33 +++++++++++++++++++++++++-- src/rt/rfwfs/types/entry.d.ts | 42 ----------------------------------- src/rt/rfwfs/wrap.ts | 6 +++-- 4 files changed, 36 insertions(+), 47 deletions(-) delete mode 100644 src/rt/rfwfs/types/entry.d.ts diff --git a/src/rt/rfwfs/index.ts b/src/rt/rfwfs/index.ts index 549bc11..66d85a6 100644 --- a/src/rt/rfwfs/index.ts +++ b/src/rt/rfwfs/index.ts @@ -1,4 +1,4 @@ -import { type Entry } from "./types/entry" +import { type Entry } from "./main" import { wrap_bsearch, type WrapBSearch } from "./wrap" export default function directory_search(entry_collection: T[], file_name: string): WrapBSearch | undefined { diff --git a/src/rt/rfwfs/main.ts b/src/rt/rfwfs/main.ts index d305086..44d4e28 100644 --- a/src/rt/rfwfs/main.ts +++ b/src/rt/rfwfs/main.ts @@ -1,8 +1,37 @@ import { EntryType, PushStatus, ReadStatus, Permissions } from "./enum" -import { Entry, EntryCollection, FileInner, EntryFile, EntryCollectionManipulate, EntryFileInner } from "./types/entry" +import { wrap_entry, wrap_none, WrapResultEntry, WrapResultNone } from "./wrap" import directory_search from "./index" -import { wrap_entry, wrap_none, WrapResultEntry, WrapResultNone } from "./wrap" + +type FileInner = string | number + +interface Entry { + name: string, + timestamp: number, + permissions: Permissions, + //please do not change the inner values directly on entries or else there will be catastrophic consequences + readonly type: EntryType, +} +interface EntryFileInner { + __body: FileInner, + write: (item: FileInner) => boolean, + read: () => FileInner | undefined, +} +interface EntryFile extends Entry { + inner: EntryFileInner, + hash: string, +} +interface EntryCollection extends Entry { + inner: EntryCollectionManipulate, +} +interface EntryCollectionManipulate { + __body: T[], + clone: (file_name: string) => WrapResultEntry + find: (file_name: string) => WrapResultEntry + push: (entry: Entry) => WrapResultNone, + sort: () => void, + pop: (file_name: string) => WrapResultEntry, +} interface Rfwfs { directory: (name: string, permissions: Permissions, timestamp: number, inner_default: T[]) => EntryCollection, diff --git a/src/rt/rfwfs/types/entry.d.ts b/src/rt/rfwfs/types/entry.d.ts deleted file mode 100644 index f954bfe..0000000 --- a/src/rt/rfwfs/types/entry.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Permissions, ReadStatus } from "../enum" -import { WrapResultEntry } from "../wrap" - -type FileInner = string | number -type ConstEnum = number - -interface Entry { - name: string, - timestamp: number, - permissions: Permissions, - //please do not change the inner values directly on entries or else there will be catastrophic consequences - readonly type: EntryType, -} -interface EntryFileInner { - __body: FileInner, - write: (item: FileInner) => boolean, - read: () => FileInner | undefined, -} -interface EntryFile extends Entry { - inner: EntryFileInner, - hash: string, -} -interface EntryCollection extends Entry { - inner: EntryCollectionManipulate, -} -interface EntryCollectionManipulate { - __body: T[], - find: (file_name: string) => WrapResultEntry - push: (entry: Entry) => PushStatus, - sort: () => void, - pop: (file_name: string) => WrapResultEntry, -} - -export { - FileInner, - ConstEnum, - Entry, - EntryFile, - EntryFileInner, - EntryCollection, - EntryCollectionManipulate, -} \ No newline at end of file diff --git a/src/rt/rfwfs/wrap.ts b/src/rt/rfwfs/wrap.ts index 2bdaa99..d341cb7 100644 --- a/src/rt/rfwfs/wrap.ts +++ b/src/rt/rfwfs/wrap.ts @@ -1,5 +1,7 @@ import { Result } from "./enum" -import { ConstEnum, Entry } from "./types/entry" +import { type Entry } from "./main" + +type ConstEnum = number type WrapResultEntry = WrapResult type WrapBSearch = WrapResult @@ -32,7 +34,7 @@ export { wrap_entry, wrap_none, type WrapResultEntry, - type WrapBSearch, type WrapResultNone, + type WrapBSearch, type WrapResult, } \ No newline at end of file