nazuchem 0.0.0-stage → 0.2.0
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/LICENSE-APACHE +202 -0
- package/LICENSE-MIT +21 -0
- package/NOTICE +58 -0
- package/README.md +104 -2
- package/THIRD-PARTY-NOTICES.txt +9584 -0
- package/dist/bundler/index.d.ts +109 -0
- package/dist/bundler/index.js +68 -0
- package/dist/bundler/nazuchem.js +8 -0
- package/dist/bundler/package.json +1 -0
- package/dist/nazuchem-ir-1.schema.json +494 -0
- package/dist/nazuchem_bg.js +256 -0
- package/dist/nazuchem_bg.wasm +0 -0
- package/dist/node/index.cjs +70 -0
- package/dist/node/index.d.cts +109 -0
- package/dist/node/nazuchem.js +263 -0
- package/dist/node/package.json +1 -0
- package/dist/web/index.cjs +926 -0
- package/dist/web/index.d.cts +119 -0
- package/dist/web/index.d.ts +119 -0
- package/dist/web/index.js +70 -0
- package/dist/web/nazuchem.js +358 -0
- package/dist/web/package.json +1 -0
- package/package.json +73 -4
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accept the same IR object or JSON string as the facade's JSON reader.
|
|
3
|
+
* @param {any} input
|
|
4
|
+
* @returns {any}
|
|
5
|
+
*/
|
|
6
|
+
function moleculeToName(input) {
|
|
7
|
+
const ret = wasm.moleculeToName(input);
|
|
8
|
+
if (ret[2]) {
|
|
9
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
10
|
+
}
|
|
11
|
+
return takeFromExternrefTable0(ret[0]);
|
|
12
|
+
}
|
|
13
|
+
exports.moleculeToName = moleculeToName;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Return a validated IR v1 plain object with the Rust JSON field names.
|
|
17
|
+
* @param {string} name
|
|
18
|
+
* @returns {any}
|
|
19
|
+
*/
|
|
20
|
+
function nameToMolecule(name) {
|
|
21
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
22
|
+
const len0 = WASM_VECTOR_LEN;
|
|
23
|
+
const ret = wasm.nameToMolecule(ptr0, len0);
|
|
24
|
+
if (ret[2]) {
|
|
25
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
26
|
+
}
|
|
27
|
+
return takeFromExternrefTable0(ret[0]);
|
|
28
|
+
}
|
|
29
|
+
exports.nameToMolecule = nameToMolecule;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Interpret a name using the facade's strict name-to-structure policy.
|
|
33
|
+
* @param {string} name
|
|
34
|
+
* @returns {string}
|
|
35
|
+
*/
|
|
36
|
+
function nameToSmiles(name) {
|
|
37
|
+
let deferred3_0;
|
|
38
|
+
let deferred3_1;
|
|
39
|
+
try {
|
|
40
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
41
|
+
const len0 = WASM_VECTOR_LEN;
|
|
42
|
+
const ret = wasm.nameToSmiles(ptr0, len0);
|
|
43
|
+
var ptr2 = ret[0];
|
|
44
|
+
var len2 = ret[1];
|
|
45
|
+
if (ret[3]) {
|
|
46
|
+
ptr2 = 0; len2 = 0;
|
|
47
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
48
|
+
}
|
|
49
|
+
deferred3_0 = ptr2;
|
|
50
|
+
deferred3_1 = len2;
|
|
51
|
+
return getStringFromWasm0(ptr2, len2);
|
|
52
|
+
} finally {
|
|
53
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.nameToSmiles = nameToSmiles;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Return the complete Rust Name, including nested preference assessment.
|
|
60
|
+
* @param {string} smiles
|
|
61
|
+
* @returns {any}
|
|
62
|
+
*/
|
|
63
|
+
function smilesToName(smiles) {
|
|
64
|
+
const ptr0 = passStringToWasm0(smiles, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
65
|
+
const len0 = WASM_VECTOR_LEN;
|
|
66
|
+
const ret = wasm.smilesToName(ptr0, len0);
|
|
67
|
+
if (ret[2]) {
|
|
68
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
69
|
+
}
|
|
70
|
+
return takeFromExternrefTable0(ret[0]);
|
|
71
|
+
}
|
|
72
|
+
exports.smilesToName = smilesToName;
|
|
73
|
+
function __wbg_get_imports() {
|
|
74
|
+
const import0 = {
|
|
75
|
+
__proto__: null,
|
|
76
|
+
__wbg___wbindgen_is_undefined_8c687d0b90d5b524: function(arg0) {
|
|
77
|
+
const ret = arg0 === undefined;
|
|
78
|
+
return ret;
|
|
79
|
+
},
|
|
80
|
+
__wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
|
|
81
|
+
const obj = arg1;
|
|
82
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
83
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
84
|
+
var len1 = WASM_VECTOR_LEN;
|
|
85
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
86
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
87
|
+
},
|
|
88
|
+
__wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
|
|
89
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
90
|
+
},
|
|
91
|
+
__wbg_new_a32a1ab6c6655abe: function(arg0, arg1) {
|
|
92
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
93
|
+
return ret;
|
|
94
|
+
},
|
|
95
|
+
__wbg_now_e7c6795a7f81e10f: function(arg0) {
|
|
96
|
+
const ret = arg0.now();
|
|
97
|
+
return ret;
|
|
98
|
+
},
|
|
99
|
+
__wbg_parse_6937a9050adfb0e1: function() { return handleError(function (arg0, arg1) {
|
|
100
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
101
|
+
return ret;
|
|
102
|
+
}, arguments); },
|
|
103
|
+
__wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
|
|
104
|
+
const ret = arg0.performance;
|
|
105
|
+
return ret;
|
|
106
|
+
},
|
|
107
|
+
__wbg_set_a377297433dfea63: function() { return handleError(function (arg0, arg1, arg2) {
|
|
108
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
109
|
+
return ret;
|
|
110
|
+
}, arguments); },
|
|
111
|
+
__wbg_set_name_6e2a5da46a9ae1e7: function(arg0, arg1, arg2) {
|
|
112
|
+
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
113
|
+
},
|
|
114
|
+
__wbg_static_accessor_GLOBAL_8eb4cd83130a11a0: function() {
|
|
115
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
116
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
117
|
+
},
|
|
118
|
+
__wbg_static_accessor_GLOBAL_THIS_1e7044f654e934db: function() {
|
|
119
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
120
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
121
|
+
},
|
|
122
|
+
__wbg_static_accessor_SELF_d8b50611246a6d92: function() {
|
|
123
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
124
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
125
|
+
},
|
|
126
|
+
__wbg_static_accessor_WINDOW_fd0bc376bf0f8b42: function() {
|
|
127
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
128
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
129
|
+
},
|
|
130
|
+
__wbg_stringify_54b3d9b61602aee6: function() { return handleError(function (arg0) {
|
|
131
|
+
const ret = JSON.stringify(arg0);
|
|
132
|
+
return ret;
|
|
133
|
+
}, arguments); },
|
|
134
|
+
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
135
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
136
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
137
|
+
return ret;
|
|
138
|
+
},
|
|
139
|
+
__wbindgen_init_externref_table: function() {
|
|
140
|
+
const table = wasm.__wbindgen_externrefs;
|
|
141
|
+
const offset = table.grow(4);
|
|
142
|
+
table.set(0, undefined);
|
|
143
|
+
table.set(offset + 0, undefined);
|
|
144
|
+
table.set(offset + 1, null);
|
|
145
|
+
table.set(offset + 2, true);
|
|
146
|
+
table.set(offset + 3, false);
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
return {
|
|
150
|
+
__proto__: null,
|
|
151
|
+
"./nazuchem_bg.js": import0,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function addToExternrefTable0(obj) {
|
|
156
|
+
const idx = wasm.__externref_table_alloc();
|
|
157
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
158
|
+
return idx;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
let cachedDataViewMemory0 = null;
|
|
162
|
+
function getDataViewMemory0() {
|
|
163
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
164
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
165
|
+
}
|
|
166
|
+
return cachedDataViewMemory0;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function getStringFromWasm0(ptr, len) {
|
|
170
|
+
return decodeText(ptr >>> 0, len);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
let cachedUint8ArrayMemory0 = null;
|
|
174
|
+
function getUint8ArrayMemory0() {
|
|
175
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
176
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
177
|
+
}
|
|
178
|
+
return cachedUint8ArrayMemory0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function handleError(f, args) {
|
|
182
|
+
try {
|
|
183
|
+
return f.apply(this, args);
|
|
184
|
+
} catch (e) {
|
|
185
|
+
const idx = addToExternrefTable0(e);
|
|
186
|
+
wasm.__wbindgen_exn_store(idx);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function isLikeNone(x) {
|
|
191
|
+
return x === undefined || x === null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
195
|
+
if (realloc === undefined) {
|
|
196
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
197
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
198
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
199
|
+
WASM_VECTOR_LEN = buf.length;
|
|
200
|
+
return ptr;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
let len = arg.length;
|
|
204
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
205
|
+
|
|
206
|
+
const mem = getUint8ArrayMemory0();
|
|
207
|
+
|
|
208
|
+
let offset = 0;
|
|
209
|
+
|
|
210
|
+
for (; offset < len; offset++) {
|
|
211
|
+
const code = arg.charCodeAt(offset);
|
|
212
|
+
if (code > 0x7F) break;
|
|
213
|
+
mem[ptr + offset] = code;
|
|
214
|
+
}
|
|
215
|
+
if (offset !== len) {
|
|
216
|
+
if (offset !== 0) {
|
|
217
|
+
arg = arg.slice(offset);
|
|
218
|
+
}
|
|
219
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
220
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
221
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
222
|
+
|
|
223
|
+
offset += ret.written;
|
|
224
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
WASM_VECTOR_LEN = offset;
|
|
228
|
+
return ptr;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function takeFromExternrefTable0(idx) {
|
|
232
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
233
|
+
wasm.__externref_table_dealloc(idx);
|
|
234
|
+
return value;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
238
|
+
cachedTextDecoder.decode();
|
|
239
|
+
function decodeText(ptr, len) {
|
|
240
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const cachedTextEncoder = new TextEncoder();
|
|
244
|
+
|
|
245
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
246
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
247
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
248
|
+
view.set(buf);
|
|
249
|
+
return {
|
|
250
|
+
read: arg.length,
|
|
251
|
+
written: buf.length
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
let WASM_VECTOR_LEN = 0;
|
|
257
|
+
|
|
258
|
+
const wasmPath = `${__dirname}/../nazuchem_bg.wasm`;
|
|
259
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
260
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
261
|
+
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
262
|
+
let wasm = wasmInstance.exports;
|
|
263
|
+
wasm.__wbindgen_start();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|