From 01a07f6a5b67bdd84dce247fce98db01bd6396e7 Mon Sep 17 00:00:00 2001 From: Patrick O'Sullivan Date: Thu, 10 Mar 2022 14:15:49 -0600 Subject: [PATCH 1/3] npm: add preSig func to npm lib --- pkg/npm/api/lib/lib.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/npm/api/lib/lib.ts b/pkg/npm/api/lib/lib.ts index c1d88a6f5..c57d0a259 100644 --- a/pkg/npm/api/lib/lib.ts +++ b/pkg/npm/api/lib/lib.ts @@ -141,6 +141,18 @@ export function dateToDa(d: Date, mil: boolean = false): string { ); } +export function preSig(ship: string): string { + if (!ship) { + return ''; + } + + if (ship.trim().startsWith('~')) { + return ship.trim(); + } + + return '~'.concat(ship.trim()); +} + export function deSig(ship: string): string | null { if (!ship) { return null; From 84ab13d18891bbd89b5c566fd37f12134c2e1374 Mon Sep 17 00:00:00 2001 From: Patrick O'Sullivan Date: Tue, 29 Mar 2022 09:15:44 -0500 Subject: [PATCH 2/3] npm: fix HarkBody type def for time --- pkg/npm/api/hark/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/npm/api/hark/types.ts b/pkg/npm/api/hark/types.ts index cab900e7c..e52912cbb 100644 --- a/pkg/npm/api/hark/types.ts +++ b/pkg/npm/api/hark/types.ts @@ -13,7 +13,7 @@ export type HarkContent = { ship: string; } | { text: string; }; export interface HarkBody { title: HarkContent[]; - time: string; + time: number; content: HarkContent[]; link: string; binned: string; @@ -29,7 +29,7 @@ export interface HarkBin { place: HarkPlace; } -export type HarkLid = +export type HarkLid = { unseen: null; } | { seen: null; } | { time: string; }; From 35a224137a2c459ccfed984f5478a1e68e5348be Mon Sep 17 00:00:00 2001 From: Patrick O'Sullivan Date: Tue, 26 Apr 2022 13:42:18 -0500 Subject: [PATCH 3/3] npm: fix issue caused by set var in groups/lib.ts --- pkg/npm/api/groups/lib.ts | 2 +- pkg/npm/api/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/npm/api/groups/lib.ts b/pkg/npm/api/groups/lib.ts index f66b3386d..7e93ad3a4 100644 --- a/pkg/npm/api/groups/lib.ts +++ b/pkg/npm/api/groups/lib.ts @@ -198,7 +198,7 @@ export const isWriter = (group: Group, resource: string, ship: string) => { if (typeof writers === 'undefined') { return true; } else { - return writers.includes(ship) || admins.includes(ship); + return [...writers].includes(ship) || admins.includes(ship); } }; diff --git a/pkg/npm/api/package.json b/pkg/npm/api/package.json index b6b376123..e5dc09718 100644 --- a/pkg/npm/api/package.json +++ b/pkg/npm/api/package.json @@ -1,6 +1,6 @@ { "name": "@urbit/api", - "version": "2.1.0", + "version": "2.1.1", "description": "A library that provides bindings and types for Urbit's various userspace desks", "repository": { "type": "git",