diff --git a/adapter.js b/adapter.js index c7d453d..d604a3f 100644 --- a/adapter.js +++ b/adapter.js @@ -103,7 +103,15 @@ export default function (root) { * @param {StorageObject} * @returns {Promise} */ - function putObject({ bucket, object, stream }) { + function putObject({ bucket, object, stream, useSignedUrl }) { + if (useSignedUrl) { + return Promise.resolve( + HyperErr({ + status: 501, + msg: "Not Implemented", + }), + ); + } // Create Writer return Async.of(resolvePath(bucket, object)) .chain(create) @@ -150,7 +158,16 @@ export default function (root) { * @param {StorageInfo} * @returns {Promise} */ - function getObject({ bucket, object }) { + function getObject({ bucket, object, useSignedUrl }) { + if (useSignedUrl) { + return Promise.resolve( + HyperErr({ + status: 501, + msg: "Not Implemented", + }), + ); + } + return Async.of(resolvePath(bucket, object)) .chain((p) => open(p, { read: true, write: false })) .bimap( diff --git a/adapter_test.js b/adapter_test.js index fd35e59..4b72bf3 100644 --- a/adapter_test.js +++ b/adapter_test.js @@ -157,6 +157,22 @@ Deno.test("fs adapter put object", async () => { }); }); +Deno.test("fs adapter put object - useSignedUrl", async () => { + // setup + const bucket = v4(); + const object = v4() + ".txt"; + await adapter.makeBucket(bucket); + + // test + const result = await adapter.putObject({ + bucket, + object, + useSignedUrl: true, + }).catch((err) => err); + assert(!result.ok); + assert(result.status === 501); +}); + Deno.test("fs adapter get object", async () => { const bucket = v4(); const object = v4() + ".txt"; @@ -193,6 +209,22 @@ Deno.test("fs adapter get object", async () => { }); }); +Deno.test("fs adapter get object - useSignedUrl", async () => { + // setup + const bucket = v4(); + const object = v4() + ".txt"; + await adapter.makeBucket(bucket); + + // test + const result = await adapter.getObject({ + bucket, + object, + useSignedUrl: true, + }).catch((err) => err); + assert(!result.ok); + assert(result.status === 501); +}); + Deno.test("list files", async () => { const bucket = v4(); const object = v4() + ".tmp"; diff --git a/test/hyper.js b/test/hyper.js index be66804..9c46fb5 100644 --- a/test/hyper.js +++ b/test/hyper.js @@ -1,6 +1,6 @@ // Harness deps -import { default as appOpine } from "https://x.nest.land/hyper-app-opine@2.0.0/mod.js"; -import { default as core } from "https://x.nest.land/hyper@3.0.0/mod.js"; +import { default as appOpine } from "https://x.nest.land/hyper-app-opine@2.2.0/mod.js"; +import { default as core } from "https://x.nest.land/hyper@3.3.0/mod.js"; import fs from "../mod.js";