@uvrn/sdk 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 +33 -35
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @uvrn/sdk
|
|
2
2
|
|
|
3
|
-
TypeScript SDK for [UVRN Delta Engine](https://github.com/
|
|
3
|
+
TypeScript SDK for the [UVRN Delta Engine](https://github.com/UVRN-org/uvrn-packages) — programmatic access to deterministic verification and consensus computation.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The Delta Engine SDK provides a developer-friendly interface to interact with the
|
|
7
|
+
The Delta Engine SDK provides a developer-friendly interface to interact with the Delta Engine in multiple execution modes:
|
|
8
8
|
|
|
9
9
|
- **CLI Mode**: Spawn the CLI executable as a child process
|
|
10
10
|
- **HTTP Mode**: Make REST API calls to a running Delta Engine server
|
|
@@ -32,20 +32,20 @@ const client = new DeltaEngineClient({
|
|
|
32
32
|
|
|
33
33
|
// Build a bundle
|
|
34
34
|
const bundle = new BundleBuilder()
|
|
35
|
-
.setClaim('
|
|
35
|
+
.setClaim('Metrics from source-a and source-b agree within 5%')
|
|
36
36
|
.addDataSpecQuick(
|
|
37
|
-
'
|
|
38
|
-
'
|
|
37
|
+
'source-a',
|
|
38
|
+
'Source A',
|
|
39
39
|
'report',
|
|
40
|
-
['
|
|
41
|
-
[{ key: '
|
|
40
|
+
['doc-001'],
|
|
41
|
+
[{ key: 'total', value: 1000, unit: 'count' }]
|
|
42
42
|
)
|
|
43
43
|
.addDataSpecQuick(
|
|
44
|
-
'
|
|
45
|
-
'
|
|
44
|
+
'source-b',
|
|
45
|
+
'Source B',
|
|
46
46
|
'report',
|
|
47
|
-
['
|
|
48
|
-
[{ key: '
|
|
47
|
+
['doc-002'],
|
|
48
|
+
[{ key: 'total', value: 1020, unit: 'count' }]
|
|
49
49
|
)
|
|
50
50
|
.setThreshold(0.05)
|
|
51
51
|
.build();
|
|
@@ -68,20 +68,20 @@ const client = new DeltaEngineClient({
|
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
const bundle = new BundleBuilder()
|
|
71
|
-
.setClaim('
|
|
71
|
+
.setClaim('Metrics from two sources agree within 10%')
|
|
72
72
|
.addDataSpec({
|
|
73
73
|
id: 'source-1',
|
|
74
|
-
label: '
|
|
74
|
+
label: 'Source One',
|
|
75
75
|
sourceKind: 'report',
|
|
76
|
-
originDocIds: ['
|
|
77
|
-
metrics: [{ key: '
|
|
76
|
+
originDocIds: ['doc-001'],
|
|
77
|
+
metrics: [{ key: 'total', value: 500 }]
|
|
78
78
|
})
|
|
79
79
|
.addDataSpec({
|
|
80
80
|
id: 'source-2',
|
|
81
|
-
label: '
|
|
81
|
+
label: 'Source Two',
|
|
82
82
|
sourceKind: 'report',
|
|
83
|
-
originDocIds: ['
|
|
84
|
-
metrics: [{ key: '
|
|
83
|
+
originDocIds: ['doc-002'],
|
|
84
|
+
metrics: [{ key: 'total', value: 485 }]
|
|
85
85
|
})
|
|
86
86
|
.setThresholdPercent(10)
|
|
87
87
|
.build();
|
|
@@ -235,6 +235,13 @@ Validates current configuration.
|
|
|
235
235
|
|
|
236
236
|
Builds and returns the bundle (throws if invalid).
|
|
237
237
|
|
|
238
|
+
## Use cases
|
|
239
|
+
|
|
240
|
+
- **Run the engine from code** — Use local mode to run comparisons in-process, or HTTP/CLI mode to call a remote server or CLI.
|
|
241
|
+
- **Build bundles programmatically** — Use BundleBuilder to construct valid bundles without hand-writing JSON.
|
|
242
|
+
- **Validate and verify in pipelines** — Validate bundles before run; verify receipt hashes after run for integrity checks.
|
|
243
|
+
- **Integrate into any service** — Same API whether you use CLI, HTTP, or local; switch modes via config.
|
|
244
|
+
|
|
238
245
|
### Validators
|
|
239
246
|
|
|
240
247
|
**`validateBundle(bundle: unknown): ValidationResult`**
|
|
@@ -302,11 +309,15 @@ See the [examples directory](./examples/) for complete working examples:
|
|
|
302
309
|
- [examples/error-handling/](./examples/error-handling/) - Error handling patterns
|
|
303
310
|
- [examples/batch-processing/](./examples/batch-processing/) - Processing multiple bundles
|
|
304
311
|
|
|
305
|
-
##
|
|
312
|
+
## Links
|
|
313
|
+
|
|
314
|
+
**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).
|
|
306
315
|
|
|
307
|
-
- [
|
|
308
|
-
- [
|
|
309
|
-
- [
|
|
316
|
+
- [Repository](https://github.com/UVRN-org/uvrn-packages) — monorepo (this package: `uvrn-sdk`)
|
|
317
|
+
- [SDK Guide](./docs/SDK_GUIDE.md) — comprehensive usage guide
|
|
318
|
+
- [@uvrn/core](https://www.npmjs.com/package/@uvrn/core) — Delta Engine core (used in local mode)
|
|
319
|
+
- [@uvrn/cli](https://www.npmjs.com/package/@uvrn/cli) — run the engine from the command line
|
|
320
|
+
- [@uvrn/api](https://www.npmjs.com/package/@uvrn/api) — HTTP server for the engine
|
|
310
321
|
|
|
311
322
|
## Requirements
|
|
312
323
|
|
|
@@ -316,16 +327,3 @@ See the [examples directory](./examples/) for complete working examples:
|
|
|
316
327
|
## License
|
|
317
328
|
|
|
318
329
|
MIT
|
|
319
|
-
|
|
320
|
-
## Contributing
|
|
321
|
-
|
|
322
|
-
Contributions are welcome! Please see the main repository for contribution guidelines.
|
|
323
|
-
|
|
324
|
-
## Support
|
|
325
|
-
|
|
326
|
-
- GitHub Issues: [Report a bug](https://github.com/uvrn/uvrn-core/issues)
|
|
327
|
-
- Documentation: [Full documentation](https://github.com/uvrn/uvrn-core/tree/main/docs)
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
Built with ❤️ by the Loosechain team
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uvrn/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "UVRN TypeScript SDK — programmatic access to deterministic verification",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,6 +19,12 @@
|
|
|
19
19
|
"typescript"
|
|
20
20
|
],
|
|
21
21
|
"license": "MIT",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://github.com/UVRN-org/uvrn-packages.git",
|
|
25
|
+
"directory": "uvrn-sdk"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/UVRN-org/uvrn-packages#readme",
|
|
22
28
|
"peerDependencies": {
|
|
23
29
|
"@uvrn/core": "^1.0.0"
|
|
24
30
|
},
|
|
@@ -32,7 +38,7 @@
|
|
|
32
38
|
"jest": "^29.5.0",
|
|
33
39
|
"ts-jest": "^29.1.0",
|
|
34
40
|
"typescript": "^5.3.0",
|
|
35
|
-
"@uvrn/core": "1.0.
|
|
41
|
+
"@uvrn/core": "1.0.2"
|
|
36
42
|
},
|
|
37
43
|
"engines": {
|
|
38
44
|
"node": ">=18.0.0"
|