@zenfs/core 0.12.9 → 0.13.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.
@@ -26,6 +26,15 @@ export type OptionsConfig<T> = {
26
26
  validator?(opt: T[K]): void | Promise<void>;
27
27
  };
28
28
  };
29
+ /**
30
+ * Configuration options shared by backends and `Configuration`
31
+ */
32
+ export interface SharedConfig {
33
+ /**
34
+ * If set, disables the sync cache and sync operations on async file systems.
35
+ */
36
+ disableAsyncCache: boolean;
37
+ }
29
38
  /**
30
39
  * A backend
31
40
  */
@@ -33,7 +42,7 @@ export interface Backend<FS extends FileSystem = FileSystem, TOptions extends ob
33
42
  /**
34
43
  * Create a new instance of the backend
35
44
  */
36
- create(options: TOptions): FS | Promise<FS>;
45
+ create(options: TOptions & Partial<SharedConfig>): FS | Promise<FS>;
37
46
  /**
38
47
  * A name to identify the backend.
39
48
  */
@@ -81,9 +90,8 @@ export declare function checkOptions<T extends Backend>(backend: T, opts: Record
81
90
  *
82
91
  * The option object for each file system corresponds to that file system's option object passed to its `Create()` method.
83
92
  */
84
- export type BackendConfiguration<T extends Backend> = OptionsOf<T> & {
93
+ export type BackendConfiguration<T extends Backend> = OptionsOf<T> & Partial<SharedConfig> & {
85
94
  backend: T;
86
- disableAsyncCache?: boolean;
87
95
  };
88
96
  /**
89
97
  * @internal
@@ -4,7 +4,7 @@ import { FileSystem } from '../../filesystem.js';
4
4
  import type { Stats } from '../../stats.js';
5
5
  import type { IndexData } from './index.js';
6
6
  import { Index } from './index.js';
7
- declare const IndexFS_base: (abstract new (...args: any[]) => {
7
+ declare const IndexFS_base: import("../../filesystem.js").Mixin<typeof FileSystem, {
8
8
  metadata(): import("../../filesystem.js").FileSystemMetadata;
9
9
  rename(oldPath: string, newPath: string, cred: Cred): Promise<void>;
10
10
  renameSync(oldPath: string, newPath: string, cred: Cred): void;
@@ -20,17 +20,7 @@ declare const IndexFS_base: (abstract new (...args: any[]) => {
20
20
  linkSync(srcpath: string, dstpath: string, cred: Cred): void;
21
21
  sync(path: string, data: Uint8Array, stats: Readonly<Stats>): Promise<void>;
22
22
  syncSync(path: string, data: Uint8Array, stats: Readonly<Stats>): void;
23
- _disableSync?: boolean | undefined;
24
- ready(): Promise<void>;
25
- stat(path: string, cred: Cred): Promise<Stats>;
26
- statSync(path: string, cred: Cred): Stats;
27
- openFile(path: string, flag: string, cred: Cred): Promise<import("../../file.js").File>;
28
- openFileSync(path: string, flag: string, cred: Cred): import("../../file.js").File;
29
- readdir(path: string, cred: Cred): Promise<string[]>;
30
- readdirSync(path: string, cred: Cred): string[];
31
- exists(path: string, cred: Cred): Promise<boolean>;
32
- existsSync(path: string, cred: Cred): boolean;
33
- }) & typeof FileSystem;
23
+ }>;
34
24
  export declare abstract class IndexFS extends IndexFS_base {
35
25
  private indexData;
36
26
  protected index: Index;
@@ -40,10 +40,9 @@ export declare class PortFile extends File {
40
40
  }
41
41
  type FSMethods = ExtractProperties<FileSystem, (...args: any[]) => Promise<any> | FileSystemMetadata>;
42
42
  type FSMethod = keyof FSMethods;
43
- declare const PortFS_base: (abstract new (...args: any[]) => {
43
+ declare const PortFS_base: import("../../filesystem.js").Mixin<typeof FileSystem, {
44
44
  _sync?: FileSystem | undefined;
45
45
  queueDone(): Promise<void>;
46
- metadata(): FileSystemMetadata;
47
46
  ready(): Promise<void>;
48
47
  renameSync(oldPath: string, newPath: string, cred: Cred): void;
49
48
  statSync(path: string, cred: Cred): Stats;
@@ -55,20 +54,7 @@ declare const PortFS_base: (abstract new (...args: any[]) => {
55
54
  readdirSync(path: string, cred: Cred): string[];
56
55
  linkSync(srcpath: string, dstpath: string, cred: Cred): void;
57
56
  syncSync(path: string, data: Uint8Array, stats: Readonly<Stats>): void;
58
- _disableSync?: boolean | undefined;
59
- rename(oldPath: string, newPath: string, cred: Cred): Promise<void>;
60
- stat(path: string, cred: Cred): Promise<Stats>;
61
- openFile(path: string, flag: string, cred: Cred): Promise<File>;
62
- createFile(path: string, flag: string, mode: number, cred: Cred): Promise<File>;
63
- unlink(path: string, cred: Cred): Promise<void>;
64
- rmdir(path: string, cred: Cred): Promise<void>;
65
- mkdir(path: string, mode: number, cred: Cred): Promise<void>;
66
- readdir(path: string, cred: Cred): Promise<string[]>;
67
- exists(path: string, cred: Cred): Promise<boolean>;
68
- existsSync(path: string, cred: Cred): boolean;
69
- link(srcpath: string, dstpath: string, cred: Cred): Promise<void>;
70
- sync(path: string, data: Uint8Array, stats: Readonly<Stats>): Promise<void>;
71
- }) & typeof FileSystem;
57
+ }>;
72
58
  /**
73
59
  * PortFS lets you access a ZenFS instance that is running in a port, or the other way around.
74
60
  *