@nuschtos/fixx 0.0.6 → 0.0.8

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
@@ -1,12 +1,20 @@
1
1
  # ixx
2
2
 
3
+ ixx is the search engine and index creation tool used by [NüschtOS Search](https://github.com/NuschtOS/search).
4
+
3
5
  ## Building fixx
4
6
 
5
7
  ```
6
8
  wasm-pack build --release fixx --target web
7
9
  ```
8
10
 
9
- The result will be in fixx/pkg
11
+ The result will be in `fixx/pkg`.
12
+
13
+ ## Contact
14
+
15
+ For bugs and issues please open an issue in this repository.
16
+
17
+ If you want to chat about things or have ideas, feel free to join the [Matrix Chat](https://matrix.to/#/#nuschtos:c3d2.de).
10
18
 
11
19
  ## License
12
20
 
package/fixx.d.ts CHANGED
@@ -1,47 +1,19 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export class Index {
4
+ private constructor();
4
5
  free(): void;
5
- /**
6
- * @param {Uint8Array} buf
7
- * @returns {Index}
8
- */
9
6
  static read(buf: Uint8Array): Index;
10
- /**
11
- * @returns {number}
12
- */
13
7
  chunk_size(): number;
14
- /**
15
- * @returns {(string)[]}
16
- */
17
- scopes(): (string)[];
18
- /**
19
- * @param {number | undefined} scope_id
20
- * @param {string} query
21
- * @param {number} max_results
22
- * @returns {(SearchedOption)[]}
23
- */
24
- search(scope_id: number | undefined, query: string, max_results: number): (SearchedOption)[];
25
- /**
26
- * @param {number} scope_id
27
- * @param {string} name
28
- * @returns {number | undefined}
29
- */
8
+ scopes(): string[];
9
+ search(scope_id: number | null | undefined, query: string, max_results: number): SearchedOption[];
30
10
  get_idx_by_name(scope_id: number, name: string): number | undefined;
31
11
  }
32
12
  export class SearchedOption {
13
+ private constructor();
33
14
  free(): void;
34
- /**
35
- * @returns {number}
36
- */
37
15
  idx(): number;
38
- /**
39
- * @returns {number}
40
- */
41
16
  scope_id(): number;
42
- /**
43
- * @returns {string}
44
- */
45
17
  name(): string;
46
18
  }
47
19
 
package/fixx.js CHANGED
@@ -1,5 +1,20 @@
1
1
  let wasm;
2
2
 
3
+ const heap = new Array(128).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ let heap_next = heap.length;
8
+
9
+ function addHeapObject(obj) {
10
+ if (heap_next === heap.length) heap.push(heap.length + 1);
11
+ const idx = heap_next;
12
+ heap_next = heap[idx];
13
+
14
+ heap[idx] = obj;
15
+ return idx;
16
+ }
17
+
3
18
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
19
 
5
20
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -18,21 +33,6 @@ function getStringFromWasm0(ptr, len) {
18
33
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
19
34
  }
20
35
 
21
- const heap = new Array(128).fill(undefined);
22
-
23
- heap.push(undefined, null, true, false);
24
-
25
- let heap_next = heap.length;
26
-
27
- function addHeapObject(obj) {
28
- if (heap_next === heap.length) heap.push(heap.length + 1);
29
- const idx = heap_next;
30
- heap_next = heap[idx];
31
-
32
- heap[idx] = obj;
33
- return idx;
34
- }
35
-
36
36
  let WASM_VECTOR_LEN = 0;
37
37
 
38
38
  function passArray8ToWasm0(arg, malloc) {
@@ -187,7 +187,7 @@ export class Index {
187
187
  return ret >>> 0;
188
188
  }
189
189
  /**
190
- * @returns {(string)[]}
190
+ * @returns {string[]}
191
191
  */
192
192
  scopes() {
193
193
  try {
@@ -208,10 +208,10 @@ export class Index {
208
208
  }
209
209
  }
210
210
  /**
211
- * @param {number | undefined} scope_id
211
+ * @param {number | null | undefined} scope_id
212
212
  * @param {string} query
213
213
  * @param {number} max_results
214
- * @returns {(SearchedOption)[]}
214
+ * @returns {SearchedOption[]}
215
215
  */
216
216
  search(scope_id, query, max_results) {
217
217
  try {
@@ -244,14 +244,13 @@ export class Index {
244
244
  const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_2);
245
245
  const len0 = WASM_VECTOR_LEN;
246
246
  wasm.index_get_idx_by_name(retptr, this.__wbg_ptr, scope_id, ptr0, len0);
247
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
248
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
247
+ var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
249
248
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
250
249
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
251
250
  if (r3) {
252
251
  throw takeObject(r2);
253
252
  }
254
- return r0 === 0 ? undefined : r1 >>> 0;
253
+ return r0 === 0x100000001 ? undefined : r0;
255
254
  } finally {
256
255
  wasm.__wbindgen_add_to_stack_pointer(16);
257
256
  }
@@ -353,14 +352,14 @@ async function __wbg_load(module, imports) {
353
352
  function __wbg_get_imports() {
354
353
  const imports = {};
355
354
  imports.wbg = {};
356
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
357
- const ret = getStringFromWasm0(arg0, arg1);
358
- return addHeapObject(ret);
359
- };
360
355
  imports.wbg.__wbg_searchedoption_new = function(arg0) {
361
356
  const ret = SearchedOption.__wrap(arg0);
362
357
  return addHeapObject(ret);
363
358
  };
359
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
360
+ const ret = getStringFromWasm0(arg0, arg1);
361
+ return addHeapObject(ret);
362
+ };
364
363
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
365
364
  throw new Error(getStringFromWasm0(arg0, arg1));
366
365
  };
package/fixx_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuschtos/fixx",
3
3
  "type": "module",
4
- "version": "0.0.6",
4
+ "version": "0.0.8",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",