types/entry.d.ts not needed
This commit is contained in:
@ -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<T extends Entry>(entry_collection: T[], file_name: string): WrapBSearch<T> | undefined {
|
||||
|
@ -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<T extends Entry> extends Entry {
|
||||
inner: EntryCollectionManipulate<T>,
|
||||
}
|
||||
interface EntryCollectionManipulate<T extends Entry> {
|
||||
__body: T[],
|
||||
clone: (file_name: string) => WrapResultEntry<T, ReadStatus>
|
||||
find: (file_name: string) => WrapResultEntry<T, ReadStatus>
|
||||
push: (entry: Entry) => WrapResultNone<PushStatus>,
|
||||
sort: () => void,
|
||||
pop: (file_name: string) => WrapResultEntry<T, ReadStatus>,
|
||||
}
|
||||
|
||||
interface Rfwfs {
|
||||
directory: <T extends Entry>(name: string, permissions: Permissions, timestamp: number, inner_default: T[]) => EntryCollection<T>,
|
||||
|
42
src/rt/rfwfs/types/entry.d.ts
vendored
42
src/rt/rfwfs/types/entry.d.ts
vendored
@ -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<T extends Entry> extends Entry {
|
||||
inner: EntryCollectionManipulate<T>,
|
||||
}
|
||||
interface EntryCollectionManipulate<T extends Entry> {
|
||||
__body: T[],
|
||||
find: (file_name: string) => WrapResultEntry<T, ReadStatus>
|
||||
push: (entry: Entry) => PushStatus,
|
||||
sort: () => void,
|
||||
pop: (file_name: string) => WrapResultEntry<T, ReadStatus>,
|
||||
}
|
||||
|
||||
export {
|
||||
FileInner,
|
||||
ConstEnum,
|
||||
Entry,
|
||||
EntryFile,
|
||||
EntryFileInner,
|
||||
EntryCollection,
|
||||
EntryCollectionManipulate,
|
||||
}
|
@ -1,5 +1,7 @@
|
||||
import { Result } from "./enum"
|
||||
import { ConstEnum, Entry } from "./types/entry"
|
||||
import { type Entry } from "./main"
|
||||
|
||||
type ConstEnum = number
|
||||
|
||||
type WrapResultEntry<T extends Entry, U> = WrapResult<T | undefined, U>
|
||||
type WrapBSearch<T extends Entry> = WrapResult<T, number>
|
||||
@ -32,7 +34,7 @@ export {
|
||||
wrap_entry,
|
||||
wrap_none,
|
||||
type WrapResultEntry,
|
||||
type WrapBSearch,
|
||||
type WrapResultNone,
|
||||
type WrapBSearch,
|
||||
type WrapResult,
|
||||
}
|
Reference in New Issue
Block a user