@arcote.tech/arc-adapter-db-sqlite-wasm 0.7.10 → 0.7.12
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/dist/index.js +36 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3207,7 +3207,11 @@ class ArcCommand extends ArcContextElement {
|
|
|
3207
3207
|
if (!adapters.commandWire) {
|
|
3208
3208
|
throw new Error(`Command "${this.data.name}" has no handler and no commandWire adapter available for remote execution`);
|
|
3209
3209
|
}
|
|
3210
|
-
|
|
3210
|
+
const wireAuth = adapters.scope ? {
|
|
3211
|
+
scope: adapters.scope.scopeName,
|
|
3212
|
+
token: adapters.scope.getToken()
|
|
3213
|
+
} : undefined;
|
|
3214
|
+
return await adapters.commandWire.executeCommand(this.data.name, params, wireAuth);
|
|
3211
3215
|
};
|
|
3212
3216
|
return Object.assign(executeFunc, { params: this.data.params });
|
|
3213
3217
|
}
|
|
@@ -4279,6 +4283,7 @@ class StreamingQueryCache {
|
|
|
4279
4283
|
views = [];
|
|
4280
4284
|
activeStreams = new Map;
|
|
4281
4285
|
pendingUnsubscribes = new Map;
|
|
4286
|
+
streamScopes = new Map;
|
|
4282
4287
|
static UNSUBSCRIBE_DELAY_MS = 5000;
|
|
4283
4288
|
registerViews(views) {
|
|
4284
4289
|
this.views = views;
|
|
@@ -4337,6 +4342,7 @@ class StreamingQueryCache {
|
|
|
4337
4342
|
if (current2 && current2.refCount <= 0) {
|
|
4338
4343
|
current2.unsubscribe();
|
|
4339
4344
|
this.activeStreams.delete(viewName);
|
|
4345
|
+
this.streamScopes.delete(viewName);
|
|
4340
4346
|
}
|
|
4341
4347
|
}, StreamingQueryCache.UNSUBSCRIBE_DELAY_MS);
|
|
4342
4348
|
this.pendingUnsubscribes.set(viewName, timeout);
|
|
@@ -4344,6 +4350,8 @@ class StreamingQueryCache {
|
|
|
4344
4350
|
}
|
|
4345
4351
|
subscribeQuery(descriptor, eventWire, scope) {
|
|
4346
4352
|
const key = descriptor.element;
|
|
4353
|
+
if (scope)
|
|
4354
|
+
this.streamScopes.set(key, scope);
|
|
4347
4355
|
const { unsubscribe } = this.registerStream(key, () => {
|
|
4348
4356
|
const subId = eventWire.subscribeQuery(descriptor, (data) => {
|
|
4349
4357
|
this.setViewData(descriptor.element, data);
|
|
@@ -4352,6 +4360,28 @@ class StreamingQueryCache {
|
|
|
4352
4360
|
});
|
|
4353
4361
|
return unsubscribe;
|
|
4354
4362
|
}
|
|
4363
|
+
invalidateScope(scope) {
|
|
4364
|
+
for (const [viewName, viewScope] of this.streamScopes) {
|
|
4365
|
+
if (viewScope !== scope)
|
|
4366
|
+
continue;
|
|
4367
|
+
const pending = this.pendingUnsubscribes.get(viewName);
|
|
4368
|
+
if (pending) {
|
|
4369
|
+
clearTimeout(pending);
|
|
4370
|
+
this.pendingUnsubscribes.delete(viewName);
|
|
4371
|
+
}
|
|
4372
|
+
const stream = this.activeStreams.get(viewName);
|
|
4373
|
+
if (stream) {
|
|
4374
|
+
try {
|
|
4375
|
+
stream.unsubscribe();
|
|
4376
|
+
} catch {}
|
|
4377
|
+
this.activeStreams.delete(viewName);
|
|
4378
|
+
}
|
|
4379
|
+
this.streamScopes.delete(viewName);
|
|
4380
|
+
const store = this.stores.get(viewName);
|
|
4381
|
+
if (store)
|
|
4382
|
+
store.clear();
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4355
4385
|
setViewData(viewName, data) {
|
|
4356
4386
|
const store = this.stores.get(viewName);
|
|
4357
4387
|
if (!store)
|
|
@@ -4399,6 +4429,11 @@ class StreamingQueryCache {
|
|
|
4399
4429
|
stream.unsubscribe();
|
|
4400
4430
|
}
|
|
4401
4431
|
this.activeStreams.clear();
|
|
4432
|
+
this.streamScopes.clear();
|
|
4433
|
+
for (const timeout of this.pendingUnsubscribes.values()) {
|
|
4434
|
+
clearTimeout(timeout);
|
|
4435
|
+
}
|
|
4436
|
+
this.pendingUnsubscribes.clear();
|
|
4402
4437
|
for (const store of this.stores.values()) {
|
|
4403
4438
|
store.clear();
|
|
4404
4439
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcote.tech/arc-adapter-db-sqlite-wasm",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dev": "bun build ./src/index.ts ./src/worker.ts --outdir ./dist --target browser --format esm --watch"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@arcote.tech/arc": "^0.7.
|
|
42
|
+
"@arcote.tech/arc": "^0.7.12",
|
|
43
43
|
"@sqlite.org/sqlite-wasm": "^3.46.0-build1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|