From 44b6105adb2407a0bb2376a942bceb59453e0303 Mon Sep 17 00:00:00 2001 From: matteo-cristino Date: Fri, 2 Feb 2024 11:11:52 +0100 Subject: [PATCH 1/2] =?UTF-8?q?fix(identity):=20=F0=9F=90=9B=20do=20not=20?= =?UTF-8?q?use=20http=20module=20utility=20functions,=20but=20use=20zencod?= =?UTF-8?q?e's=20one?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/identity/src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/identity/src/index.ts b/packages/identity/src/index.ts index 0722c5f3..b603f07f 100644 --- a/packages/identity/src/index.ts +++ b/packages/identity/src/index.ts @@ -4,7 +4,6 @@ import { Zencode } from "@restroom-mw/zencode"; import { NextFunction, Request, Response } from "express"; import axios from "axios"; import { Action } from "./actions"; -import { chunks } from "@restroom-mw/http/src/utils"; export default (req: Request, res: Response, next: NextFunction) => { const rr = new Restroom(req, res); @@ -22,7 +21,7 @@ export default (req: Request, res: Response, next: NextFunction) => { content = rr.combineDataKeys(data, keys); if (zencode.match(Action.RESOLVE_DID)) { - for (let [did, urlName, o] of chunks(zencode.paramsOf(Action.RESOLVE_DID), 3)) { + for (let [did, urlName, o] of zencode.chunkedParamsOf(Action.RESOLVE_DID, 3)) { let check_url : URL; let url_resolver : URL; try { From 08c00d8b32a68a5fd6722634af5e8056760cbc8f Mon Sep 17 00:00:00 2001 From: matteo-cristino Date: Fri, 2 Feb 2024 11:37:06 +0100 Subject: [PATCH 2/2] =?UTF-8?q?fix(identity):=20=F0=9F=90=9B=20set=20type?= =?UTF-8?q?=20to=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/identity/src/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/identity/src/index.ts b/packages/identity/src/index.ts index b603f07f..d5ce73ae 100644 --- a/packages/identity/src/index.ts +++ b/packages/identity/src/index.ts @@ -25,17 +25,17 @@ export default (req: Request, res: Response, next: NextFunction) => { let check_url : URL; let url_resolver : URL; try { - check_url = new URL(content[urlName]); + check_url = new URL(content[urlName as string]); } catch (err) { - throw new Error("The string " + content[urlName] + " is an invalid URL"); + throw new Error("The string " + content[urlName as string] + " is an invalid URL"); } try{ - url_resolver = new URL(check_url.toString() + "/" + content[did]); + url_resolver = new URL(check_url.toString() + "/" + content[did as string]); } catch(err){ - throw new Error("The string " + content[did] + " is an invalid URL"); + throw new Error("The string " + content[did as string] + " is an invalid URL"); } promises.push(axios.get(url_resolver.toString())); - outputs.push(o); + outputs.push(o as string); } } if(promises.length){