@streamlayer/sdk-web-api 1.12.6 → 1.13.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.
@@ -208,20 +208,16 @@ export class Transport {
208
208
  };
209
209
  this.interceptors.push(auth);
210
210
  if (process.env.NODE_ENV !== 'test') {
211
- this.interceptors.push(__GRPC_DEVTOOLS_EXTENSION__());
211
+ if (window.localStorage.getItem('SL_GRPC_DEVTOOLS') === 'true') {
212
+ this.interceptors.push(__GRPC_DEVTOOLS_EXTENSION__());
213
+ }
214
+ else {
215
+ console.warn('SL GRPC DevTools is disabled. To enable, set SL_GRPC_DEVTOOLS to true in localStorage.');
216
+ }
212
217
  }
213
218
  if (this.opts?.retryable) {
214
219
  this.interceptors.push(retry);
215
220
  }
216
- // if (window.__GRPC_DEVTOOLS_EXTENSION__) {
217
- // this.interceptors.push(window.__GRPC_DEVTOOLS_EXTENSION__())
218
- // } else {
219
- // window.addEventListener('grpc_devtools_loaded', () => {
220
- // if (window.__GRPC_DEVTOOLS_EXTENSION__) {
221
- // this.interceptors.push(window.__GRPC_DEVTOOLS_EXTENSION__())
222
- // }
223
- // })
224
- // }
225
221
  };
226
222
  }
227
223
  export class MockTransport extends Transport {
@@ -27,10 +27,15 @@ export const __GRPC_DEVTOOLS_EXTENSION__ = () => (next) => async (request) => {
27
27
  },
28
28
  response: {},
29
29
  };
30
- window.postMessage({
31
- type: '__GRPC_DEVTOOLS_EXTENSION__',
32
- data: store,
33
- });
30
+ try {
31
+ window.postMessage({
32
+ type: '__GRPC_DEVTOOLS_EXTENSION__',
33
+ data: store,
34
+ });
35
+ }
36
+ catch (e) {
37
+ console.log('devtools error', e);
38
+ }
34
39
  try {
35
40
  const response = await next(request);
36
41
  store.received_at = Date.now();
@@ -43,7 +48,12 @@ export const __GRPC_DEVTOOLS_EXTENSION__ = () => (next) => async (request) => {
43
48
  type: '__GRPC_DEVTOOLS_EXTENSION__',
44
49
  data: store,
45
50
  };
46
- window.postMessage(msg);
51
+ try {
52
+ window.postMessage(msg);
53
+ }
54
+ catch (e) {
55
+ console.log('devtools error', e);
56
+ }
47
57
  }
48
58
  else {
49
59
  const msg = {
@@ -53,7 +63,12 @@ export const __GRPC_DEVTOOLS_EXTENSION__ = () => (next) => async (request) => {
53
63
  stream: true,
54
64
  },
55
65
  };
56
- window.postMessage(msg);
66
+ try {
67
+ window.postMessage(msg);
68
+ }
69
+ catch (e) {
70
+ console.log('devtools error', e);
71
+ }
57
72
  return {
58
73
  ...response,
59
74
  message: logEach(store, response.message),
@@ -73,7 +88,12 @@ export const __GRPC_DEVTOOLS_EXTENSION__ = () => (next) => async (request) => {
73
88
  type: '__GRPC_DEVTOOLS_EXTENSION__',
74
89
  data: store,
75
90
  };
76
- window.postMessage(msg);
91
+ try {
92
+ window.postMessage(msg);
93
+ }
94
+ catch (e) {
95
+ console.log('devtools error', e);
96
+ }
77
97
  throw e;
78
98
  }
79
99
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/sdk-web-api",
3
- "version": "1.12.6",
3
+ "version": "1.13.0",
4
4
  "type": "module",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -21,12 +21,12 @@
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@streamlayer/sdk-web-interfaces": "^1.7.6",
25
- "@streamlayer/sdk-web-logger": "^1.0.73",
26
- "@streamlayer/sdk-web-storage": "^1.0.73"
24
+ "@streamlayer/sdk-web-interfaces": "^1.7.8",
25
+ "@streamlayer/sdk-web-logger": "^1.0.75",
26
+ "@streamlayer/sdk-web-storage": "^1.0.75"
27
27
  },
28
28
  "peerDependencies": {
29
- "@streamlayer/sl-eslib": "^5.216.1"
29
+ "@streamlayer/sl-eslib": "^5.218.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@bufbuild/protobuf": "^2.2.2",