@synonymdev/feeds
Advanced tools
Comparing version 2.1.1 to 3.0.0
@@ -1,2 +0,1 @@ | ||
const b4a = require('b4a') | ||
const SlashURL = require('@synonymdev/slashtags-url') | ||
@@ -124,7 +123,8 @@ | ||
static encode (value) { | ||
if (b4a.isBuffer(value)) return value | ||
try { | ||
value = JSON.stringify(value) | ||
} catch { | ||
} | ||
try { | ||
return b4a.from(JSON.stringify(value)) | ||
} catch { } | ||
return Buffer.from(value) | ||
} | ||
@@ -138,4 +138,6 @@ | ||
static decode (value) { | ||
const string = Buffer.from(value).toString() | ||
try { | ||
return JSON.parse(b4a.toString(value)) | ||
return JSON.parse(string) | ||
} catch { } | ||
@@ -142,0 +144,0 @@ |
{ | ||
"name": "@synonymdev/feeds", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"main": "index.js", | ||
@@ -20,3 +20,3 @@ "types": "types/index.d.ts", | ||
"dependencies": { | ||
"b4a": "^1.5.3" | ||
"@synonymdev/slashtags-url": "^1.0.1" | ||
}, | ||
@@ -23,0 +23,0 @@ "devDependencies": { |
# Slashtags Feeds | ||
A library for creating and managing feeds using Hyperdrive and Hyperswarm. | ||
A library for creating and managing feeds using the web-relay | ||
@@ -5,0 +5,0 @@ ## Usage |
@@ -56,3 +56,3 @@ export = Reader; | ||
*/ | ||
getField<T>(name: string, decode?: (buf: Uint8Array) => T): Promise<T>; | ||
getField<T>(name: string, decode?: (buf: Uint8Array) => T): Promise<T | null>; | ||
/** | ||
@@ -69,3 +69,3 @@ * Subscribe to a field | ||
*/ | ||
subscribe<T_1>(name: string, onupdate?: (value: any) => any, decode?: (buf: Uint8Array) => T_1): () => void; | ||
subscribe<T>(name: string, onupdate?: (value: any) => any, decode?: (buf: Uint8Array) => T): () => void; | ||
/** | ||
@@ -80,5 +80,5 @@ * @param {string} name | ||
} | ||
type Config = import('./writer').Config; | ||
import Feed = require("./writer.js"); | ||
type WebRelayClient = import('@synonymdev/web-relay/types/lib/client/index'); | ||
type WebRelayClient = import("@synonymdev/web-relay/types/lib/client/index"); | ||
type Config = import("./writer").Config; | ||
//# sourceMappingURL=reader.d.ts.map |
@@ -73,4 +73,4 @@ export = Feed; | ||
} | ||
type WebRelayClient = import("@synonymdev/web-relay/types/lib/client/index"); | ||
type Config = { | ||
[key: string]: any; | ||
name: string; | ||
@@ -83,4 +83,3 @@ description?: string; | ||
version?: string; | ||
fields?: { | ||
[key: string]: any; | ||
fields?: Array<{ | ||
name: string; | ||
@@ -92,5 +91,6 @@ description?: string; | ||
}; | ||
}[]; | ||
[key: string]: any; | ||
}>; | ||
[key: string]: any; | ||
}; | ||
type WebRelayClient = import('@synonymdev/web-relay/types/lib/client/index'); | ||
//# sourceMappingURL=writer.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
19198
440
0
+ Added@synonymdev/slashtags-url@1.0.1(transitive)
+ Addedz32@1.1.0(transitive)
- Removedb4a@^1.5.3