Suite of AT Protocol TypeScript libraries built on web standards
21
fork

Configure Feed

Select the types of activity you want to include in your feed.

lex fixes

+10 -9
+1 -1
common/deno.json
··· 1 1 { 2 2 "name": "@atp/common", 3 - "version": "0.1.0-alpha.2", 3 + "version": "0.1.0-alpha.3", 4 4 "exports": "./mod.ts", 5 5 "license": "MIT", 6 6 "imports": {
+4 -4
common/ipld.ts
··· 160 160 if (val && typeof val === "object") { 161 161 const obj = val as Record<string, unknown>; 162 162 // check for dag json values 163 - if (typeof obj["$link"] === "string" && Object.keys(obj).length === 1) { 163 + if (typeof obj["$link"] === "string" && Object.keys(val).length === 1) { 164 164 return CID.parse(obj["$link"]); 165 165 } 166 166 if (typeof obj["$bytes"] === "string" && Object.keys(val).length === 1) { ··· 168 168 } 169 169 // walk plain objects 170 170 const toReturn: Record<string, IpldValue> = {}; 171 - for (const key of Object.keys(obj)) { 171 + for (const key of Object.keys(val)) { 172 172 toReturn[key] = jsonToIpld(obj[key]); 173 173 } 174 174 return toReturn; ··· 199 199 } 200 200 // walk plain objects 201 201 const toReturn: Record<string, JsonValue> = {}; 202 - for (const key of Object.keys(obj)) { 202 + for (const key of Object.keys(val)) { 203 203 toReturn[key] = ipldToJson(obj[key]); 204 204 } 205 205 return toReturn; ··· 225 225 } 226 226 // check cids 227 227 if (CID.asCID(a) && CID.asCID(b)) { 228 - return CID.asCID(a)!.equals(CID.asCID(b)); 228 + return (CID.asCID(a)?.equals(CID.asCID(b))) ? true : false; 229 229 } 230 230 // walk plain objects 231 231 const objA = a as Record<string, IpldValue>;
+1 -1
lexicon/blob-refs.ts
··· 63 63 if (check.is(json, typedJsonBlobRef)) { 64 64 return new BlobRef(json.ref as CID, json.mimeType, json.size, json); 65 65 } else { 66 - return new BlobRef(CID.parse(json.cid), json.mimeType, -1); 66 + return new BlobRef(CID.parse(json.cid), json.mimeType, -1, json); 67 67 } 68 68 } 69 69
+1 -1
lexicon/deno.json
··· 1 1 { 2 2 "name": "@atp/lexicon", 3 - "version": "0.1.0-alpha.1", 3 + "version": "0.1.0-alpha.2", 4 4 "exports": "./mod.ts", 5 5 "license": "MIT", 6 6 "imports": {
+3 -2
lexicon/serialize.ts
··· 26 26 } 27 27 // objects 28 28 if (val && typeof val === "object") { 29 + const obj = val as Record<string, LexValue>; 29 30 // convert blobs, leaving the original encoding so that we don't change CIDs on re-encode 30 31 if (val instanceof BlobRef) { 31 32 return val.original; ··· 37 38 // walk plain objects 38 39 const toReturn: Record<string, IpldValue> = {}; 39 40 for (const key of Object.keys(val)) { 40 - toReturn[key] = lexToIpld((val as Record<string, LexValue>)[key]); 41 + toReturn[key] = lexToIpld(obj[key]); 41 42 } 42 43 return toReturn; 43 44 } ··· 69 70 // map plain objects 70 71 const toReturn: Record<string, LexValue> = {}; 71 72 for (const key of Object.keys(val)) { 72 - toReturn[key] = ipldToLex((val as Record<string, IpldValue>)[key]); 73 + toReturn[key] = ipldToLex(obj[key]); 73 74 } 74 75 return toReturn; 75 76 }