@jarenjs/app 0.86.0 → 0.89.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.
@@ -19,19 +19,7 @@ export declare function createSearchResource(definition: import('@jarenjs/core/s
19
19
  generation: number;
20
20
  sourceRevision: string;
21
21
  requestId: string;
22
- }, signal?: AbortSignal): Promise<{
23
- generation: number;
24
- sourceRevision: string;
25
- requestId: string;
26
- state: any;
27
- reason: any;
28
- } | {
29
- generation: number;
30
- sourceRevision: string;
31
- requestId: string;
32
- state: string;
33
- documents: number;
34
- }>;
22
+ }, signal?: AbortSignal): Promise<any>;
35
23
  /** @param {string} text @param {any} [options] */
36
24
  search(text: string, options?: any): {
37
25
  state: any;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jarenjs/app",
3
3
  "private": false,
4
- "version": "0.86.0",
4
+ "version": "0.89.0",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "types": "./dist/types/index.d.ts",
@@ -58,8 +58,8 @@
58
58
  "prepack": "npm run build:types"
59
59
  },
60
60
  "dependencies": {
61
- "@jarenjs/core": "^0.86.0",
62
- "@jarenjs/json": "^0.86.0",
63
- "@jarenjs/view": "^0.86.0"
61
+ "@jarenjs/core": "^0.89.0",
62
+ "@jarenjs/json": "^0.89.0",
63
+ "@jarenjs/view": "^0.89.0"
64
64
  }
65
65
  }
package/src/collection.js CHANGED
@@ -159,7 +159,7 @@ export function createCollectionCoordinator(provider, options = {}) {
159
159
  inRange ||= range.open || endpoint;
160
160
  if (endpoint) { range.found++; range.open = !range.open; if (range.fromKey === range.toKey) { range.open = false; range.found++; } }
161
161
  }
162
- const selected = !selection || (selection.mode === 'all' && !excluded.has(key)) || wanted.has(key) || inRange;
162
+ const selected = !selection || wanted.has(key) || ((selection.mode === 'all' || inRange) && !excluded.has(key));
163
163
  wanted.delete(key); read++;
164
164
  if (selected) { output.push(page.rows[i]); written++; }
165
165
  }
package/src/search.js CHANGED
@@ -81,8 +81,13 @@ export function createSearchResource(definition, options) {
81
81
  }
82
82
  catch (error) { return refuse('error', disposed ? 'disposed' : controller.signal.aborted ? 'cancelled' : String(error?.message ?? error)); }
83
83
  };
84
- const promise = run().finally(() => { pending.delete(controller); signal?.removeEventListener('abort', abort); });
85
- pending.set(controller, promise); return promise;
84
+ // Worker construction and progress callbacks may synchronously reenter
85
+ // build(); reserve the credit before invoking either capability.
86
+ const deferred = Promise.withResolvers();
87
+ const promise = deferred.promise.finally(() => { pending.delete(controller); signal?.removeEventListener('abort', abort); });
88
+ pending.set(controller, promise);
89
+ deferred.resolve(run());
90
+ return promise;
86
91
  },
87
92
  /** @param {string} text @param {any} [options] */
88
93
  search(text, options) { return index.search(text, options); },