@arcote.tech/arc-cli 0.7.11 → 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.
Files changed (2) hide show
  1. package/dist/index.js +62 -0
  2. package/package.json +9 -9
package/dist/index.js CHANGED
@@ -15486,6 +15486,7 @@ class StreamingQueryCache {
15486
15486
  views = [];
15487
15487
  activeStreams = new Map;
15488
15488
  pendingUnsubscribes = new Map;
15489
+ streamScopes = new Map;
15489
15490
  static UNSUBSCRIBE_DELAY_MS = 5000;
15490
15491
  registerViews(views) {
15491
15492
  this.views = views;
@@ -15544,6 +15545,7 @@ class StreamingQueryCache {
15544
15545
  if (current2 && current2.refCount <= 0) {
15545
15546
  current2.unsubscribe();
15546
15547
  this.activeStreams.delete(viewName);
15548
+ this.streamScopes.delete(viewName);
15547
15549
  }
15548
15550
  }, StreamingQueryCache.UNSUBSCRIBE_DELAY_MS);
15549
15551
  this.pendingUnsubscribes.set(viewName, timeout);
@@ -15551,6 +15553,8 @@ class StreamingQueryCache {
15551
15553
  }
15552
15554
  subscribeQuery(descriptor, eventWire, scope) {
15553
15555
  const key = descriptor.element;
15556
+ if (scope)
15557
+ this.streamScopes.set(key, scope);
15554
15558
  const { unsubscribe } = this.registerStream(key, () => {
15555
15559
  const subId = eventWire.subscribeQuery(descriptor, (data) => {
15556
15560
  this.setViewData(descriptor.element, data);
@@ -15559,6 +15563,28 @@ class StreamingQueryCache {
15559
15563
  });
15560
15564
  return unsubscribe;
15561
15565
  }
15566
+ invalidateScope(scope) {
15567
+ for (const [viewName, viewScope] of this.streamScopes) {
15568
+ if (viewScope !== scope)
15569
+ continue;
15570
+ const pending = this.pendingUnsubscribes.get(viewName);
15571
+ if (pending) {
15572
+ clearTimeout(pending);
15573
+ this.pendingUnsubscribes.delete(viewName);
15574
+ }
15575
+ const stream2 = this.activeStreams.get(viewName);
15576
+ if (stream2) {
15577
+ try {
15578
+ stream2.unsubscribe();
15579
+ } catch {}
15580
+ this.activeStreams.delete(viewName);
15581
+ }
15582
+ this.streamScopes.delete(viewName);
15583
+ const store = this.stores.get(viewName);
15584
+ if (store)
15585
+ store.clear();
15586
+ }
15587
+ }
15562
15588
  setViewData(viewName, data) {
15563
15589
  const store = this.stores.get(viewName);
15564
15590
  if (!store)
@@ -15606,6 +15632,11 @@ class StreamingQueryCache {
15606
15632
  stream2.unsubscribe();
15607
15633
  }
15608
15634
  this.activeStreams.clear();
15635
+ this.streamScopes.clear();
15636
+ for (const timeout of this.pendingUnsubscribes.values()) {
15637
+ clearTimeout(timeout);
15638
+ }
15639
+ this.pendingUnsubscribes.clear();
15609
15640
  for (const store of this.stores.values()) {
15610
15641
  store.clear();
15611
15642
  }
@@ -22843,6 +22874,7 @@ class StreamingQueryCache2 {
22843
22874
  views = [];
22844
22875
  activeStreams = new Map;
22845
22876
  pendingUnsubscribes = new Map;
22877
+ streamScopes = new Map;
22846
22878
  static UNSUBSCRIBE_DELAY_MS = 5000;
22847
22879
  registerViews(views) {
22848
22880
  this.views = views;
@@ -22901,6 +22933,7 @@ class StreamingQueryCache2 {
22901
22933
  if (current22 && current22.refCount <= 0) {
22902
22934
  current22.unsubscribe();
22903
22935
  this.activeStreams.delete(viewName);
22936
+ this.streamScopes.delete(viewName);
22904
22937
  }
22905
22938
  }, StreamingQueryCache2.UNSUBSCRIBE_DELAY_MS);
22906
22939
  this.pendingUnsubscribes.set(viewName, timeout);
@@ -22908,6 +22941,8 @@ class StreamingQueryCache2 {
22908
22941
  }
22909
22942
  subscribeQuery(descriptor, eventWire, scope) {
22910
22943
  const key = descriptor.element;
22944
+ if (scope)
22945
+ this.streamScopes.set(key, scope);
22911
22946
  const { unsubscribe } = this.registerStream(key, () => {
22912
22947
  const subId = eventWire.subscribeQuery(descriptor, (data) => {
22913
22948
  this.setViewData(descriptor.element, data);
@@ -22916,6 +22951,28 @@ class StreamingQueryCache2 {
22916
22951
  });
22917
22952
  return unsubscribe;
22918
22953
  }
22954
+ invalidateScope(scope) {
22955
+ for (const [viewName, viewScope] of this.streamScopes) {
22956
+ if (viewScope !== scope)
22957
+ continue;
22958
+ const pending = this.pendingUnsubscribes.get(viewName);
22959
+ if (pending) {
22960
+ clearTimeout(pending);
22961
+ this.pendingUnsubscribes.delete(viewName);
22962
+ }
22963
+ const stream2 = this.activeStreams.get(viewName);
22964
+ if (stream2) {
22965
+ try {
22966
+ stream2.unsubscribe();
22967
+ } catch {}
22968
+ this.activeStreams.delete(viewName);
22969
+ }
22970
+ this.streamScopes.delete(viewName);
22971
+ const store = this.stores.get(viewName);
22972
+ if (store)
22973
+ store.clear();
22974
+ }
22975
+ }
22919
22976
  setViewData(viewName, data) {
22920
22977
  const store = this.stores.get(viewName);
22921
22978
  if (!store)
@@ -22963,6 +23020,11 @@ class StreamingQueryCache2 {
22963
23020
  stream2.unsubscribe();
22964
23021
  }
22965
23022
  this.activeStreams.clear();
23023
+ this.streamScopes.clear();
23024
+ for (const timeout of this.pendingUnsubscribes.values()) {
23025
+ clearTimeout(timeout);
23026
+ }
23027
+ this.pendingUnsubscribes.clear();
22966
23028
  for (const store of this.stores.values()) {
22967
23029
  store.clear();
22968
23030
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcote.tech/arc-cli",
3
- "version": "0.7.11",
3
+ "version": "0.7.12",
4
4
  "description": "CLI tool for Arc framework",
5
5
  "module": "index.ts",
6
6
  "main": "dist/index.js",
@@ -12,13 +12,13 @@
12
12
  "build": "bun build --target=bun ./src/index.ts --outdir=dist --external @arcote.tech/arc --external @arcote.tech/arc-ds --external @arcote.tech/arc-react --external @arcote.tech/platform --external '@opentelemetry/*' && chmod +x dist/index.js"
13
13
  },
14
14
  "dependencies": {
15
- "@arcote.tech/arc": "^0.7.11",
16
- "@arcote.tech/arc-ds": "^0.7.11",
17
- "@arcote.tech/arc-react": "^0.7.11",
18
- "@arcote.tech/arc-host": "^0.7.11",
19
- "@arcote.tech/arc-adapter-db-sqlite": "^0.7.11",
20
- "@arcote.tech/arc-adapter-db-postgres": "^0.7.11",
21
- "@arcote.tech/arc-otel": "^0.7.11",
15
+ "@arcote.tech/arc": "^0.7.12",
16
+ "@arcote.tech/arc-ds": "^0.7.12",
17
+ "@arcote.tech/arc-react": "^0.7.12",
18
+ "@arcote.tech/arc-host": "^0.7.12",
19
+ "@arcote.tech/arc-adapter-db-sqlite": "^0.7.12",
20
+ "@arcote.tech/arc-adapter-db-postgres": "^0.7.12",
21
+ "@arcote.tech/arc-otel": "^0.7.12",
22
22
  "@opentelemetry/api": "^1.9.0",
23
23
  "@opentelemetry/api-logs": "^0.57.0",
24
24
  "@opentelemetry/core": "^1.30.0",
@@ -31,7 +31,7 @@
31
31
  "@opentelemetry/sdk-trace-base": "^1.30.0",
32
32
  "@opentelemetry/sdk-trace-node": "^1.30.0",
33
33
  "@opentelemetry/semantic-conventions": "^1.27.0",
34
- "@arcote.tech/platform": "^0.7.11",
34
+ "@arcote.tech/platform": "^0.7.12",
35
35
  "@clack/prompts": "^0.9.0",
36
36
  "commander": "^11.1.0",
37
37
  "chokidar": "^3.5.3",