diff --git a/deno.json b/deno.json index 45d10d5..0b1ee5b 100644 --- a/deno.json +++ b/deno.json @@ -21,10 +21,13 @@ }, "imports": { "zod": "npm:zod@^4.4.3", - "drizzle-orm": "npm:drizzle-orm@^0.45.3" + "drizzle-orm": "npm:drizzle-orm@^0.45.2", + "mitata": "npm:mitata@^1.0.34" }, "compilerOptions": { - "types": ["npm:@types/node"], + "types": [ + "npm:@types/node" + ], "strict": true, "noUncheckedIndexedAccess": true, "exactOptionalPropertyTypes": true, @@ -40,7 +43,7 @@ "tasks": { "check": "deno task check:window && deno task check:worker && deno task check:server", "check:window": "deno check mod.ts src/adapter/definition.ts src/adapter/opfs.ts src/adapter/memory.ts src/adapter/record.ts src/adapter/unstorage.ts src/adapter/rxdb.ts src/adapter/db0.ts src/adapter/drizzle.ts src/driver/unstorage.ts src/iframe.ts src/path.ts src/schema.ts", - "check:worker": "deno check tests/worker_typecheck.ts", + "check:worker": "deno check tests/consumer.worker.ts", "check:server": "deno check src/adapter/deno.ts src/adapter/node.ts src/adapter/bun.ts", "test": "deno test tests/", "test:browser": "deno run -A npm:vite tests/browser", diff --git a/deno.lock b/deno.lock index 096894b..78e2ffe 100644 --- a/deno.lock +++ b/deno.lock @@ -1,141 +1,28 @@ { "version": "5", + "specifiers": { + "npm:@deno/shim-deno@~0.19.2": "0.19.2", + "npm:@types/deno@^2.7.0": "2.7.0", + "npm:@types/node@*": "26.2.0", + "npm:@types/node@^26.2.0": "26.2.0", + "npm:@types/sharedworker@^0.0.229": "0.0.229", + "npm:drizzle-orm@~0.45.2": "0.45.2", + "npm:mitata@^1.0.34": "1.0.34", + "npm:zod@^4.4.3": "4.4.3" + }, "npm": { - "@jsr/okikio__observables@1.4.0": { - "integrity": "sha512-T+1X935k3q95Nyya342MbSejZDNoqFFi/T/7TJ+IlwPezIAdCdguD6UoJc17R3zjvrMiRjnUTGsaJ8MFeDsgYQ==", - "tarball": "https://npm.jsr.io/~/11/@jsr/okikio__observables/1.4.0.tgz" - }, - "@jsr/okikio__undent@0.3.3": { - "integrity": "sha512-6SZCmvS6dZ0ayUmIpW47gyrfpUzht520GYC+6hVvDgXJk3aZdMXonEXbO8/mUo3pTjan+noFIS1gkgqDZl8hbw==", - "tarball": "https://npm.jsr.io/~/11/@jsr/okikio__undent/0.3.3.tgz" - }, - "@jsr/std__assert@1.0.19": { - "integrity": "sha512-pEj6RPkGbqlgRmyKwATp4cUs6+ijxtdrv3bq8v1d2I2CEcMEyPaO8cVKro61wGRDH4cNg8Zx6haztvK/9m7gkA==", - "dependencies": [ - "@jsr/std__internal" - ], - "tarball": "https://npm.jsr.io/~/11/@jsr/std__assert/1.0.19.tgz" - }, - "@jsr/std__async@1.5.0": { - "integrity": "sha512-I2Qekl1oQYM+dpI2RQUCKi1TBuaA7Od3LNzxcqls9s1e2ytiZyREL4403qHJ6UbLNAwbqO2ZhdWAWDUQAajyiA==", - "dependencies": [ - "@jsr/std__data-structures" - ], - "tarball": "https://npm.jsr.io/~/11/@jsr/std__async/1.5.0.tgz" - }, - "@jsr/std__bytes@1.0.6": { - "integrity": "sha512-St6yKggjFGhxS52IFLJWvkchRFbAKg2Xh8UxA4S1EGz7GJ2Ui+ssDDldj/w2c8vCxvl6qgR0HaYbKeFJNqujmA==", - "tarball": "https://npm.jsr.io/~/11/@jsr/std__bytes/1.0.6.tgz" - }, - "@jsr/std__cli@1.0.32": { - "integrity": "sha512-piaFso6urosCHGLkmy49pXXBJrW8zf1FlXXF4Zj0R2FGQdOGeoDDIfBejMzh+5W/GfJy3kbZGKqP8V2XHzZobQ==", - "dependencies": [ - "@jsr/std__fmt", - "@jsr/std__internal" - ], - "tarball": "https://npm.jsr.io/~/11/@jsr/std__cli/1.0.32.tgz" - }, - "@jsr/std__csv@1.0.6": { - "integrity": "sha512-9n/SZzjolPQ907gUPksQU3EFURwRl4GA9V6MylA8hpSkpxhcj6J98zDpn9EmDqgE2A4L9MnlUvFhRpeWl+Y/ZQ==", - "dependencies": [ - "@jsr/std__streams" - ], - "tarball": "https://npm.jsr.io/~/11/@jsr/std__csv/1.0.6.tgz" - }, - "@jsr/std__data-structures@1.1.2": { - "integrity": "sha512-YaNAaUYGr3qBnq8LJ0/FSW6tsnDBMX7hcPuGU7Zi/+aWlAJsZ4OroBNSpRIflizbOvCJCycAnXe9yLjIwDF2KA==", - "dependencies": [ - "@jsr/std__assert" - ], - "tarball": "https://npm.jsr.io/~/11/@jsr/std__data-structures/1.1.2.tgz" - }, - "@jsr/std__encoding@1.0.11": { - "integrity": "sha512-4SmW8WXf4x4FjkxVpxbir06QYwxw/h/2+RU5A66iKXbJC9WAYCICZkH01mcOGj8FgSitF/lSTlT585RZfo8Ukg==", - "tarball": "https://npm.jsr.io/~/11/@jsr/std__encoding/1.0.11.tgz" - }, - "@jsr/std__expect@1.0.20": { - "integrity": "sha512-AkDNshk9qIKP7OzRcSZ9qb4txPJVOxd2mDWl0XtU19eZecIzcNrxrG9gnz1j5t+U+vm6AEHkjMdwnvIfFQsJ7g==", - "dependencies": [ - "@jsr/std__assert", - "@jsr/std__internal", - "@jsr/std__path" - ], - "tarball": "https://npm.jsr.io/~/11/@jsr/std__expect/1.0.20.tgz" - }, - "@jsr/std__fmt@1.0.10": { - "integrity": "sha512-Q2N8XDNkh/c1IKTi+sO4Vm64M5m4W0o47qTURmMX0vgHm9AJ6jL7jEQ2kw0M1T2rBZiwAY78eUbYzFyOYWaCqQ==", - "tarball": "https://npm.jsr.io/~/11/@jsr/std__fmt/1.0.10.tgz" - }, - "@jsr/std__fs@1.0.24": { - "integrity": "sha512-UunW2Rg++9sA74NJnYMGTsMVQgoFRAwPP02wRRohL0PQBNorbyxHiyCMRaxYQCtLepTLkC4nUyMtcwrGKqTR6g==", - "dependencies": [ - "@jsr/std__internal", - "@jsr/std__path" - ], - "tarball": "https://npm.jsr.io/~/11/@jsr/std__fs/1.0.24.tgz" - }, - "@jsr/std__html@1.0.7": { - "integrity": "sha512-GtiN92YolMLr3YGtuqkejQCclff+tSYvnHhJorSjw/C9OG+ua+zwpRA/Xcsvfe+otI/dCT4PcNEub6XzBTUNsA==", - "tarball": "https://npm.jsr.io/~/11/@jsr/std__html/1.0.7.tgz" - }, - "@jsr/std__http@1.1.3": { - "integrity": "sha512-PCRCj0NmitqL65rQaTSa5i/7IU+NxsPZTXfurNVePGCpNaUAbag6jmvUSScRb+eHWQoW+UcodrSUGDDplLSVpw==", - "dependencies": [ - "@jsr/std__cli", - "@jsr/std__encoding", - "@jsr/std__fmt", - "@jsr/std__fs", - "@jsr/std__html", - "@jsr/std__media-types", - "@jsr/std__net", - "@jsr/std__path", - "@jsr/std__streams" - ], - "tarball": "https://npm.jsr.io/~/11/@jsr/std__http/1.1.3.tgz" - }, - "@jsr/std__internal@1.0.14": { - "integrity": "sha512-JT8b/t40WcR9q0GDwRZUooY7aXeXnFal8iidE/5TckdAFtvpVAsaJ71/Xgf1SfoChs41s6CZkuCYM8toaNgdvA==", - "tarball": "https://npm.jsr.io/~/11/@jsr/std__internal/1.0.14.tgz" - }, - "@jsr/std__media-types@1.1.0": { - "integrity": "sha512-dHvaxHL7ENWnltgL653uo3KnKFse3ZbopZop2gqsT7yrscx7irZEClu5Cba7gMPPRk4Lg1FbriNcaBViM2RSBw==", - "tarball": "https://npm.jsr.io/~/11/@jsr/std__media-types/1.1.0.tgz" - }, - "@jsr/std__net@1.0.6": { - "integrity": "sha512-mh27Fw4UMCjGSIMoOhjia5cS5fNP9M9DZYhGB7EYSZNnzf/eguFiarii/W4oDwYMmnxCMouUzhc6Y7jFuwTzcg==", - "tarball": "https://npm.jsr.io/~/11/@jsr/std__net/1.0.6.tgz" - }, - "@jsr/std__path@1.1.6": { - "integrity": "sha512-H1Cmg6z8jFyIsQbVV+vZB4eOx4k6Qg8lyUM6l7nZysj5MZumg89kb0M1bsPBTGQis3fw6mJFkJELo5+AK6oCFA==", - "dependencies": [ - "@jsr/std__internal" - ], - "tarball": "https://npm.jsr.io/~/11/@jsr/std__path/1.1.6.tgz" + "@deno/shim-deno-test@0.5.0": { + "integrity": "sha512-4nMhecpGlPi0cSzT67L+Tm+GOJqvuk8gqHBziqcUQOarnuIax1z96/gJHCSIz2Z0zhxE6Rzwb3IZXPtFh51j+w==" }, - "@jsr/std__streams@1.1.2": { - "integrity": "sha512-TNg+Mr/vE2Wg+JDdZpVj9umEyzcmSAOtcp0ildlyVCjHy0/fJ2BJZgO8PQXA/SwJOchvKLaMafZzfFkm9PO13A==", + "@deno/shim-deno@0.19.2": { + "integrity": "sha512-q3VTHl44ad8T2Tw2SpeAvghdGOjlnLPDNO2cpOxwMrBE/PVas6geWpbpIgrM+czOCH0yejp0yi8OaTuB+NU40Q==", "dependencies": [ - "@jsr/std__bytes" - ], - "tarball": "https://npm.jsr.io/~/11/@jsr/std__streams/1.1.2.tgz" - }, - "@logtape/logtape@2.3.0": { - "integrity": "sha512-s/pxCgf9Gg75ypTV/bRUq355Dy/JP/zUJWfgJQPO5pTkXC23X2AXBcmBBgFiWH+bSi4yiX/G06qGV8CdAWD3SA==" - }, - "@okikio/observables@1.4.0": { - "integrity": "sha512-qyS+QLK0dHCzns6mSKcPCm1mBYWYCuLFT3HZmYzgH6OLNo4rVZOLeRuAa55tOMP9VBM2CpDg7VYAVXe7iKOeEQ==" - }, - "@standard-schema/spec@1.1.0": { - "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==" - }, - "@types/dom-mediacapture-transform@0.1.12": { - "integrity": "sha512-d7/QsLRwF864A5mgIM/YrfiglHoYn7zgCcAoJgW404r+2DwnNr7EBbLnCWpmOMgH8y0te73L1AV6H1bmauaWFw==", - "dependencies": [ - "@types/dom-webcodecs" + "@deno/shim-deno-test", + "which" ] }, - "@types/dom-webcodecs@0.1.13": { - "integrity": "sha512-O5hkiFIcjjszPIYyUSyvScyvrBoV3NOEEZx/pMlsu44TKzWNkLVBBxnxJz42in5n3QIolYOcBYFCPZZ0h8SkwQ==" + "@types/deno@2.7.0": { + "integrity": "sha512-Y6fWcV8KpYeO3Lik/RiYnUxtr/LWqoeACciU0CA+dr1U/45tGgaX3HWQQAPCNN53raN4Rr4Fht4y6qsUH57fDA==" }, "@types/node@26.2.0": { "integrity": "sha512-5IviulTZeRNp2vAJ514cc/HUlY5nZ9fCbq9DMyC52BrhFZACo3nI0R7qBxhQmo/d27NFe96ur/b7Wwxklda+kg==", @@ -143,165 +30,27 @@ "undici-types" ] }, - "@typescript/typescript-aix-ppc64@7.0.2": { - "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==", - "os": ["aix"], - "cpu": ["ppc64"] - }, - "@typescript/typescript-darwin-arm64@7.0.2": { - "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==", - "os": ["darwin"], - "cpu": ["arm64"] - }, - "@typescript/typescript-darwin-x64@7.0.2": { - "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==", - "os": ["darwin"], - "cpu": ["x64"] - }, - "@typescript/typescript-freebsd-arm64@7.0.2": { - "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==", - "os": ["freebsd"], - "cpu": ["arm64"] - }, - "@typescript/typescript-freebsd-x64@7.0.2": { - "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==", - "os": ["freebsd"], - "cpu": ["x64"] - }, - "@typescript/typescript-linux-arm64@7.0.2": { - "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==", - "os": ["linux"], - "cpu": ["arm64"] - }, - "@typescript/typescript-linux-arm@7.0.2": { - "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==", - "os": ["linux"], - "cpu": ["arm"] - }, - "@typescript/typescript-linux-loong64@7.0.2": { - "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==", - "os": ["linux"], - "cpu": ["loong64"] - }, - "@typescript/typescript-linux-mips64el@7.0.2": { - "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==", - "os": ["linux"], - "cpu": ["mips64el"] - }, - "@typescript/typescript-linux-ppc64@7.0.2": { - "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==", - "os": ["linux"], - "cpu": ["ppc64"] - }, - "@typescript/typescript-linux-riscv64@7.0.2": { - "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==", - "os": ["linux"], - "cpu": ["riscv64"] - }, - "@typescript/typescript-linux-s390x@7.0.2": { - "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==", - "os": ["linux"], - "cpu": ["s390x"] - }, - "@typescript/typescript-linux-x64@7.0.2": { - "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==", - "os": ["linux"], - "cpu": ["x64"] + "@types/sharedworker@0.0.229": { + "integrity": "sha512-0gPmMzELgb8NngUbvfpWgE73h2jY5zpHrUOswFFcqXFpmbTWEzvJtaB1ZYxv8u4HRJStgwoFtXDFefQwL24Sxg==" }, - "@typescript/typescript-netbsd-arm64@7.0.2": { - "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==", - "os": ["netbsd"], - "cpu": ["arm64"] + "drizzle-orm@0.45.2": { + "integrity": "sha512-kY0BSaTNYWnoDMVoyY8uxmyHjpJW1geOmBMdSSicKo9CIIWkSxMIj2rkeSR51b8KAPB7m+qysjuHme5nKP+E5Q==" }, - "@typescript/typescript-netbsd-x64@7.0.2": { - "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==", - "os": ["netbsd"], - "cpu": ["x64"] - }, - "@typescript/typescript-openbsd-arm64@7.0.2": { - "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==", - "os": ["openbsd"], - "cpu": ["arm64"] - }, - "@typescript/typescript-openbsd-x64@7.0.2": { - "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==", - "os": ["openbsd"], - "cpu": ["x64"] - }, - "@typescript/typescript-sunos-x64@7.0.2": { - "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==", - "os": ["sunos"], - "cpu": ["x64"] - }, - "@typescript/typescript-win32-arm64@7.0.2": { - "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==", - "os": ["win32"], - "cpu": ["arm64"] - }, - "@typescript/typescript-win32-x64@7.0.2": { - "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==", - "os": ["win32"], - "cpu": ["x64"] - }, - "fast-check@4.9.0": { - "integrity": "sha512-7ms6T7SybUev/PQITciI0yLM2pOSFy5zpG8Ty7tQofcVaQUvrMXp6CBwqF6fThLCLOrfBtuHAtwq6Yu4XPCllg==", - "dependencies": [ - "pure-rand" - ] - }, - "hono@4.13.1": { - "integrity": "sha512-kdJoFVv2xmayw6cY09H7AbMJMt8Jn5jdlEdXsP7AGBdF2DIptVlKlOLKXP41yPip4/a3yQPv9gVcJYI8YY04dw==" - }, - "mediabunny@1.53.0": { - "integrity": "sha512-RjWe9yJr9MPvb6kX4gSu54fZD2w1yf6RyCS0Jmgaml+fFSqEr7+XuASXoRxSqJxgc+wIe+7TujXWcyj3evJ3Bg==", - "dependencies": [ - "@types/dom-mediacapture-transform", - "@types/dom-webcodecs" - ] + "isexe@3.1.5": { + "integrity": "sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w==" }, "mitata@1.0.34": { "integrity": "sha512-Mc3zrtNBKIMeHSCQ0XqRLo1vbdIx1wvFV9c8NJAiyho6AjNfMY8bVhbS12bwciUdd1t4rj8099CH3N3NFahaUA==" }, - "pure-rand@8.4.2": { - "integrity": "sha512-vvuOGgcuPJAirlHvuQw1TrOiw7ptaIXXmIbNuiNOY6lNGJJH49PQ1Kj4nd783nPdQhQdicgOjVI2yI/9BD6/Ng==" - }, - "typescript@7.0.2": { - "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==", - "optionalDependencies": [ - "@typescript/typescript-aix-ppc64", - "@typescript/typescript-darwin-arm64", - "@typescript/typescript-darwin-x64", - "@typescript/typescript-freebsd-arm64", - "@typescript/typescript-freebsd-x64", - "@typescript/typescript-linux-arm", - "@typescript/typescript-linux-arm64", - "@typescript/typescript-linux-loong64", - "@typescript/typescript-linux-mips64el", - "@typescript/typescript-linux-ppc64", - "@typescript/typescript-linux-riscv64", - "@typescript/typescript-linux-s390x", - "@typescript/typescript-linux-x64", - "@typescript/typescript-netbsd-arm64", - "@typescript/typescript-netbsd-x64", - "@typescript/typescript-openbsd-arm64", - "@typescript/typescript-openbsd-x64", - "@typescript/typescript-sunos-x64", - "@typescript/typescript-win32-arm64", - "@typescript/typescript-win32-x64" - ], - "bin": true - }, "undici-types@8.3.0": { "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==" }, - "valibot@1.4.2_typescript@7.0.2": { - "integrity": "sha512-gjdCvJ6d3RyHAneqxMYMW9QMCwYMb3jpOO0IyHZV1bnRHFBHrX3VkIILt5XYR0WhwHiH7Mty8ovuPZ/O3gamrg==", + "which@4.0.0": { + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", "dependencies": [ - "typescript" + "isexe" ], - "optionalPeers": [ - "typescript" - ] + "bin": true }, "zod@4.4.3": { "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==" @@ -309,13 +58,18 @@ }, "workspace": { "dependencies": [ - "npm:drizzle-orm@~0.45.3", + "npm:@types/node@*", + "npm:drizzle-orm@~0.45.2", + "npm:mitata@^1.0.34", "npm:zod@^4.4.3" ], "packageJson": { "dependencies": [ "npm:@deno/shim-deno@~0.19.2", "npm:@types/deno@^2.7.0", + "npm:@types/node@^26.2.0", + "npm:@types/sharedworker@^0.0.229", + "npm:mitata@^1.0.34", "npm:zod@^4.4.3" ] } diff --git a/package.json b/package.json index ac16919..44595b0 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,8 @@ "devDependencies": { "@deno/shim-deno": "^0.19.2", "@types/deno": "^2.7.0", - "@types/sharedworker": "^0.0.229" + "@types/node": "^26.2.0", + "@types/sharedworker": "^0.0.229", + "mitata": "^1.0.34" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 05202fc..365d1be 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,9 +18,15 @@ importers: '@types/deno': specifier: ^2.7.0 version: 2.7.0 + '@types/node': + specifier: ^26.2.0 + version: 26.2.0 '@types/sharedworker': specifier: ^0.0.229 version: 0.0.229 + mitata: + specifier: ^1.0.34 + version: 1.0.34 packages: @@ -33,6 +39,9 @@ packages: '@types/deno@2.7.0': resolution: {integrity: sha512-Y6fWcV8KpYeO3Lik/RiYnUxtr/LWqoeACciU0CA+dr1U/45tGgaX3HWQQAPCNN53raN4Rr4Fht4y6qsUH57fDA==} + '@types/node@26.2.0': + resolution: {integrity: sha512-5IviulTZeRNp2vAJ514cc/HUlY5nZ9fCbq9DMyC52BrhFZACo3nI0R7qBxhQmo/d27NFe96ur/b7Wwxklda+kg==} + '@types/sharedworker@0.0.229': resolution: {integrity: sha512-0gPmMzELgb8NngUbvfpWgE73h2jY5zpHrUOswFFcqXFpmbTWEzvJtaB1ZYxv8u4HRJStgwoFtXDFefQwL24Sxg==} @@ -40,6 +49,12 @@ packages: resolution: {integrity: sha512-6B3tLtFqtQS4ekarvLVMZ+X+VlvQekbe4taUkf/rhVO3d/h0M2rfARm/pXLcPEsjjMsFgrFgSrhQIxcSVrBz8w==} engines: {node: '>=18'} + mitata@1.0.34: + resolution: {integrity: sha512-Mc3zrtNBKIMeHSCQ0XqRLo1vbdIx1wvFV9c8NJAiyho6AjNfMY8bVhbS12bwciUdd1t4rj8099CH3N3NFahaUA==} + + undici-types@8.3.0: + resolution: {integrity: sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==} + which@4.0.0: resolution: {integrity: sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==} engines: {node: ^16.13.0 || >=18.0.0} @@ -59,10 +74,18 @@ snapshots: '@types/deno@2.7.0': {} + '@types/node@26.2.0': + dependencies: + undici-types: 8.3.0 + '@types/sharedworker@0.0.229': {} isexe@3.1.5: {} + mitata@1.0.34: {} + + undici-types@8.3.0: {} + which@4.0.0: dependencies: isexe: 3.1.5 diff --git a/tests/adapters.test.ts b/tests/adapters.test.ts index 3ac63a9..81a6f00 100644 --- a/tests/adapters.test.ts +++ b/tests/adapters.test.ts @@ -182,15 +182,14 @@ async function exerciseRecordBackend(fileSystem) { test("adapter and facade schemas reject invalid runtime contracts", async () => { const valid = createMemoryAdapter(); - assert.throws(() => defineAdapter({ ...valid, name: "" }), TypeError); + assert.throws(() => defineAdapter({ ...valid, name: "" })); assert.throws( () => defineAdapter({ ...valid, capabilities: { ...valid.capabilities, streamRead: "yes" } }), - TypeError, ); - assert.throws(() => createFileSystem(valid, { coordination: "invalid" }), TypeError); + assert.throws(() => createFileSystem(valid, { coordination: "invalid" })); const fs = memoryFileSystem(); - await assert.rejects(fs.writeFile("/invalid.txt", "data", { mode: "invalid" }), TypeError); + await assert.rejects(fs.writeFile("/invalid.txt", "data", { mode: "invalid" })); }); test("web-lock coordination requests shared tree and exclusive file locks", async () => { @@ -247,6 +246,57 @@ test("memory adapter preserves replace, append, update, range, and stat semantic assert.equal(stat.size, 11); }); +test("openWritableFile creates and owns one file lock until terminal cleanup", async () => { + const root = await mkdtemp(join(tmpdir(), "opfs-positional-create-")); + const adapter = createNodeAdapter({ root }); + const fs = createFileSystem(adapter, { coordination: "local", disposeAdapter: true }); + try { + const file = await fs.openWritableFile("/nested/output.bin", { create: true, parents: true }); + await file.write(new TextEncoder().encode("AB"), { at: 0 }); + const queued = fs.writeFile("/nested/output.bin", "after"); + let settled = false; + void queued.finally(() => { settled = true; }); + await new Promise((resolve) => setTimeout(resolve, 5)); + assert.equal(settled, false); + await file.close(); + await queued; + assert.equal(await fs.readText("/nested/output.bin"), "after"); + } finally { + await fs.close(); + if (root !== undefined) await rm(root, { recursive: true, force: true }); + } +}); + +test("openSyncFile creates and owns one file lock until close", async () => { + const root = await mkdtemp(join(tmpdir(), "opfs-sync-create-")); + const adapter = createNodeAdapter({ root }); + const fs = createFileSystem(adapter, { coordination: "local", disposeAdapter: true }); + try { + const file = await fs.openSyncFile("/nested/sync.bin", { create: true, parents: true }); + file.writeAll(new TextEncoder().encode("AB"), { at: 0 }); + const queued = fs.writeFile("/nested/sync.bin", "after"); + let settled = false; + void queued.finally(() => { settled = true; }); + await new Promise((resolve) => setTimeout(resolve, 5)); + assert.equal(settled, false); + file.close(); + await queued; + assert.equal(await fs.readText("/nested/sync.bin"), "after"); + } finally { + await fs.close(); + await rm(root, { recursive: true, force: true }); + } +}); + +test("record backends reject long-lived positional files instead of emulating them", async () => { + const fs = memoryFileSystem(); + await fs.ensureFile("/media.bin"); + await assert.rejects( + fs.openWritableFile("/media.bin"), + (error) => error instanceof FileSystemError && error.code === "not-supported", + ); +}); + test("OPFS-shaped handles work over a non-OPFS memory backend", async () => { const fs = memoryFileSystem(); const directory = await fs.root.getDirectoryHandle("docs", { create: true }); @@ -457,6 +507,24 @@ test("Node adapter performs real streaming, native move, and synchronous random assert.equal(await fs.readText("/nested/file.txt"), "stream"); await fs.move("/nested/file.txt", "/nested/moved.txt"); assert.equal(await fs.exists("/nested/file.txt"), false); + + await fs.ensureFile("/nested/positional.bin"); + const positional = await fs.openWritableFile("/nested/positional.bin"); + await positional.write(new TextEncoder().encode("CD"), { at: 2 }); + await positional.write(new TextEncoder().encode("AB"), { at: 0 }); + await positional.flush(); + assert.equal(await fs.readText("/nested/positional.bin"), "ABCD"); + + let queuedPositionalWriteCompleted = false; + const queuedPositionalWrite = fs.writeFile("/nested/positional.bin", "after-positional") + .then(() => { queuedPositionalWriteCompleted = true; }); + await new Promise((resolve) => setTimeout(resolve, 10)); + assert.equal(queuedPositionalWriteCompleted, false); + await positional.close(); + await positional.close(); + await queuedPositionalWrite; + assert.equal(await fs.readText("/nested/positional.bin"), "after-positional"); + const sync = await fs.openSyncFile("/nested/moved.txt"); sync.writeAll(new TextEncoder().encode("NODE"), { at: 0 }); sync.flush();