buritifs 0.0.1
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/LICENSE +21 -0
- package/README.md +209 -0
- package/dist/chunk-QOM3Q3WE.js +803 -0
- package/dist/chunk-QOM3Q3WE.js.map +1 -0
- package/dist/index.cjs +831 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +303 -0
- package/dist/index.d.ts +303 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/react/index.cjs +943 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +34 -0
- package/dist/react/index.d.ts +34 -0
- package/dist/react/index.js +120 -0
- package/dist/react/index.js.map +1 -0
- package/package.json +67 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
declare class ExplorerFile {
|
|
2
|
+
private base;
|
|
3
|
+
private storage;
|
|
4
|
+
readonly ok: true;
|
|
5
|
+
readonly error: null;
|
|
6
|
+
readonly type: 'file';
|
|
7
|
+
get path(): string;
|
|
8
|
+
constructor(base: string, storage: ExplorerTree);
|
|
9
|
+
info(): Promise<ReturnedExplorerInfoType>;
|
|
10
|
+
rename({ name }: {
|
|
11
|
+
name: string;
|
|
12
|
+
}): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
13
|
+
copy({ to, priority }: {
|
|
14
|
+
to: string;
|
|
15
|
+
priority?: 'source' | 'destination';
|
|
16
|
+
}): Promise<ReturnedExplorerFileType>;
|
|
17
|
+
move({ to, force }: {
|
|
18
|
+
to: string;
|
|
19
|
+
force?: boolean;
|
|
20
|
+
}): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
21
|
+
delete(): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
22
|
+
exists(): Promise<boolean>;
|
|
23
|
+
write({ content }: {
|
|
24
|
+
content: ArrayBuffer | string | object;
|
|
25
|
+
}): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
26
|
+
read(): Promise<ReturnedExplorerReadType>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare class ExplorerFolder {
|
|
30
|
+
private base;
|
|
31
|
+
private storage;
|
|
32
|
+
readonly ok: true;
|
|
33
|
+
readonly error: null;
|
|
34
|
+
readonly type: 'folder';
|
|
35
|
+
get path(): string;
|
|
36
|
+
get tree(): ExplorerTree;
|
|
37
|
+
constructor(base: string, storage: ExplorerTree);
|
|
38
|
+
info(): Promise<ReturnedExplorerInfoType>;
|
|
39
|
+
get({ name }: {
|
|
40
|
+
name: string;
|
|
41
|
+
}): Promise<ReturnedExplorerFileType | ReturnedExplorerFolderType>;
|
|
42
|
+
newFolder({ name }: {
|
|
43
|
+
name: string;
|
|
44
|
+
}): Promise<ReturnedExplorerFolderType>;
|
|
45
|
+
newFile({ name }: {
|
|
46
|
+
name: string;
|
|
47
|
+
}): Promise<ReturnedExplorerFileType>;
|
|
48
|
+
rename({ name }: {
|
|
49
|
+
name: string;
|
|
50
|
+
}): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
51
|
+
copy({ to, merge, priority }: {
|
|
52
|
+
to: string;
|
|
53
|
+
merge?: boolean;
|
|
54
|
+
priority?: 'source' | 'destination';
|
|
55
|
+
}): Promise<ReturnedExplorerFolderType>;
|
|
56
|
+
move({ to, force }: {
|
|
57
|
+
to: string;
|
|
58
|
+
force?: boolean;
|
|
59
|
+
}): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
60
|
+
delete(): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
61
|
+
list({ recursive, limit, page, filter }?: {
|
|
62
|
+
recursive?: boolean;
|
|
63
|
+
limit?: number;
|
|
64
|
+
page?: number;
|
|
65
|
+
filter?: (item: ListItem) => boolean;
|
|
66
|
+
}): Promise<ReturnedExplorerListType>;
|
|
67
|
+
exists(): Promise<boolean>;
|
|
68
|
+
size({ recursive, filter }?: {
|
|
69
|
+
recursive?: boolean;
|
|
70
|
+
filter?: (item: ListItem) => boolean;
|
|
71
|
+
}): Promise<ReturnedExplorerSizeType>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type PropsClassMainType = {
|
|
75
|
+
name: string;
|
|
76
|
+
};
|
|
77
|
+
type PropsClassAddNoteBD = {
|
|
78
|
+
path: string;
|
|
79
|
+
type: 'file' | 'folder';
|
|
80
|
+
};
|
|
81
|
+
type ReturnedErrorOrSucessExplorerType = {
|
|
82
|
+
ok: false;
|
|
83
|
+
error: string;
|
|
84
|
+
} | {
|
|
85
|
+
ok: true;
|
|
86
|
+
error: null;
|
|
87
|
+
};
|
|
88
|
+
type ReturnedExplorerReadType = {
|
|
89
|
+
ok: false;
|
|
90
|
+
error: string;
|
|
91
|
+
} | {
|
|
92
|
+
ok: true;
|
|
93
|
+
error: null;
|
|
94
|
+
content: ArrayBuffer;
|
|
95
|
+
text: string;
|
|
96
|
+
};
|
|
97
|
+
type ListItem = {
|
|
98
|
+
path: string;
|
|
99
|
+
type: 'file' | 'folder';
|
|
100
|
+
createdAt: number;
|
|
101
|
+
updatedAt: number;
|
|
102
|
+
};
|
|
103
|
+
type ExplorerInfoData = {
|
|
104
|
+
path: string;
|
|
105
|
+
createdAt: number;
|
|
106
|
+
updatedAt: number;
|
|
107
|
+
};
|
|
108
|
+
type ReturnedExplorerInfoType = {
|
|
109
|
+
ok: false;
|
|
110
|
+
error: string;
|
|
111
|
+
} | ({
|
|
112
|
+
ok: true;
|
|
113
|
+
error: null;
|
|
114
|
+
} & ExplorerInfoData);
|
|
115
|
+
type ReturnedExplorerListType = {
|
|
116
|
+
ok: false;
|
|
117
|
+
error: string;
|
|
118
|
+
} | {
|
|
119
|
+
ok: true;
|
|
120
|
+
error: null;
|
|
121
|
+
items: ListItem[];
|
|
122
|
+
};
|
|
123
|
+
type ReturnedExplorerSizeType = {
|
|
124
|
+
ok: false;
|
|
125
|
+
error: string;
|
|
126
|
+
} | {
|
|
127
|
+
ok: true;
|
|
128
|
+
error: null;
|
|
129
|
+
size: number;
|
|
130
|
+
};
|
|
131
|
+
type ReturnedErrorExplorerType = {
|
|
132
|
+
ok: false;
|
|
133
|
+
error: string;
|
|
134
|
+
};
|
|
135
|
+
type ReturnedExplorerFolderType = ReturnedErrorExplorerType | ExplorerFolder;
|
|
136
|
+
type ReturnedExplorerFileType = ReturnedErrorExplorerType | ExplorerFile;
|
|
137
|
+
interface TableBuritiTypeBDBase {
|
|
138
|
+
path: string;
|
|
139
|
+
parent: string | null;
|
|
140
|
+
createdAt: number;
|
|
141
|
+
updatedAt: number;
|
|
142
|
+
status: 'pending' | 'ready';
|
|
143
|
+
}
|
|
144
|
+
interface TableBuritiTypeBDFolder extends TableBuritiTypeBDBase {
|
|
145
|
+
type: 'folder';
|
|
146
|
+
}
|
|
147
|
+
interface TableBuritiTypeBDFile extends TableBuritiTypeBDBase {
|
|
148
|
+
type: 'file';
|
|
149
|
+
contentId: string;
|
|
150
|
+
}
|
|
151
|
+
type TableBuritiTypeBD = TableBuritiTypeBDFolder | TableBuritiTypeBDFile;
|
|
152
|
+
|
|
153
|
+
declare class IDBSetup {
|
|
154
|
+
private static registry;
|
|
155
|
+
protected db: IDBDatabase | null;
|
|
156
|
+
private dbName;
|
|
157
|
+
private static readonly DB_VERSION;
|
|
158
|
+
constructor({ name }: PropsClassMainType);
|
|
159
|
+
protected request<T>(mode: IDBTransactionMode, fn: (store: IDBObjectStore) => IDBRequest<T>): Promise<T>;
|
|
160
|
+
protected transact(mode: IDBTransactionMode, fn: (store: IDBObjectStore) => void): Promise<void>;
|
|
161
|
+
protected pathTrated(path: string): Promise<{
|
|
162
|
+
path: string;
|
|
163
|
+
parent: string | null;
|
|
164
|
+
name: string;
|
|
165
|
+
table: TableBuritiTypeBD | null;
|
|
166
|
+
}>;
|
|
167
|
+
protected withWAL(data: TableBuritiTypeBD, action: () => Promise<void>): Promise<void>;
|
|
168
|
+
protected openDB(): Promise<void>;
|
|
169
|
+
static close({ name }: {
|
|
170
|
+
name: string;
|
|
171
|
+
}): void;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
declare class OPFSStorage extends IDBSetup {
|
|
175
|
+
protected root: FileSystemDirectoryHandle;
|
|
176
|
+
constructor(props: PropsClassMainType);
|
|
177
|
+
protected openStorage(): Promise<void>;
|
|
178
|
+
protected writeStorage(id: string, content: ArrayBuffer | string | object): Promise<void>;
|
|
179
|
+
protected readStorage(id: string): Promise<ArrayBuffer>;
|
|
180
|
+
protected readTextStorage(id: string): Promise<string>;
|
|
181
|
+
protected deleteStorage(id: string): Promise<void>;
|
|
182
|
+
protected existsStorage(id: string): Promise<boolean>;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
declare class IDBNodes extends OPFSStorage {
|
|
186
|
+
constructor(props: PropsClassMainType);
|
|
187
|
+
protected getSource(props: {
|
|
188
|
+
path: string;
|
|
189
|
+
}): Promise<TableBuritiTypeBD>;
|
|
190
|
+
protected addNode({ path, type }: PropsClassAddNoteBD): Promise<void>;
|
|
191
|
+
protected removeNode({ path }: {
|
|
192
|
+
path: string;
|
|
193
|
+
}): Promise<void>;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
declare class IDBQuery extends IDBNodes {
|
|
197
|
+
constructor(props: PropsClassMainType);
|
|
198
|
+
protected existsNode({ path }: {
|
|
199
|
+
path: string;
|
|
200
|
+
}): Promise<boolean>;
|
|
201
|
+
protected sizeNode({ pathRef, recursive, filter, }: {
|
|
202
|
+
pathRef: string;
|
|
203
|
+
recursive?: boolean;
|
|
204
|
+
filter?: (item: ListItem) => boolean;
|
|
205
|
+
}): Promise<number>;
|
|
206
|
+
protected listNodes({ pathRef, recursive, limit, page, filter, }: {
|
|
207
|
+
pathRef: string;
|
|
208
|
+
recursive?: boolean;
|
|
209
|
+
limit?: number;
|
|
210
|
+
page?: number;
|
|
211
|
+
filter?: (item: ListItem) => boolean;
|
|
212
|
+
}): Promise<ListItem[]>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
declare class IDBRefactor extends IDBQuery {
|
|
216
|
+
constructor(props: PropsClassMainType);
|
|
217
|
+
protected copyNode({ fromPath, toPath, merge, priority, }: {
|
|
218
|
+
fromPath: string;
|
|
219
|
+
toPath: string;
|
|
220
|
+
merge?: boolean;
|
|
221
|
+
priority?: 'source' | 'destination';
|
|
222
|
+
}): Promise<void>;
|
|
223
|
+
protected moveNode({ fromPath, toPath, force, }: {
|
|
224
|
+
fromPath: string;
|
|
225
|
+
toPath: string;
|
|
226
|
+
force?: boolean;
|
|
227
|
+
}): Promise<void>;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
declare class StorageInit extends IDBRefactor {
|
|
231
|
+
constructor(props: PropsClassMainType);
|
|
232
|
+
protected initExplorerData(): Promise<void>;
|
|
233
|
+
private recover;
|
|
234
|
+
private recoverPending;
|
|
235
|
+
private recoverOrphans;
|
|
236
|
+
private recoverBroken;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
declare class ExplorerTree extends StorageInit {
|
|
240
|
+
private listeners;
|
|
241
|
+
private constructor();
|
|
242
|
+
subscribe(path: string, fn: () => void): () => void;
|
|
243
|
+
private parentOf;
|
|
244
|
+
private notify;
|
|
245
|
+
static create(props: PropsClassMainType): Promise<ExplorerTree | ReturnedErrorExplorerType>;
|
|
246
|
+
source({ path }: {
|
|
247
|
+
path: string;
|
|
248
|
+
}): Promise<ReturnedExplorerFileType | ReturnedExplorerFolderType>;
|
|
249
|
+
info({ path }: {
|
|
250
|
+
path: string;
|
|
251
|
+
}): Promise<ReturnedExplorerInfoType>;
|
|
252
|
+
type({ path }: {
|
|
253
|
+
path: string;
|
|
254
|
+
}): Promise<string | null>;
|
|
255
|
+
newFolder({ path }: {
|
|
256
|
+
path: string;
|
|
257
|
+
}): Promise<ReturnedExplorerFolderType>;
|
|
258
|
+
newFile({ path }: {
|
|
259
|
+
path: string;
|
|
260
|
+
}): Promise<ReturnedExplorerFileType>;
|
|
261
|
+
delete({ path }: {
|
|
262
|
+
path: string;
|
|
263
|
+
}): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
264
|
+
copy({ fromPath, toPath, merge, priority }: {
|
|
265
|
+
fromPath: string;
|
|
266
|
+
toPath: string;
|
|
267
|
+
merge?: boolean;
|
|
268
|
+
priority?: 'source' | 'destination';
|
|
269
|
+
}): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
270
|
+
move({ fromPath, toPath, force }: {
|
|
271
|
+
fromPath: string;
|
|
272
|
+
toPath: string;
|
|
273
|
+
force?: boolean;
|
|
274
|
+
}): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
275
|
+
rename({ path, name }: {
|
|
276
|
+
path: string;
|
|
277
|
+
name: string;
|
|
278
|
+
}): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
279
|
+
list({ path, recursive, limit, page, filter }: {
|
|
280
|
+
path: string;
|
|
281
|
+
recursive?: boolean;
|
|
282
|
+
limit?: number;
|
|
283
|
+
page?: number;
|
|
284
|
+
filter?: (item: ListItem) => boolean;
|
|
285
|
+
}): Promise<ReturnedExplorerListType>;
|
|
286
|
+
exists({ path }: {
|
|
287
|
+
path: string;
|
|
288
|
+
}): Promise<boolean>;
|
|
289
|
+
size({ path, recursive, filter }: {
|
|
290
|
+
path: string;
|
|
291
|
+
recursive?: boolean;
|
|
292
|
+
filter?: (item: ListItem) => boolean;
|
|
293
|
+
}): Promise<ReturnedExplorerSizeType>;
|
|
294
|
+
write({ path, content }: {
|
|
295
|
+
path: string;
|
|
296
|
+
content: ArrayBuffer | string | object;
|
|
297
|
+
}): Promise<ReturnedErrorOrSucessExplorerType>;
|
|
298
|
+
read({ path }: {
|
|
299
|
+
path: string;
|
|
300
|
+
}): Promise<ReturnedExplorerReadType>;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export { ExplorerFile, ExplorerFolder, ExplorerTree, type ListItem, type PropsClassMainType, type ReturnedErrorOrSucessExplorerType, type ReturnedExplorerFileType, type ReturnedExplorerFolderType, type ReturnedExplorerInfoType, type ReturnedExplorerListType, type ReturnedExplorerReadType, type ReturnedExplorerSizeType };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|