hyperdb-wasm 0.0.27104-dev.wasm.g1f6020b7 → 0.0.27104-dev.wasm.g5798514d
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/dist/browser.js +8 -4
- package/dist/hyperdb-wasm.wasm.br +0 -0
- package/dist/index.d.ts +4 -4
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -858,12 +858,16 @@ var HyperDB2 = class _HyperDB extends HyperDB {
|
|
|
858
858
|
const handle = source;
|
|
859
859
|
const mode = options.mode ?? "read";
|
|
860
860
|
if (mode !== "read" && mode !== "readwrite") throw new Error(`Unsupported mount mode: ${String(mode)}`);
|
|
861
|
-
if (!handle || handle.kind !== "directory"
|
|
861
|
+
if (!handle || handle.kind !== "directory") {
|
|
862
862
|
throw new Error("Mount source must be a File or FileSystemDirectoryHandle");
|
|
863
863
|
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
864
|
+
if (typeof handle.queryPermission === "function") {
|
|
865
|
+
let permission = await handle.queryPermission({ mode });
|
|
866
|
+
if (permission !== "granted" && typeof handle.requestPermission === "function") {
|
|
867
|
+
permission = await handle.requestPermission({ mode });
|
|
868
|
+
}
|
|
869
|
+
if (permission !== "granted") throw new Error(`Directory ${mode} permission was not granted`);
|
|
870
|
+
}
|
|
867
871
|
return this.mountSource({ kind: "browser-directory", handle }, path, mode);
|
|
868
872
|
}
|
|
869
873
|
};
|
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -7,12 +7,12 @@ export type { HyperDBErrorSource } from './protocol.js';
|
|
|
7
7
|
export interface FileSystemDirectoryHandleLike {
|
|
8
8
|
readonly kind: 'directory';
|
|
9
9
|
readonly name: string;
|
|
10
|
-
queryPermission(options: {
|
|
10
|
+
queryPermission?(options: {
|
|
11
11
|
readonly mode: MountAccessMode;
|
|
12
|
-
}): Promise<
|
|
13
|
-
requestPermission(options: {
|
|
12
|
+
}): Promise<PermissionState>;
|
|
13
|
+
requestPermission?(options: {
|
|
14
14
|
readonly mode: MountAccessMode;
|
|
15
|
-
}): Promise<
|
|
15
|
+
}): Promise<PermissionState>;
|
|
16
16
|
}
|
|
17
17
|
export declare class HyperDB extends BaseHyperDB {
|
|
18
18
|
static create(options?: BrowserCreateOptions): Promise<HyperDB>;
|