@kent-tokyo/chematic 1.0.12 → 1.0.14

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 CHANGED
@@ -4,6 +4,10 @@ WebAssembly bindings for [chematic](https://github.com/kent-tokyo/chematic), a p
4
4
 
5
5
  Published to npm as [`@kent-tokyo/chematic`](https://www.npmjs.com/package/@kent-tokyo/chematic).
6
6
 
7
+ The current workspace line is 1.0.14. The binding keeps bounded parsing,
8
+ typed failures, and opt-in `embed_pipeline_v2_json`; 3D/MMFF94 behavior remains
9
+ Experimental and is not a claim of full RDKit parity.
10
+
7
11
  ## Installation
8
12
 
9
13
  ```sh
@@ -29,7 +33,8 @@ npm install @kent-tokyo/chematic
29
33
  deterministic input indices and partial/complete status; bounded malformed
30
34
  XYZ frames are grouped inline as rejected records when a later count-line
31
35
  boundary is recoverable (core file-backed readers remain fail-stop)
32
- - Bounded topology parsing for CML, ChemicalJSON (`mol_from_cjson`), MolJSON,
36
+ - Bounded topology parsing for CML (`mol_from_cml_strict` provides the opt-in
37
+ non-empty, balanced, single-root boundary), ChemicalJSON (`mol_from_cjson`), MolJSON,
33
38
  CDXML, MOL2, and PDB/mmCIF
34
39
  - PDBx/mmCIF, PQR, QCSchema JSON, ORCA input/output, Gaussian Cube, OpenDX,
35
40
  and LAMMPS data/dump I/O (JSON-based bindings; see `format_io.rs`)
@@ -99,6 +104,11 @@ console.log(mol.labute_asa()); // Labute approx. surface area
99
104
  const charges = JSON.parse(gasteiger_charges_json(mol));
100
105
  console.log(charges); // [-0.08, 0.12, -0.43, ...]
101
106
 
107
+ // Explicit RDKit-compatibility descriptor profile (kept separate from the
108
+ // historical native get_descriptors_json() profile)
109
+ const rdkitDescriptors = JSON.parse(get_rdkit_descriptors_json(mol));
110
+ console.log(rdkitDescriptors.aromatic_ring_count);
111
+
102
112
  // VSA descriptor bins
103
113
  const slogpVsa = JSON.parse(slogp_vsa_json(mol));
104
114
  const smrVsa = JSON.parse(smr_vsa_json(mol));
@@ -167,12 +177,65 @@ portable across native and `wasm32-unknown-unknown`
167
177
  precision across every JS engine, only that the value is finite, non-negative,
168
178
  and enforced correctly on all of them.
169
179
 
180
+ `nearest_neighbors_json` keeps its historical chematic-native ECFP4 profile.
181
+ For the separately named RDKit-compatible Morgan profile, use
182
+ `rdkit_nearest_neighbors_json(querySmiles, dbSmilesJson, k)`. It returns the
183
+ same `{index, tanimoto}` shape and reports preprocessing failures without
184
+ silently falling back to native ECFP4.
185
+
186
+ For repeated queries, construct `new RdkitSearchIndex(dbSmilesJson)` once and
187
+ call `index.search_json(querySmiles, k)`. The prepared index is intended for
188
+ chunked libraries up to the WASM batch limit and applies the same fail-closed
189
+ RDKit-compatible profile without rebuilding database fingerprints per query.
190
+
191
+ ## V3000 SGROUP syntax view
192
+
193
+ `v3000_sgroups_json(block)` exposes bounded, typed SGROUP syntax without
194
+ expanding polymer or Markush semantics. It preserves source order for unknown
195
+ attributes and returns `kindToken` for unknown group kinds. Group IDs, parent
196
+ references, atom references, and grouped-field counts are validated before
197
+ JSON is returned.
198
+
199
+ ```js
200
+ const groups = JSON.parse(v3000_sgroups_json(v3000Block));
201
+ // [{ id, kind, parentId, atomIds, attributes, kindToken? }]
202
+ ```
203
+
204
+ This is a syntax-level API; it does not claim polymer expansion, Markush
205
+ interpretation, or cross-engine semantic compatibility.
206
+
170
207
  ## Bundle Size
171
208
 
172
- The optimized v1.0.10 candidate artifact was measured at **3.73 MB raw / 1.36 MB gzip**. Bundle size depends on features and toolchain; see [`benchmarks/2026-09-09-wasm-size-v1.0.10.md`](../../benchmarks/2026-09-09-wasm-size-v1.0.10.md) for exact tools, digest, and reproduction steps.
209
+ The optimized v1.0.12 artifact was measured at **3.93 MB raw / 1.43 MB gzip**. Bundle size depends on features and toolchain; see [`benchmarks/2026-09-11-official-rdkit-js-v1.0.12.md`](../../benchmarks/2026-09-11-official-rdkit-js-v1.0.12.md) for exact tools, digest, and reproduction steps.
173
210
 
174
211
  PNG rasterization (`tiny_skia`) is excluded from the WASM build — use SVG output instead. All SVG depiction APIs remain fully available.
175
212
 
213
+ ## Versioned document binding boundary
214
+
215
+ The `*_v1` document APIs provide a stable JSON boundary for downstream editors:
216
+
217
+ ```js
218
+ const parsed = JSON.parse(reaction_document_json_v1(JSON.stringify(document)));
219
+ const edited = JSON.parse(edit_reaction_document_json_v1(
220
+ JSON.stringify(parsed),
221
+ JSON.stringify({ kind: "set_step_condition", step_id: "step-1", key: "temperature", value: "25 C" }),
222
+ ));
223
+
224
+ const cdxmlEnvelope = JSON.parse(cdxml_document_json_v1(cdxml));
225
+ const cdxmlAgain = cdxml_document_from_json_v1(JSON.stringify(cdxmlEnvelope));
226
+ ```
227
+
228
+ `cdxml_document_json_v1` retains the exact `source` string and returns a
229
+ structural `document` summary with opaque objects and `diagnostics`. Use
230
+ `edit_cdxml_document_json_v1` for bounded page/object edits; it reparses the
231
+ result before returning. Errors are JSON-shaped with stable `code`, `path`, and
232
+ `message` fields (`malformed_input`, `resource_limit`,
233
+ `unsupported_construct`, `lossy_conversion`, or `serialization_error`).
234
+ `reaction_document_to_rxn_v1` and `cdxml_document_projection_json_v1` reject
235
+ lossy legacy projections with `lossy_conversion` diagnostics. These APIs do not claim
236
+ mechanism correctness, product prediction, complete stoichiometry, or full
237
+ ChemDraw/RXN compatibility.
238
+
176
239
  ## Building from source
177
240
 
178
241
  ```sh
@@ -409,6 +409,10 @@ export class MolHandle {
409
409
  * Most basic pKa in the molecule, or NaN if no basic site.
410
410
  */
411
411
  pka_base_value(): number;
412
+ /**
413
+ * Atom indices of potential tetrahedral stereocenters.
414
+ */
415
+ potential_stereocenter_indices(): Uint32Array;
412
416
  /**
413
417
  * Quantitative Estimate of Drug-likeness (QED); range [0, 1].
414
418
  */
@@ -462,6 +466,47 @@ export class MolHandle {
462
466
  zagreb_index_m1(): number;
463
467
  }
464
468
 
469
+ /**
470
+ * Reusable prepared index for the RDKit-compatible Morgan profile.
471
+ *
472
+ * Build one index per input chunk (the WASM batch limit is 1,024 molecules),
473
+ * then call [`RdkitSearchIndex::search_json`] for multiple queries without
474
+ * reparsing or refingerprinting the database.
475
+ */
476
+ export class RdkitSearchIndex {
477
+ free(): void;
478
+ [Symbol.dispose](): void;
479
+ /**
480
+ * Whether the prepared index contains no molecules.
481
+ */
482
+ is_empty(): boolean;
483
+ /**
484
+ * Number of molecules in this chunk.
485
+ */
486
+ len(): number;
487
+ /**
488
+ * Build an index from a JSON array of SMILES strings.
489
+ */
490
+ constructor(db_smiles_json: string);
491
+ /**
492
+ * Search the prepared index with a query SMILES.
493
+ */
494
+ search_json(query_smiles: string, k: number): string;
495
+ /**
496
+ * Search without the historical six-decimal JSON score truncation.
497
+ *
498
+ * This opt-in endpoint is for exact parity measurements. Callers that
499
+ * need the stable historical wire format should continue using
500
+ * RdkitSearchIndex::search_json.
501
+ */
502
+ search_json_precise(query_smiles: string, k: number): string;
503
+ /**
504
+ * Search with an inclusive Tanimoto threshold and precise JSON scores.
505
+ * A threshold of `0.0` includes zero-score candidates.
506
+ */
507
+ search_json_threshold_precise(query_smiles: string, threshold: number, k: number): string;
508
+ }
509
+
465
510
  /**
466
511
  * Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
467
512
  */
@@ -593,6 +638,11 @@ export function canonical_tautomer_with_blocked_atoms_json(mol: MolHandle, block
593
638
  */
594
639
  export function canonicalize_smiles_batch_json(smiles_batch: string, delimiter: string): string;
595
640
 
641
+ /**
642
+ * Validate a versioned CDXML JSON envelope and serialize its exact source.
643
+ */
644
+ export function cdxml_document_from_json_v1(document_json: string): string;
645
+
596
646
  /**
597
647
  * Parse a CDXML document while preserving page and presentation objects.
598
648
  * The returned JSON contains an opaque `raw_xml` for each object so unknown
@@ -600,6 +650,22 @@ export function canonicalize_smiles_batch_json(smiles_batch: string, delimiter:
600
650
  */
601
651
  export function cdxml_document_json(cdxml: string): string;
602
652
 
653
+ /**
654
+ * Return a loss-preserving, versioned JSON envelope for a CDXML document.
655
+ *
656
+ * `source` is retained for exact re-serialization; `document` is the stable
657
+ * structural summary used by editors. Unknown objects remain in the summary
658
+ * and are listed under `document.diagnostics`.
659
+ */
660
+ export function cdxml_document_json_v1(cdxml: string): string;
661
+
662
+ /**
663
+ * Project a CDXML document to its first molecular fragment only when no
664
+ * presentation data would be lost. Unknown/presentation objects are reported
665
+ * as an explicit lossy conversion instead of being silently dropped.
666
+ */
667
+ export function cdxml_document_projection_json_v1(cdxml: string): string;
668
+
603
669
  /**
604
670
  * Parse all molecular fragments from a CDXML string.
605
671
  *
@@ -872,6 +938,18 @@ export function ecfp_bitvec_custom(mol: MolHandle, radius: number, nbits: number
872
938
  */
873
939
  export function edit_cdxml_document_json(cdxml: string, edit_json: string): string;
874
940
 
941
+ /**
942
+ * Apply a bounded CDXML edit to a versioned JSON envelope and return the
943
+ * updated envelope. The source is reparsed after editing, so paths and
944
+ * diagnostics cannot drift from the returned document summary.
945
+ */
946
+ export function edit_cdxml_document_json_v1(document_json: string, edit_json: string): string;
947
+
948
+ /**
949
+ * Apply a bounded, stable-ID reaction-document edit and return canonical JSON.
950
+ */
951
+ export function edit_reaction_document_json_v1(document_json: string, edit_json: string): string;
952
+
875
953
  /**
876
954
  * Run `embed_ensemble_v2` on `mol`'s own atom order (never canonicalizes/
877
955
  * reparses, same convention as `embed_pipeline_v2_json`). See the module doc
@@ -1157,6 +1235,17 @@ export function get_descriptors_json(mol: MolHandle): string;
1157
1235
  */
1158
1236
  export function get_dihedral_json(smiles: string, a: number, b: number, c: number, d: number): any;
1159
1237
 
1238
+ /**
1239
+ * RDKit-compatibility descriptor profile as JSON.
1240
+ *
1241
+ * This is deliberately separate from [`get_descriptors_json`]: the latter is
1242
+ * the historical native profile, while this profile uses the opt-in RDKit
1243
+ * molecular-weight, HBA, and aromatic-ring implementations. Keeping the
1244
+ * boundary explicit prevents a compatibility correction from silently
1245
+ * changing the browser's native descriptor contract.
1246
+ */
1247
+ export function get_rdkit_descriptors_json(mol: MolHandle): string;
1248
+
1160
1249
  /**
1161
1250
  * Compute GETAWAY descriptors (GEometry, Topology and Atom-Weights AssemblY) from 3D coords.
1162
1251
  *
@@ -1456,7 +1545,7 @@ export function minimize_mmff94_lbfgs_json(mol: MolHandle, max_iter: number): st
1456
1545
  * `coords_json` — JSON array of `[x,y,z]` arrays (Å), one per atom.
1457
1546
  * `max_iter` — maximum iterations (0 = default 500).
1458
1547
  *
1459
- * Returns JSON: `{"coords":[[x,y,z],...], "energy":float, "iterations":int, "converged":bool, "sound":bool, "worst_bond_length":float}`
1548
+ * Returns JSON: `{"coords":[[x,y,z],...], "energy":float, "iterations":int, "converged":bool, "sound":bool, "worst_bond_length":float, "rejected_unsound_step":bool}`
1460
1549
  * or `{"error":"<msg>"}` on failure. `sound` is all-finite coordinates and
1461
1550
  * no bond stretched past a sane covalent-bond length — independent of
1462
1551
  * `converged`, since steepest descent often reports `converged:false` on
@@ -1619,6 +1708,14 @@ export function mol_from_cjson(json: string): MolHandle;
1619
1708
  */
1620
1709
  export function mol_from_cml(cml: string): MolHandle;
1621
1710
 
1711
+ /**
1712
+ * Parse a structurally valid, non-empty CML string into a `MolHandle`.
1713
+ *
1714
+ * This opt-in strict boundary rejects missing/empty molecules and malformed
1715
+ * XML while `mol_from_cml` retains its historical lenient behavior.
1716
+ */
1717
+ export function mol_from_cml_strict(cml: string): MolHandle;
1718
+
1622
1719
  /**
1623
1720
  * Parse a Gaussian Cube file and return a `MolHandle` (topology only --
1624
1721
  * element list, no bonds; Cube carries no bond table). Use
@@ -2145,6 +2242,17 @@ export function rdkit_ecfp_config_chiral_detail_json(mol: MolHandle, radius: num
2145
2242
  */
2146
2243
  export function rdkit_ecfp_config_detail_json(mol: MolHandle, radius: number, nbits: number): string;
2147
2244
 
2245
+ /**
2246
+ * Find the k nearest neighbours using the RDKit-compatible Morgan/ECFP4
2247
+ * profile. This is intentionally separate from [`nearest_neighbors_json`],
2248
+ * whose historical contract uses chematic's native ECFP4 profile.
2249
+ *
2250
+ * Returns JSON with the original database indices and six-decimal Tanimoto
2251
+ * scores. Any RDKit-profile preprocessing failure is returned as an error;
2252
+ * this API never falls back to the native profile.
2253
+ */
2254
+ export function rdkit_nearest_neighbors_json(query_smiles: string, db_smiles_json: string, k: number): string;
2255
+
2148
2256
  /**
2149
2257
  * Compute the RDKit-compatible Daylight-like path fingerprint as a bit-packed
2150
2258
  * byte vector (256 bytes = 2048 bits). This is the WASM counterpart of the
@@ -2167,6 +2275,21 @@ export function rdkit_rdk_bitvec(mol: MolHandle): Uint8Array;
2167
2275
  */
2168
2276
  export function rdkit_torsion_bitvec(mol: MolHandle): Uint8Array;
2169
2277
 
2278
+ /**
2279
+ * Validate and deterministically serialize a rich reaction document JSON.
2280
+ *
2281
+ * This is the versioned JSON boundary for WASM consumers. It preserves IDs,
2282
+ * metadata, and provenance, and rejects malformed documents before returning
2283
+ * JSON. Use [`edit_reaction_document_json_v1`] for bounded ID-addressed edits.
2284
+ */
2285
+ export function reaction_document_json_v1(document_json: string): string;
2286
+
2287
+ /**
2288
+ * Convert a rich reaction document to legacy RXN V2000 with structured loss
2289
+ * reporting. A lossy projection is never returned as if it were complete.
2290
+ */
2291
+ export function reaction_document_to_rxn_v1(document_json: string): string;
2292
+
2170
2293
  /**
2171
2294
  * Check whether a reaction SMILES matches a reaction SMARTS query.
2172
2295
  *
@@ -2238,13 +2361,13 @@ export function rgroup_decompose_json(smiles_json: string, core_smarts: string):
2238
2361
  export function ring_families_json(mol: MolHandle): string;
2239
2362
 
2240
2363
  /**
2241
- * Parse and serialize a V3000 block while preserving opaque V3000 metadata.
2364
+ * Parse and serialize a V3000 block while preserving V3000 metadata.
2242
2365
  *
2243
2366
  * Unlike the topology-only [`mol_from_v3000_block`] + [`to_mol_v3000_block`]
2244
2367
  * pair, this explicit round-trip API retains `SGROUP` logical lines and
2245
- * `COLLECTION` stereo groups. SGROUP semantics remain opaque until the core
2246
- * molecule model grows a typed representation; the API therefore preserves
2247
- * bytes at the logical-line level without claiming polymer/query semantics.
2368
+ * `COLLECTION` stereo groups. SGROUP polymer/query expansion is still out of
2369
+ * scope, but the typed syntax view is available through
2370
+ * [`v3000_sgroups_json`].
2248
2371
  */
2249
2372
  export function roundtrip_mol_v3000_block(block: string): string;
2250
2373
 
@@ -2655,6 +2778,8 @@ export function topo_path_bitvec(mol: MolHandle): Uint8Array;
2655
2778
  */
2656
2779
  export function torsion_bitvec(mol: MolHandle): Uint8Array;
2657
2780
 
2781
+ export function v3000_sgroups_json(block: string): string;
2782
+
2658
2783
  /**
2659
2784
  * Validate a vendor-neutral NMR spectrum JSON document without parsing a
2660
2785
  * vendor-specific raw file or predicting peaks.
@@ -2792,6 +2917,7 @@ export interface InitOutput {
2792
2917
  readonly __wbg_depictoptions_free: (a: number, b: number) => void;
2793
2918
  readonly __wbg_mhfplshhandle_free: (a: number, b: number) => void;
2794
2919
  readonly __wbg_molhandle_free: (a: number, b: number) => void;
2920
+ readonly __wbg_rdkitsearchindex_free: (a: number, b: number) => void;
2795
2921
  readonly add_hydrogens: (a: number) => number;
2796
2922
  readonly admet_profile_json: (a: number, b: number) => [number, number];
2797
2923
  readonly atom_pair_bitvec: (a: number) => [number, number];
@@ -2806,7 +2932,10 @@ export interface InitOutput {
2806
2932
  readonly canonical_tautomer: (a: number) => number;
2807
2933
  readonly canonical_tautomer_with_blocked_atoms_json: (a: number, b: number, c: number) => [number, number];
2808
2934
  readonly canonicalize_smiles_batch_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2935
+ readonly cdxml_document_from_json_v1: (a: number, b: number) => [number, number, number, number];
2809
2936
  readonly cdxml_document_json: (a: number, b: number) => [number, number, number, number];
2937
+ readonly cdxml_document_json_v1: (a: number, b: number) => [number, number, number, number];
2938
+ readonly cdxml_document_projection_json_v1: (a: number, b: number) => [number, number, number, number];
2810
2939
  readonly cdxml_to_smiles_json: (a: number, b: number) => [number, number, number, number];
2811
2940
  readonly charge_parent_json: (a: number) => [number, number];
2812
2941
  readonly chematic_version: () => [number, number];
@@ -2859,6 +2988,8 @@ export interface InitOutput {
2859
2988
  readonly ecfp6_bitvec_with_chirality: (a: number, b: number) => [number, number];
2860
2989
  readonly ecfp_bitvec_custom: (a: number, b: number, c: number, d: number) => [number, number];
2861
2990
  readonly edit_cdxml_document_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2991
+ readonly edit_cdxml_document_json_v1: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2992
+ readonly edit_reaction_document_json_v1: (a: number, b: number, c: number, d: number) => [number, number, number, number];
2862
2993
  readonly embed_ensemble_v2_json: (a: number, b: number, c: number) => [number, number];
2863
2994
  readonly embed_pipeline_v2_json: (a: number, b: number, c: number) => [number, number];
2864
2995
  readonly enumerate_library_2way: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
@@ -2888,6 +3019,7 @@ export interface InitOutput {
2888
3019
  readonly get_bond_length_json: (a: number, b: number, c: number, d: number) => number;
2889
3020
  readonly get_descriptors_json: (a: number) => [number, number];
2890
3021
  readonly get_dihedral_json: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
3022
+ readonly get_rdkit_descriptors_json: (a: number) => [number, number];
2891
3023
  readonly getaway_descriptors_json: (a: number) => [number, number];
2892
3024
  readonly hdf_json: (a: number, b: number, c: number, d: bigint) => [number, number];
2893
3025
  readonly identify_functional_groups: (a: number) => [number, number];
@@ -2936,6 +3068,7 @@ export interface InitOutput {
2936
3068
  readonly mol_from_cdxml: (a: number, b: number) => [number, number, number];
2937
3069
  readonly mol_from_cjson: (a: number, b: number) => [number, number, number];
2938
3070
  readonly mol_from_cml: (a: number, b: number) => [number, number, number];
3071
+ readonly mol_from_cml_strict: (a: number, b: number) => [number, number, number];
2939
3072
  readonly mol_from_cube: (a: number, b: number) => [number, number, number];
2940
3073
  readonly mol_from_extxyz: (a: number, b: number) => [number, number, number];
2941
3074
  readonly mol_from_mmcif: (a: number, b: number) => [number, number, number];
@@ -3018,6 +3151,7 @@ export interface InitOutput {
3018
3151
  readonly molhandle_pains_passes: (a: number) => number;
3019
3152
  readonly molhandle_pka_acid_value: (a: number) => number;
3020
3153
  readonly molhandle_pka_base_value: (a: number) => number;
3154
+ readonly molhandle_potential_stereocenter_indices: (a: number) => [number, number];
3021
3155
  readonly molhandle_qed: (a: number) => number;
3022
3156
  readonly molhandle_randic_index: (a: number) => number;
3023
3157
  readonly molhandle_reos_passes: (a: number) => number;
@@ -3069,9 +3203,18 @@ export interface InitOutput {
3069
3203
  readonly rdkit_ecfp_config_chiral_bitvec: (a: number, b: number, c: number) => [number, number, number, number];
3070
3204
  readonly rdkit_ecfp_config_chiral_detail_json: (a: number, b: number, c: number) => [number, number, number, number];
3071
3205
  readonly rdkit_ecfp_config_detail_json: (a: number, b: number, c: number) => [number, number, number, number];
3206
+ readonly rdkit_nearest_neighbors_json: (a: number, b: number, c: number, d: number, e: number) => [number, number];
3072
3207
  readonly rdkit_path_bitvec: (a: number) => [number, number];
3073
3208
  readonly rdkit_rdk_bitvec: (a: number) => [number, number];
3074
3209
  readonly rdkit_torsion_bitvec: (a: number) => [number, number];
3210
+ readonly rdkitsearchindex_is_empty: (a: number) => number;
3211
+ readonly rdkitsearchindex_len: (a: number) => number;
3212
+ readonly rdkitsearchindex_new: (a: number, b: number) => [number, number, number];
3213
+ readonly rdkitsearchindex_search_json: (a: number, b: number, c: number, d: number) => [number, number];
3214
+ readonly rdkitsearchindex_search_json_precise: (a: number, b: number, c: number, d: number) => [number, number];
3215
+ readonly rdkitsearchindex_search_json_threshold_precise: (a: number, b: number, c: number, d: number, e: number) => [number, number];
3216
+ readonly reaction_document_json_v1: (a: number, b: number) => [number, number, number, number];
3217
+ readonly reaction_document_to_rxn_v1: (a: number, b: number) => [number, number, number, number];
3075
3218
  readonly reaction_smarts_match: (a: number, b: number, c: number, d: number) => [number, number, number];
3076
3219
  readonly remove_hydrogens: (a: number) => number;
3077
3220
  readonly retro_disconnect_json: (a: number, b: number, c: number, d: number) => [number, number, number, number];
@@ -3129,6 +3272,7 @@ export interface InitOutput {
3129
3272
  readonly to_xyz: (a: number) => [number, number];
3130
3273
  readonly topo_path_bitvec: (a: number) => [number, number];
3131
3274
  readonly torsion_bitvec: (a: number) => [number, number];
3275
+ readonly v3000_sgroups_json: (a: number, b: number) => [number, number, number, number];
3132
3276
  readonly validate_nmr_spectrum_json: (a: number, b: number) => [number, number];
3133
3277
  readonly virtual_screen_ecfp4_json: (a: number, b: number, c: number, d: number, e: number) => [number, number];
3134
3278
  readonly whim_descriptors_json: (a: number) => [number, number];
package/chematic_wasm.js CHANGED
@@ -961,6 +961,16 @@ export class MolHandle {
961
961
  const ret = wasm.molhandle_pka_base_value(this.__wbg_ptr);
962
962
  return ret;
963
963
  }
964
+ /**
965
+ * Atom indices of potential tetrahedral stereocenters.
966
+ * @returns {Uint32Array}
967
+ */
968
+ potential_stereocenter_indices() {
969
+ const ret = wasm.molhandle_potential_stereocenter_indices(this.__wbg_ptr);
970
+ var v1 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
971
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
972
+ return v1;
973
+ }
964
974
  /**
965
975
  * Quantitative Estimate of Drug-likeness (QED); range [0, 1].
966
976
  * @returns {number}
@@ -1079,6 +1089,124 @@ export class MolHandle {
1079
1089
  }
1080
1090
  if (Symbol.dispose) MolHandle.prototype[Symbol.dispose] = MolHandle.prototype.free;
1081
1091
 
1092
+ /**
1093
+ * Reusable prepared index for the RDKit-compatible Morgan profile.
1094
+ *
1095
+ * Build one index per input chunk (the WASM batch limit is 1,024 molecules),
1096
+ * then call [`RdkitSearchIndex::search_json`] for multiple queries without
1097
+ * reparsing or refingerprinting the database.
1098
+ */
1099
+ export class RdkitSearchIndex {
1100
+ __destroy_into_raw() {
1101
+ const ptr = this.__wbg_ptr;
1102
+ this.__wbg_ptr = 0;
1103
+ RdkitSearchIndexFinalization.unregister(this);
1104
+ return ptr;
1105
+ }
1106
+ free() {
1107
+ const ptr = this.__destroy_into_raw();
1108
+ wasm.__wbg_rdkitsearchindex_free(ptr, 0);
1109
+ }
1110
+ /**
1111
+ * Whether the prepared index contains no molecules.
1112
+ * @returns {boolean}
1113
+ */
1114
+ is_empty() {
1115
+ const ret = wasm.rdkitsearchindex_is_empty(this.__wbg_ptr);
1116
+ return ret !== 0;
1117
+ }
1118
+ /**
1119
+ * Number of molecules in this chunk.
1120
+ * @returns {number}
1121
+ */
1122
+ len() {
1123
+ const ret = wasm.rdkitsearchindex_len(this.__wbg_ptr);
1124
+ return ret >>> 0;
1125
+ }
1126
+ /**
1127
+ * Build an index from a JSON array of SMILES strings.
1128
+ * @param {string} db_smiles_json
1129
+ */
1130
+ constructor(db_smiles_json) {
1131
+ const ptr0 = passStringToWasm0(db_smiles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1132
+ const len0 = WASM_VECTOR_LEN;
1133
+ const ret = wasm.rdkitsearchindex_new(ptr0, len0);
1134
+ if (ret[2]) {
1135
+ throw takeFromExternrefTable0(ret[1]);
1136
+ }
1137
+ this.__wbg_ptr = ret[0];
1138
+ RdkitSearchIndexFinalization.register(this, this.__wbg_ptr, this);
1139
+ return this;
1140
+ }
1141
+ /**
1142
+ * Search the prepared index with a query SMILES.
1143
+ * @param {string} query_smiles
1144
+ * @param {number} k
1145
+ * @returns {string}
1146
+ */
1147
+ search_json(query_smiles, k) {
1148
+ let deferred2_0;
1149
+ let deferred2_1;
1150
+ try {
1151
+ const ptr0 = passStringToWasm0(query_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1152
+ const len0 = WASM_VECTOR_LEN;
1153
+ const ret = wasm.rdkitsearchindex_search_json(this.__wbg_ptr, ptr0, len0, k);
1154
+ deferred2_0 = ret[0];
1155
+ deferred2_1 = ret[1];
1156
+ return getStringFromWasm0(ret[0], ret[1]);
1157
+ } finally {
1158
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1159
+ }
1160
+ }
1161
+ /**
1162
+ * Search without the historical six-decimal JSON score truncation.
1163
+ *
1164
+ * This opt-in endpoint is for exact parity measurements. Callers that
1165
+ * need the stable historical wire format should continue using
1166
+ * RdkitSearchIndex::search_json.
1167
+ * @param {string} query_smiles
1168
+ * @param {number} k
1169
+ * @returns {string}
1170
+ */
1171
+ search_json_precise(query_smiles, k) {
1172
+ let deferred2_0;
1173
+ let deferred2_1;
1174
+ try {
1175
+ const ptr0 = passStringToWasm0(query_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1176
+ const len0 = WASM_VECTOR_LEN;
1177
+ const ret = wasm.rdkitsearchindex_search_json_precise(this.__wbg_ptr, ptr0, len0, k);
1178
+ deferred2_0 = ret[0];
1179
+ deferred2_1 = ret[1];
1180
+ return getStringFromWasm0(ret[0], ret[1]);
1181
+ } finally {
1182
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1183
+ }
1184
+ }
1185
+ /**
1186
+ * Search with an inclusive Tanimoto threshold and precise JSON scores.
1187
+ * A threshold of `0.0` includes zero-score candidates.
1188
+ * @param {string} query_smiles
1189
+ * @param {number} threshold
1190
+ * @param {number} k
1191
+ * @returns {string}
1192
+ */
1193
+ search_json_threshold_precise(query_smiles, threshold, k) {
1194
+ let deferred2_0;
1195
+ let deferred2_1;
1196
+ try {
1197
+ const ptr0 = passStringToWasm0(query_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1198
+ const len0 = WASM_VECTOR_LEN;
1199
+ const ret = wasm.rdkitsearchindex_search_json_threshold_precise(this.__wbg_ptr, ptr0, len0, threshold, k);
1200
+ deferred2_0 = ret[0];
1201
+ deferred2_1 = ret[1];
1202
+ return getStringFromWasm0(ret[0], ret[1]);
1203
+ } finally {
1204
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1205
+ }
1206
+ }
1207
+ }
1208
+ if (Symbol.dispose) RdkitSearchIndex.prototype[Symbol.dispose] = RdkitSearchIndex.prototype.free;
1209
+
1082
1210
  /**
1083
1211
  * Return a copy of the molecule with all implicit hydrogens converted to explicit H atoms.
1084
1212
  * @param {MolHandle} mol
@@ -1401,6 +1529,32 @@ export function canonicalize_smiles_batch_json(smiles_batch, delimiter) {
1401
1529
  }
1402
1530
  }
1403
1531
 
1532
+ /**
1533
+ * Validate a versioned CDXML JSON envelope and serialize its exact source.
1534
+ * @param {string} document_json
1535
+ * @returns {string}
1536
+ */
1537
+ export function cdxml_document_from_json_v1(document_json) {
1538
+ let deferred3_0;
1539
+ let deferred3_1;
1540
+ try {
1541
+ const ptr0 = passStringToWasm0(document_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1542
+ const len0 = WASM_VECTOR_LEN;
1543
+ const ret = wasm.cdxml_document_from_json_v1(ptr0, len0);
1544
+ var ptr2 = ret[0];
1545
+ var len2 = ret[1];
1546
+ if (ret[3]) {
1547
+ ptr2 = 0; len2 = 0;
1548
+ throw takeFromExternrefTable0(ret[2]);
1549
+ }
1550
+ deferred3_0 = ptr2;
1551
+ deferred3_1 = len2;
1552
+ return getStringFromWasm0(ptr2, len2);
1553
+ } finally {
1554
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1555
+ }
1556
+ }
1557
+
1404
1558
  /**
1405
1559
  * Parse a CDXML document while preserving page and presentation objects.
1406
1560
  * The returned JSON contains an opaque `raw_xml` for each object so unknown
@@ -1429,6 +1583,64 @@ export function cdxml_document_json(cdxml) {
1429
1583
  }
1430
1584
  }
1431
1585
 
1586
+ /**
1587
+ * Return a loss-preserving, versioned JSON envelope for a CDXML document.
1588
+ *
1589
+ * `source` is retained for exact re-serialization; `document` is the stable
1590
+ * structural summary used by editors. Unknown objects remain in the summary
1591
+ * and are listed under `document.diagnostics`.
1592
+ * @param {string} cdxml
1593
+ * @returns {string}
1594
+ */
1595
+ export function cdxml_document_json_v1(cdxml) {
1596
+ let deferred3_0;
1597
+ let deferred3_1;
1598
+ try {
1599
+ const ptr0 = passStringToWasm0(cdxml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1600
+ const len0 = WASM_VECTOR_LEN;
1601
+ const ret = wasm.cdxml_document_json_v1(ptr0, len0);
1602
+ var ptr2 = ret[0];
1603
+ var len2 = ret[1];
1604
+ if (ret[3]) {
1605
+ ptr2 = 0; len2 = 0;
1606
+ throw takeFromExternrefTable0(ret[2]);
1607
+ }
1608
+ deferred3_0 = ptr2;
1609
+ deferred3_1 = len2;
1610
+ return getStringFromWasm0(ptr2, len2);
1611
+ } finally {
1612
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1613
+ }
1614
+ }
1615
+
1616
+ /**
1617
+ * Project a CDXML document to its first molecular fragment only when no
1618
+ * presentation data would be lost. Unknown/presentation objects are reported
1619
+ * as an explicit lossy conversion instead of being silently dropped.
1620
+ * @param {string} cdxml
1621
+ * @returns {string}
1622
+ */
1623
+ export function cdxml_document_projection_json_v1(cdxml) {
1624
+ let deferred3_0;
1625
+ let deferred3_1;
1626
+ try {
1627
+ const ptr0 = passStringToWasm0(cdxml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1628
+ const len0 = WASM_VECTOR_LEN;
1629
+ const ret = wasm.cdxml_document_projection_json_v1(ptr0, len0);
1630
+ var ptr2 = ret[0];
1631
+ var len2 = ret[1];
1632
+ if (ret[3]) {
1633
+ ptr2 = 0; len2 = 0;
1634
+ throw takeFromExternrefTable0(ret[2]);
1635
+ }
1636
+ deferred3_0 = ptr2;
1637
+ deferred3_1 = len2;
1638
+ return getStringFromWasm0(ptr2, len2);
1639
+ } finally {
1640
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
1641
+ }
1642
+ }
1643
+
1432
1644
  /**
1433
1645
  * Parse all molecular fragments from a CDXML string.
1434
1646
  *
@@ -2131,6 +2343,66 @@ export function edit_cdxml_document_json(cdxml, edit_json) {
2131
2343
  }
2132
2344
  }
2133
2345
 
2346
+ /**
2347
+ * Apply a bounded CDXML edit to a versioned JSON envelope and return the
2348
+ * updated envelope. The source is reparsed after editing, so paths and
2349
+ * diagnostics cannot drift from the returned document summary.
2350
+ * @param {string} document_json
2351
+ * @param {string} edit_json
2352
+ * @returns {string}
2353
+ */
2354
+ export function edit_cdxml_document_json_v1(document_json, edit_json) {
2355
+ let deferred4_0;
2356
+ let deferred4_1;
2357
+ try {
2358
+ const ptr0 = passStringToWasm0(document_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2359
+ const len0 = WASM_VECTOR_LEN;
2360
+ const ptr1 = passStringToWasm0(edit_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2361
+ const len1 = WASM_VECTOR_LEN;
2362
+ const ret = wasm.edit_cdxml_document_json_v1(ptr0, len0, ptr1, len1);
2363
+ var ptr3 = ret[0];
2364
+ var len3 = ret[1];
2365
+ if (ret[3]) {
2366
+ ptr3 = 0; len3 = 0;
2367
+ throw takeFromExternrefTable0(ret[2]);
2368
+ }
2369
+ deferred4_0 = ptr3;
2370
+ deferred4_1 = len3;
2371
+ return getStringFromWasm0(ptr3, len3);
2372
+ } finally {
2373
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2374
+ }
2375
+ }
2376
+
2377
+ /**
2378
+ * Apply a bounded, stable-ID reaction-document edit and return canonical JSON.
2379
+ * @param {string} document_json
2380
+ * @param {string} edit_json
2381
+ * @returns {string}
2382
+ */
2383
+ export function edit_reaction_document_json_v1(document_json, edit_json) {
2384
+ let deferred4_0;
2385
+ let deferred4_1;
2386
+ try {
2387
+ const ptr0 = passStringToWasm0(document_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2388
+ const len0 = WASM_VECTOR_LEN;
2389
+ const ptr1 = passStringToWasm0(edit_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2390
+ const len1 = WASM_VECTOR_LEN;
2391
+ const ret = wasm.edit_reaction_document_json_v1(ptr0, len0, ptr1, len1);
2392
+ var ptr3 = ret[0];
2393
+ var len3 = ret[1];
2394
+ if (ret[3]) {
2395
+ ptr3 = 0; len3 = 0;
2396
+ throw takeFromExternrefTable0(ret[2]);
2397
+ }
2398
+ deferred4_0 = ptr3;
2399
+ deferred4_1 = len3;
2400
+ return getStringFromWasm0(ptr3, len3);
2401
+ } finally {
2402
+ wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
2403
+ }
2404
+ }
2405
+
2134
2406
  /**
2135
2407
  * Run `embed_ensemble_v2` on `mol`'s own atom order (never canonicalizes/
2136
2408
  * reparses, same convention as `embed_pipeline_v2_json`). See the module doc
@@ -2854,6 +3126,31 @@ export function get_dihedral_json(smiles, a, b, c, d) {
2854
3126
  return ret;
2855
3127
  }
2856
3128
 
3129
+ /**
3130
+ * RDKit-compatibility descriptor profile as JSON.
3131
+ *
3132
+ * This is deliberately separate from [`get_descriptors_json`]: the latter is
3133
+ * the historical native profile, while this profile uses the opt-in RDKit
3134
+ * molecular-weight, HBA, and aromatic-ring implementations. Keeping the
3135
+ * boundary explicit prevents a compatibility correction from silently
3136
+ * changing the browser's native descriptor contract.
3137
+ * @param {MolHandle} mol
3138
+ * @returns {string}
3139
+ */
3140
+ export function get_rdkit_descriptors_json(mol) {
3141
+ let deferred1_0;
3142
+ let deferred1_1;
3143
+ try {
3144
+ _assertClass(mol, MolHandle);
3145
+ const ret = wasm.get_rdkit_descriptors_json(mol.__wbg_ptr);
3146
+ deferred1_0 = ret[0];
3147
+ deferred1_1 = ret[1];
3148
+ return getStringFromWasm0(ret[0], ret[1]);
3149
+ } finally {
3150
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
3151
+ }
3152
+ }
3153
+
2857
3154
  /**
2858
3155
  * Compute GETAWAY descriptors (GEometry, Topology and Atom-Weights AssemblY) from 3D coords.
2859
3156
  *
@@ -3580,7 +3877,7 @@ export function minimize_mmff94_lbfgs_json(mol, max_iter) {
3580
3877
  * `coords_json` — JSON array of `[x,y,z]` arrays (Å), one per atom.
3581
3878
  * `max_iter` — maximum iterations (0 = default 500).
3582
3879
  *
3583
- * Returns JSON: `{"coords":[[x,y,z],...], "energy":float, "iterations":int, "converged":bool, "sound":bool, "worst_bond_length":float}`
3880
+ * Returns JSON: `{"coords":[[x,y,z],...], "energy":float, "iterations":int, "converged":bool, "sound":bool, "worst_bond_length":float, "rejected_unsound_step":bool}`
3584
3881
  * or `{"error":"<msg>"}` on failure. `sound` is all-finite coordinates and
3585
3882
  * no bond stretched past a sane covalent-bond length — independent of
3586
3883
  * `converged`, since steepest descent often reports `converged:false` on
@@ -4006,6 +4303,24 @@ export function mol_from_cml(cml) {
4006
4303
  return MolHandle.__wrap(ret[0]);
4007
4304
  }
4008
4305
 
4306
+ /**
4307
+ * Parse a structurally valid, non-empty CML string into a `MolHandle`.
4308
+ *
4309
+ * This opt-in strict boundary rejects missing/empty molecules and malformed
4310
+ * XML while `mol_from_cml` retains its historical lenient behavior.
4311
+ * @param {string} cml
4312
+ * @returns {MolHandle}
4313
+ */
4314
+ export function mol_from_cml_strict(cml) {
4315
+ const ptr0 = passStringToWasm0(cml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
4316
+ const len0 = WASM_VECTOR_LEN;
4317
+ const ret = wasm.mol_from_cml_strict(ptr0, len0);
4318
+ if (ret[2]) {
4319
+ throw takeFromExternrefTable0(ret[1]);
4320
+ }
4321
+ return MolHandle.__wrap(ret[0]);
4322
+ }
4323
+
4009
4324
  /**
4010
4325
  * Parse a Gaussian Cube file and return a `MolHandle` (topology only --
4011
4326
  * element list, no bonds; Cube carries no bond table). Use
@@ -5432,6 +5747,36 @@ export function rdkit_ecfp_config_detail_json(mol, radius, nbits) {
5432
5747
  }
5433
5748
  }
5434
5749
 
5750
+ /**
5751
+ * Find the k nearest neighbours using the RDKit-compatible Morgan/ECFP4
5752
+ * profile. This is intentionally separate from [`nearest_neighbors_json`],
5753
+ * whose historical contract uses chematic's native ECFP4 profile.
5754
+ *
5755
+ * Returns JSON with the original database indices and six-decimal Tanimoto
5756
+ * scores. Any RDKit-profile preprocessing failure is returned as an error;
5757
+ * this API never falls back to the native profile.
5758
+ * @param {string} query_smiles
5759
+ * @param {string} db_smiles_json
5760
+ * @param {number} k
5761
+ * @returns {string}
5762
+ */
5763
+ export function rdkit_nearest_neighbors_json(query_smiles, db_smiles_json, k) {
5764
+ let deferred3_0;
5765
+ let deferred3_1;
5766
+ try {
5767
+ const ptr0 = passStringToWasm0(query_smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5768
+ const len0 = WASM_VECTOR_LEN;
5769
+ const ptr1 = passStringToWasm0(db_smiles_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5770
+ const len1 = WASM_VECTOR_LEN;
5771
+ const ret = wasm.rdkit_nearest_neighbors_json(ptr0, len0, ptr1, len1, k);
5772
+ deferred3_0 = ret[0];
5773
+ deferred3_1 = ret[1];
5774
+ return getStringFromWasm0(ret[0], ret[1]);
5775
+ } finally {
5776
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
5777
+ }
5778
+ }
5779
+
5435
5780
  /**
5436
5781
  * Compute the RDKit-compatible Daylight-like path fingerprint as a bit-packed
5437
5782
  * byte vector (256 bytes = 2048 bits). This is the WASM counterpart of the
@@ -5478,6 +5823,63 @@ export function rdkit_torsion_bitvec(mol) {
5478
5823
  return v1;
5479
5824
  }
5480
5825
 
5826
+ /**
5827
+ * Validate and deterministically serialize a rich reaction document JSON.
5828
+ *
5829
+ * This is the versioned JSON boundary for WASM consumers. It preserves IDs,
5830
+ * metadata, and provenance, and rejects malformed documents before returning
5831
+ * JSON. Use [`edit_reaction_document_json_v1`] for bounded ID-addressed edits.
5832
+ * @param {string} document_json
5833
+ * @returns {string}
5834
+ */
5835
+ export function reaction_document_json_v1(document_json) {
5836
+ let deferred3_0;
5837
+ let deferred3_1;
5838
+ try {
5839
+ const ptr0 = passStringToWasm0(document_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5840
+ const len0 = WASM_VECTOR_LEN;
5841
+ const ret = wasm.reaction_document_json_v1(ptr0, len0);
5842
+ var ptr2 = ret[0];
5843
+ var len2 = ret[1];
5844
+ if (ret[3]) {
5845
+ ptr2 = 0; len2 = 0;
5846
+ throw takeFromExternrefTable0(ret[2]);
5847
+ }
5848
+ deferred3_0 = ptr2;
5849
+ deferred3_1 = len2;
5850
+ return getStringFromWasm0(ptr2, len2);
5851
+ } finally {
5852
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
5853
+ }
5854
+ }
5855
+
5856
+ /**
5857
+ * Convert a rich reaction document to legacy RXN V2000 with structured loss
5858
+ * reporting. A lossy projection is never returned as if it were complete.
5859
+ * @param {string} document_json
5860
+ * @returns {string}
5861
+ */
5862
+ export function reaction_document_to_rxn_v1(document_json) {
5863
+ let deferred3_0;
5864
+ let deferred3_1;
5865
+ try {
5866
+ const ptr0 = passStringToWasm0(document_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
5867
+ const len0 = WASM_VECTOR_LEN;
5868
+ const ret = wasm.reaction_document_to_rxn_v1(ptr0, len0);
5869
+ var ptr2 = ret[0];
5870
+ var len2 = ret[1];
5871
+ if (ret[3]) {
5872
+ ptr2 = 0; len2 = 0;
5873
+ throw takeFromExternrefTable0(ret[2]);
5874
+ }
5875
+ deferred3_0 = ptr2;
5876
+ deferred3_1 = len2;
5877
+ return getStringFromWasm0(ptr2, len2);
5878
+ } finally {
5879
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
5880
+ }
5881
+ }
5882
+
5481
5883
  /**
5482
5884
  * Check whether a reaction SMILES matches a reaction SMARTS query.
5483
5885
  *
@@ -5636,13 +6038,13 @@ export function ring_families_json(mol) {
5636
6038
  }
5637
6039
 
5638
6040
  /**
5639
- * Parse and serialize a V3000 block while preserving opaque V3000 metadata.
6041
+ * Parse and serialize a V3000 block while preserving V3000 metadata.
5640
6042
  *
5641
6043
  * Unlike the topology-only [`mol_from_v3000_block`] + [`to_mol_v3000_block`]
5642
6044
  * pair, this explicit round-trip API retains `SGROUP` logical lines and
5643
- * `COLLECTION` stereo groups. SGROUP semantics remain opaque until the core
5644
- * molecule model grows a typed representation; the API therefore preserves
5645
- * bytes at the logical-line level without claiming polymer/query semantics.
6045
+ * `COLLECTION` stereo groups. SGROUP polymer/query expansion is still out of
6046
+ * scope, but the typed syntax view is available through
6047
+ * [`v3000_sgroups_json`].
5646
6048
  * @param {string} block
5647
6049
  * @returns {string}
5648
6050
  */
@@ -6919,6 +7321,31 @@ export function torsion_bitvec(mol) {
6919
7321
  return v1;
6920
7322
  }
6921
7323
 
7324
+ /**
7325
+ * @param {string} block
7326
+ * @returns {string}
7327
+ */
7328
+ export function v3000_sgroups_json(block) {
7329
+ let deferred3_0;
7330
+ let deferred3_1;
7331
+ try {
7332
+ const ptr0 = passStringToWasm0(block, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
7333
+ const len0 = WASM_VECTOR_LEN;
7334
+ const ret = wasm.v3000_sgroups_json(ptr0, len0);
7335
+ var ptr2 = ret[0];
7336
+ var len2 = ret[1];
7337
+ if (ret[3]) {
7338
+ ptr2 = 0; len2 = 0;
7339
+ throw takeFromExternrefTable0(ret[2]);
7340
+ }
7341
+ deferred3_0 = ptr2;
7342
+ deferred3_1 = len2;
7343
+ return getStringFromWasm0(ptr2, len2);
7344
+ } finally {
7345
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
7346
+ }
7347
+ }
7348
+
6922
7349
  /**
6923
7350
  * Validate a vendor-neutral NMR spectrum JSON document without parsing a
6924
7351
  * vendor-specific raw file or predicting peaks.
@@ -7463,6 +7890,9 @@ const MhfpLshHandleFinalization = (typeof FinalizationRegistry === 'undefined')
7463
7890
  const MolHandleFinalization = (typeof FinalizationRegistry === 'undefined')
7464
7891
  ? { register: () => {}, unregister: () => {} }
7465
7892
  : new FinalizationRegistry(ptr => wasm.__wbg_molhandle_free(ptr, 1));
7893
+ const RdkitSearchIndexFinalization = (typeof FinalizationRegistry === 'undefined')
7894
+ ? { register: () => {}, unregister: () => {} }
7895
+ : new FinalizationRegistry(ptr => wasm.__wbg_rdkitsearchindex_free(ptr, 1));
7466
7896
 
7467
7897
  function addToExternrefTable0(obj) {
7468
7898
  const idx = wasm.__externref_table_alloc();
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "Kentaro Tanabe (kent-tokyo) <kent-tokyo@users.noreply.github.com>"
6
6
  ],
7
7
  "description": "WebAssembly bindings for chematic — use chematic from JavaScript/TypeScript",
8
- "version": "1.0.12",
8
+ "version": "1.0.14",
9
9
  "license": "MIT OR Apache-2.0",
10
10
  "repository": {
11
11
  "type": "git",