@lunarhue/react-native-web-wa-sqlite 1.0.9
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 +78 -0
- package/dist/wa-sqlite-async.mjs +16 -0
- package/dist/wa-sqlite-async.wasm +0 -0
- package/dist/wa-sqlite-jspi.mjs +16 -0
- package/dist/wa-sqlite-jspi.wasm +0 -0
- package/dist/wa-sqlite.mjs +16 -0
- package/dist/wa-sqlite.wasm +0 -0
- package/package.json +45 -0
- package/src/FacadeVFS.js +681 -0
- package/src/VFS.js +222 -0
- package/src/WebLocksMixin.js +411 -0
- package/src/examples/AccessHandlePoolVFS.js +458 -0
- package/src/examples/IDBBatchAtomicVFS.js +827 -0
- package/src/examples/IDBMirrorVFS.js +889 -0
- package/src/examples/MemoryAsyncVFS.js +100 -0
- package/src/examples/MemoryVFS.js +176 -0
- package/src/examples/OPFSAdaptiveVFS.js +437 -0
- package/src/examples/OPFSAnyContextVFS.js +300 -0
- package/src/examples/OPFSCoopSyncVFS.js +597 -0
- package/src/examples/OPFSPermutedVFS.js +1217 -0
- package/src/examples/README.md +89 -0
- package/src/examples/tag.js +82 -0
- package/src/sqlite-api.js +912 -0
- package/src/sqlite-constants.js +275 -0
- package/src/types/globals.d.ts +60 -0
- package/src/types/index.d.ts +1330 -0
- package/src/types/tsconfig.json +6 -0
- package/test/AccessHandlePoolVFS.test.js +27 -0
- package/test/IDBBatchAtomicVFS.test.js +97 -0
- package/test/IDBMirrorVFS.test.js +27 -0
- package/test/MemoryAsyncVFS.test.js +27 -0
- package/test/MemoryVFS.test.js +27 -0
- package/test/OPFSAdaptiveVFS.test.js +27 -0
- package/test/OPFSAnyContextVFS.test.js +27 -0
- package/test/OPFSCoopSyncVFS.test.js +27 -0
- package/test/OPFSPermutedVFS.test.js +27 -0
- package/test/TestContext.js +96 -0
- package/test/WebLocksMixin.test.js +521 -0
- package/test/api.test.js +49 -0
- package/test/api_exec.js +89 -0
- package/test/api_misc.js +63 -0
- package/test/api_statements.js +447 -0
- package/test/callbacks.test.js +581 -0
- package/test/sql.test.js +64 -0
- package/test/sql_0001.js +49 -0
- package/test/sql_0002.js +52 -0
- package/test/sql_0003.js +83 -0
- package/test/sql_0004.js +81 -0
- package/test/sql_0005.js +76 -0
- package/test/test-worker.js +204 -0
- package/test/vfs_xAccess.js +2 -0
- package/test/vfs_xClose.js +52 -0
- package/test/vfs_xOpen.js +91 -0
- package/test/vfs_xRead.js +38 -0
- package/test/vfs_xWrite.js +36 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as Comlink from 'comlink';
|
|
2
|
+
import * as VFS from '../src/VFS.js';
|
|
3
|
+
|
|
4
|
+
const FILEID = 1;
|
|
5
|
+
|
|
6
|
+
export function vfs_xWrite(context) {
|
|
7
|
+
describe('vfs_xWrite', function() {
|
|
8
|
+
let proxy, vfs;
|
|
9
|
+
beforeEach(async function() {
|
|
10
|
+
proxy = await context.create();
|
|
11
|
+
vfs = proxy.vfs;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
afterEach(async function() {
|
|
15
|
+
await context.destroy(proxy);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should round-trip data', async function() {
|
|
19
|
+
let rc;
|
|
20
|
+
const pOpenOutput = Comlink.proxy(new DataView(new ArrayBuffer(4)));
|
|
21
|
+
const openFlags = VFS.SQLITE_OPEN_CREATE | VFS.SQLITE_OPEN_READWRITE;
|
|
22
|
+
rc = await vfs.jOpen('test', FILEID, openFlags, pOpenOutput);
|
|
23
|
+
expect(rc).toEqual(VFS.SQLITE_OK);
|
|
24
|
+
|
|
25
|
+
const pData = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]);
|
|
26
|
+
const iOffset = 0;
|
|
27
|
+
rc = await vfs.jWrite(FILEID, pData, iOffset);
|
|
28
|
+
expect(rc).toEqual(VFS.SQLITE_OK);
|
|
29
|
+
|
|
30
|
+
const pReadData = Comlink.proxy(new Uint8Array(pData.length));
|
|
31
|
+
rc = await vfs.jRead(FILEID, pReadData, iOffset);
|
|
32
|
+
expect(rc).toEqual(VFS.SQLITE_OK);
|
|
33
|
+
expect([...pReadData]).toEqual([...pData]);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|