From c23a5aaa4c9eb32bc242f7c7588e4bf28052007e Mon Sep 17 00:00:00 2001 From: Andreas Thomas Date: Mon, 19 Dec 2022 13:17:33 +0100 Subject: [PATCH 1/3] fix: add polyfill for atob --- .gitignore | 1 + platforms/node_with_fetch.ts | 9 +++++++++ platforms/nodejs.ts | 9 +++++++++ version.ts | 2 +- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d3f87bee..80f229e7 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ examples/**/pnpm-lock.yaml # Local Netlify folder .netlify +x/ \ No newline at end of file diff --git a/platforms/node_with_fetch.ts b/platforms/node_with_fetch.ts index 939925dd..98cc623c 100644 --- a/platforms/node_with_fetch.ts +++ b/platforms/node_with_fetch.ts @@ -18,6 +18,15 @@ import "isomorphic-fetch"; // import http from "http"; // import "isomorphic-fetch"; +/** + * Workaround for nodejs 14, where atob is not included in the standardlib + */ +if (typeof atob === "undefined") { + global.atob = function (b64: string) { + return Buffer.from(b64, "base64").toString("utf-8"); + }; +} + export type { Requester, UpstashRequest, UpstashResponse }; /** diff --git a/platforms/nodejs.ts b/platforms/nodejs.ts index 7edb130c..bdebcb0a 100644 --- a/platforms/nodejs.ts +++ b/platforms/nodejs.ts @@ -11,6 +11,15 @@ import { } from "../pkg/http.ts"; import { VERSION } from "../version.ts"; +/** + * Workaround for nodejs 14, where atob is not included in the standardlib + */ +if (typeof atob === "undefined") { + global.atob = function (b64: string) { + return Buffer.from(b64, "base64").toString("utf-8"); + }; +} + export type { Requester, UpstashRequest, UpstashResponse }; /** diff --git a/version.ts b/version.ts index 68d3d46f..f205ce2a 100644 --- a/version.ts +++ b/version.ts @@ -1 +1 @@ -export const VERSION = "development"; +export const VERSION = "development" \ No newline at end of file From 29da3d10e2289936700c9951998af1517f6b5f58 Mon Sep 17 00:00:00 2001 From: Andreas Thomas Date: Mon, 19 Dec 2022 13:18:36 +0100 Subject: [PATCH 2/3] style: fmt --- version.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.ts b/version.ts index f205ce2a..68d3d46f 100644 --- a/version.ts +++ b/version.ts @@ -1 +1 @@ -export const VERSION = "development" \ No newline at end of file +export const VERSION = "development"; From bd649de4a31c0c4fe2496380b879bfd9b9a4ccd7 Mon Sep 17 00:00:00 2001 From: Andreas Thomas Date: Mon, 19 Dec 2022 13:26:31 +0100 Subject: [PATCH 3/3] fix: type error --- deno.lock | 4 ++++ pkg/commands/zrange.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/deno.lock b/deno.lock index d2f987db..df686d5e 100644 --- a/deno.lock +++ b/deno.lock @@ -52,6 +52,10 @@ "https://deno.land/std@0.143.0/path/posix.ts": "293cdaec3ecccec0a9cc2b534302dfe308adb6f10861fa183275d6695faace44", "https://deno.land/std@0.143.0/path/separator.ts": "fe1816cb765a8068afb3e8f13ad272351c85cbc739af56dacfc7d93d710fe0f9", "https://deno.land/std@0.143.0/path/win32.ts": "31811536855e19ba37a999cd8d1b62078235548d67902ece4aa6b814596dd757", + "https://deno.land/std@0.144.0/fmt/colors.ts": "6f9340b7fb8cc25a993a99e5efc56fe81bb5af284ff412129dd06df06f53c0b4", + "https://deno.land/std@0.144.0/testing/_diff.ts": "029a00560b0d534bc0046f1bce4bd36b3b41ada3f2a3178c85686eb2ff5f1413", + "https://deno.land/std@0.144.0/testing/_format.ts": "0d8dc79eab15b67cdc532826213bbe05bccfd276ca473a50a3fc7bbfb7260642", + "https://deno.land/std@0.144.0/testing/asserts.ts": "319df43e1e6bba2520508f6090a21a9a640cbe2754d255aee17cd1dfa78c2ff6", "https://deno.land/std@0.152.0/fmt/colors.ts": "6f9340b7fb8cc25a993a99e5efc56fe81bb5af284ff412129dd06df06f53c0b4", "https://deno.land/std@0.152.0/testing/_diff.ts": "029a00560b0d534bc0046f1bce4bd36b3b41ada3f2a3178c85686eb2ff5f1413", "https://deno.land/std@0.152.0/testing/_format.ts": "0d8dc79eab15b67cdc532826213bbe05bccfd276ca473a50a3fc7bbfb7260642", diff --git a/pkg/commands/zrange.ts b/pkg/commands/zrange.ts index 7edfcdb1..528db309 100644 --- a/pkg/commands/zrange.ts +++ b/pkg/commands/zrange.ts @@ -67,7 +67,7 @@ export class ZRangeCommand extends Command< if ( typeof opts?.count !== "undefined" && typeof opts?.offset !== "undefined" ) { - command.push("limit", opts.offset, opts.count); + command.push("limit", opts!.offset, opts!.count); } if (opts?.withScores) { command.push("withscores");