genome 1.0.3 → 1.0.5
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/genome.js +9 -0
- package/package.json +3 -3
- package/genome_rs.d.ts +0 -93
- package/genome_rs.js +0 -9
- package/genome_rs_bg.wasm +0 -0
package/genome.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./genome.d.ts" */
|
|
2
|
+
|
|
3
|
+
import * as wasm from "./genome_bg.wasm";
|
|
4
|
+
import { __wbg_set_wasm } from "./genome_bg.js";
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
wasm.__wbindgen_start();
|
|
7
|
+
export {
|
|
8
|
+
compare, compareValues, hash, hashStr, reset, seed, setConfig, signature
|
|
9
|
+
} from "./genome_bg.js";
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"Michael Sweeney <overthemike@gmail.com>"
|
|
6
6
|
],
|
|
7
7
|
"description": "Deterministic structure ID generation for JavaScript objects using hierarchical hashing and collision-resistant algorithms",
|
|
8
|
-
"version": "1.0.
|
|
8
|
+
"version": "1.0.5",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": "https://github.com/overthemike/genome.git",
|
|
11
11
|
"files": [
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"genome_rs_bg.js",
|
|
15
15
|
"genome_rs.d.ts"
|
|
16
16
|
],
|
|
17
|
-
"main": "
|
|
17
|
+
"main": "genome.js",
|
|
18
18
|
"homepage": "https://github.com/overthemike/genome",
|
|
19
|
-
"types": "
|
|
19
|
+
"types": "genome.d.ts",
|
|
20
20
|
"sideEffects": [
|
|
21
21
|
"./genome_rs.js",
|
|
22
22
|
"./snippets/*"
|
package/genome_rs.d.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Compares two structure ID strings and returns a similarity score
|
|
6
|
-
* between 0.0 (completely different) and 1.0 (identical).
|
|
7
|
-
*
|
|
8
|
-
* ```js
|
|
9
|
-
* import { compare } from 'genome'
|
|
10
|
-
* const score = compare("L0:100-L1:200", "L0:100-L1:200") // 1.0
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
export function compare(id_a: string, id_b: string): number;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Compares two JSON strings structurally and returns a similarity score.
|
|
17
|
-
*
|
|
18
|
-
* ```js
|
|
19
|
-
* import { compareValues } from 'genome'
|
|
20
|
-
* const score = compareValues(
|
|
21
|
-
* JSON.stringify({ id: 1, name: "alice" }),
|
|
22
|
-
* JSON.stringify({ id: 2, name: "bob" }),
|
|
23
|
-
* ) // 1.0 — same structure
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export function compareValues(a: string, b: string): number;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Generates a deterministic hierarchical structure ID for a JSON string.
|
|
30
|
-
*
|
|
31
|
-
* ```js
|
|
32
|
-
* import { hash } from 'genome'
|
|
33
|
-
* const id = hash(JSON.stringify({ id: 1, name: "alice" }))
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export function hash(json: string): string;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Hashes a string with xxHash32 and returns a hex string.
|
|
40
|
-
*
|
|
41
|
-
* ```js
|
|
42
|
-
* import { hashStr } from 'genome'
|
|
43
|
-
* const hex = hashStr("hello", 0)
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export function hashStr(input: string, seed: number): string;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Resets all internal state — clears the key cache and collision counters.
|
|
50
|
-
*
|
|
51
|
-
* ```js
|
|
52
|
-
* import { reset } from 'genome'
|
|
53
|
-
* reset()
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
export function reset(): void;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Seeds the collision counter for a known signature.
|
|
60
|
-
* Use this to restore persisted counter state.
|
|
61
|
-
*
|
|
62
|
-
* ```js
|
|
63
|
-
* import { seed } from 'genome'
|
|
64
|
-
* seed("L1:12345-L2:67890", 3n)
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export function seed(signature: string, count: bigint): void;
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Sets the global config. Call this before using any other functions
|
|
71
|
-
* if you need non-default behaviour.
|
|
72
|
-
*
|
|
73
|
-
* ```js
|
|
74
|
-
* import { setConfig, hash } from 'genome'
|
|
75
|
-
*
|
|
76
|
-
* setConfig({ ignoreArrayLength: true, ignoreValueTypes: true })
|
|
77
|
-
* const id = hash(JSON.stringify({ items: [1, 2, 3] }))
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
export function setConfig(new_id_on_collision: boolean, ignore_array_length: boolean, ignore_value_types: boolean): void;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Returns the structural signature for a JSON string.
|
|
84
|
-
*
|
|
85
|
-
* In default mode returns the full ID. When `newIdOnCollision` is true
|
|
86
|
-
* (set via `setConfig`), strips L0 and returns L1+ only.
|
|
87
|
-
*
|
|
88
|
-
* ```js
|
|
89
|
-
* import { signature } from 'genome'
|
|
90
|
-
* const sig = signature(JSON.stringify({ id: 1, name: "alice" }))
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
export function signature(json: string): string;
|
package/genome_rs.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* @ts-self-types="./genome_rs.d.ts" */
|
|
2
|
-
|
|
3
|
-
import * as wasm from "./genome_rs_bg.wasm";
|
|
4
|
-
import { __wbg_set_wasm } from "./genome_rs_bg.js";
|
|
5
|
-
__wbg_set_wasm(wasm);
|
|
6
|
-
wasm.__wbindgen_start();
|
|
7
|
-
export {
|
|
8
|
-
compare, compareValues, hash, hashStr, reset, seed, setConfig, signature
|
|
9
|
-
} from "./genome_rs_bg.js";
|
package/genome_rs_bg.wasm
DELETED
|
Binary file
|