@camera.ui/browser 0.0.149 → 0.0.151

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 +34 -10
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -233,7 +233,7 @@ async function rpcCall(rpcRef, fn, options = {}) {
233
233
  lastError = err;
234
234
  if (attempt >= maxRetries) throw err;
235
235
  if (!shouldRetry(err, attempt)) throw err;
236
- await sleep(retryDelayMs(attempt), signal);
236
+ await sleep$1(retryDelayMs(attempt), signal);
237
237
  }
238
238
  }
239
239
  throw lastError ?? /* @__PURE__ */ new Error("rpc: max retries exceeded");
@@ -316,7 +316,7 @@ function useRpcSubscription(subscribeFn, options = {}) {
316
316
  options.onError?.(err);
317
317
  return;
318
318
  }
319
- await sleep(retryDelayMs(attempt));
319
+ await sleep$1(retryDelayMs(attempt));
320
320
  }
321
321
  }
322
322
  } finally {
@@ -393,7 +393,7 @@ async function waitForRpc(rpcRef, timeoutMs, signal) {
393
393
  });
394
394
  });
395
395
  }
396
- async function sleep(ms, signal) {
396
+ async function sleep$1(ms, signal) {
397
397
  return new Promise((resolve, reject) => {
398
398
  if (signal?.aborted) {
399
399
  reject(makeAbortError());
@@ -1777,16 +1777,40 @@ function cleanupStorage(state, isConnected, config) {
1777
1777
  state.cachedStorage = void 0;
1778
1778
  config.value = void 0;
1779
1779
  }
1780
+ var GET_CONFIG_RETRY_DELAYS = [
1781
+ 2e3,
1782
+ 5e3,
1783
+ 1e4,
1784
+ 15e3
1785
+ ];
1786
+ function sleep(ms) {
1787
+ return new Promise((resolve) => setTimeout(resolve, ms));
1788
+ }
1780
1789
  function createStorageOperations(state, config, isLoading, error) {
1781
- async function getConfig() {
1790
+ let inflightGetConfig;
1791
+ function getConfig() {
1792
+ inflightGetConfig ??= getConfigWithRetry().finally(() => inflightGetConfig = void 0);
1793
+ return inflightGetConfig;
1794
+ }
1795
+ async function getConfigWithRetry() {
1782
1796
  const cached = state.cachedStorage;
1783
1797
  if (!cached) return void 0;
1784
- const result = await cached.getConfig();
1785
- if (state.cachedStorage !== cached) return result;
1786
- config.value = cached.config.value;
1787
- isLoading.value = cached.isLoading.value;
1788
- error.value = cached.error.value;
1789
- return result;
1798
+ isLoading.value = true;
1799
+ try {
1800
+ let result = await cached.getConfig();
1801
+ for (const delay of GET_CONFIG_RETRY_DELAYS) {
1802
+ if (!cached.error.value || state.cachedStorage !== cached) break;
1803
+ await sleep(delay);
1804
+ if (state.cachedStorage !== cached) break;
1805
+ result = await cached.getConfig();
1806
+ }
1807
+ if (state.cachedStorage !== cached) return result;
1808
+ config.value = cached.config.value;
1809
+ error.value = cached.error.value;
1810
+ return result;
1811
+ } finally {
1812
+ isLoading.value = false;
1813
+ }
1790
1814
  }
1791
1815
  async function setValue(key, value) {
1792
1816
  const cached = state.cachedStorage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camera.ui/browser",
3
- "version": "0.0.149",
3
+ "version": "0.0.151",
4
4
  "description": "camera.ui browser client",
5
5
  "author": "seydx (https://github.com/cameraui/clients)",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "peerDependencies": {
32
32
  "@camera.ui/logger": ">=0.0.2",
33
33
  "@camera.ui/rpc": ">=1.0.10",
34
- "@camera.ui/sdk": ">=1.2.0",
34
+ "@camera.ui/sdk": ">=1.2.1",
35
35
  "@camera.ui/transport": ">=0.0.1",
36
36
  "@vueuse/core": ">=14.4.0",
37
37
  "vue": ">=3.5.40"
@@ -39,7 +39,7 @@
39
39
  "devDependencies": {
40
40
  "@camera.ui/logger": "file:../../packages/logger",
41
41
  "@camera.ui/rpc": "^1.0.10",
42
- "@camera.ui/sdk": "~1.2.0",
42
+ "@camera.ui/sdk": "~1.2.1",
43
43
  "@camera.ui/transport": "file:../../packages/transport",
44
44
  "@eneris/push-receiver": "^4.3.1",
45
45
  "@microsoft/api-extractor": "^7.58.12",
@@ -49,7 +49,7 @@
49
49
  "@vitejs/plugin-vue": "^6.0.8",
50
50
  "@vue/eslint-config-prettier": "^10.2.0",
51
51
  "@vue/eslint-config-typescript": "^14.9.0",
52
- "@vue/language-core": "^3.3.8",
52
+ "@vue/language-core": "^3.3.9",
53
53
  "@vue/tsconfig": "^0.9.1",
54
54
  "@vueuse/core": "^14.4.0",
55
55
  "@webgpu/types": "^0.1.71",
@@ -61,11 +61,11 @@
61
61
  "typescript": "5.9.3",
62
62
  "typescript-eslint": "^8.65.0",
63
63
  "unplugin-dts": "^1.0.3",
64
- "updates": "^17.20.1",
64
+ "updates": "^17.20.2",
65
65
  "vite": "^8.2.0",
66
66
  "vitest": "^4.1.10",
67
67
  "vue": "^3.5.40",
68
- "vue-tsc": "^3.3.8"
68
+ "vue-tsc": "^3.3.9"
69
69
  },
70
70
  "overrides": {
71
71
  "@vue/language-core": "$@vue/language-core"