Natio
record-diff
PoolDetect added, changed and removed API records with deterministic SHA-256 snapshots, without persisting the original payloads.
$ lpm install @lpm.dev/nora-natio.record-diff
8 exportsTypeScript
Functions
canonicalJson
function canonicalJson(value: JsonValue): string
| Parameter | Type | Description |
|---|---|---|
value | JsonValue |
fingerprint
function fingerprint(value: JsonValue): string
| Parameter | Type | Description |
|---|---|---|
value | JsonValue |
createSnapshot
function createSnapshot<T>(records: T[], options?: Options<T>): Snapshot
| Parameter | Type | Description |
|---|---|---|
records | T[] | |
optionsoptional | Options<T> |
diffRecords
function diffRecords<T>(previous: Snapshot | null, records: T[], options?: Options<T>): Diff<T>
| Parameter | Type | Description |
|---|---|---|
previous | Snapshot | null | |
records | T[] | |
optionsoptional | Options<T> |
Interfaces
Snapshot
| Property | Type | Description |
|---|---|---|
version | 1 | |
algorithm | 'sha256' | |
entries | Array<{ id: string; hash: string }> |
Options
<T>| Property | Type | Description |
|---|---|---|
keyoptional | string | ((record: T) => string) | |
selectoptional | (record: T) => JsonValue |
Diff
<T>| Property | Type | Description |
|---|---|---|
added | T[] | |
changed | T[] | |
removed | string[] | |
unchanged | string[] | |
snapshot | Snapshot |
Types
JsonValue
type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue }Unlimited AccessInstall as many Pool packages as you need.
Fund Real WorkEvery install you run sends revenue directly to the developer who built it.
Taxes calculated at checkout based on your location.
Insights
76/100Good
Version
1.0.0Published
LicenseMIT
Size13.34 KiB
Files7
Node version>= 18
TypeScriptYes