@uvrn/core 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -0
- package/package.json +7 -1
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @uvrn/core
|
|
2
|
+
|
|
3
|
+
UVRN Delta Engine core — deterministic multi-source comparison and verification. Runs the Delta formula on bundles, produces canonical receipts with SHA-256 hashes, and validates or verifies bundles and receipts.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @uvrn/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or with pnpm:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @uvrn/core
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
1. Define a **bundle**: a claim, a threshold, and at least two data specs with metrics.
|
|
20
|
+
2. Call `runDeltaEngine(bundle)` to get a **receipt** (outcome, delta, hash).
|
|
21
|
+
3. Use `validateBundle` and `verifyReceipt` for validation and integrity checks.
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { runDeltaEngine, validateBundle, verifyReceipt } from '@uvrn/core';
|
|
25
|
+
|
|
26
|
+
const bundle = {
|
|
27
|
+
bundleId: 'example-001',
|
|
28
|
+
claim: 'Metrics from source-a and source-b should agree within 10%.',
|
|
29
|
+
thresholdPct: 0.10,
|
|
30
|
+
dataSpecs: [
|
|
31
|
+
{
|
|
32
|
+
id: 'source-a',
|
|
33
|
+
label: 'Source A',
|
|
34
|
+
sourceKind: 'report',
|
|
35
|
+
originDocIds: ['doc-a-1'],
|
|
36
|
+
metrics: [{ key: 'count', value: 100 }],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'source-b',
|
|
40
|
+
label: 'Source B',
|
|
41
|
+
sourceKind: 'report',
|
|
42
|
+
originDocIds: ['doc-b-1'],
|
|
43
|
+
metrics: [{ key: 'count', value: 105 }],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const receipt = runDeltaEngine(bundle);
|
|
49
|
+
console.log(receipt.outcome); // 'consensus' | 'indeterminate'
|
|
50
|
+
console.log(receipt.deltaFinal); // max delta across metrics
|
|
51
|
+
console.log(receipt.hash); // SHA-256 of canonical receipt
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Use cases
|
|
55
|
+
|
|
56
|
+
- **Compare two or more data sources** — Run the Delta formula on metrics (e.g. report A vs report B) and get a deterministic consensus or indeterminate outcome.
|
|
57
|
+
- **Produce verifiable receipts** — Every receipt has a canonical hash; use `verifyReceipt(receipt)` to recompute and check integrity.
|
|
58
|
+
- **Validate before running** — Use `validateBundle(bundle)` to check structure and threshold without executing the engine.
|
|
59
|
+
- **Integrate into pipelines** — Use as a library in CI, ETL, or any service that needs deterministic comparison and proof.
|
|
60
|
+
|
|
61
|
+
## Links
|
|
62
|
+
|
|
63
|
+
**Open source:** Source code and issues: [GitHub (uvrn-packages)](https://github.com/UVRN-org/uvrn-packages). Project landing: [UVRN](https://github.com/UVRN-org/uvrn).
|
|
64
|
+
|
|
65
|
+
- [Repository](https://github.com/UVRN-org/uvrn-packages) — monorepo (this package: `uvrn-core`)
|
|
66
|
+
- [@uvrn/sdk](https://www.npmjs.com/package/@uvrn/sdk) — programmatic client (CLI/HTTP/local) built on this core
|
|
67
|
+
- [@uvrn/cli](https://www.npmjs.com/package/@uvrn/cli) — run the engine from the command line
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uvrn/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "UVRN engine core — deterministic protocol infrastructure",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,6 +11,12 @@
|
|
|
11
11
|
"consensus"
|
|
12
12
|
],
|
|
13
13
|
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/UVRN-org/uvrn-packages.git",
|
|
17
|
+
"directory": "uvrn-core"
|
|
18
|
+
},
|
|
19
|
+
"homepage": "https://github.com/UVRN-org/uvrn-packages#readme",
|
|
14
20
|
"devDependencies": {
|
|
15
21
|
"@types/jest": "^29.5.0",
|
|
16
22
|
"@types/node": "^20.0.0",
|