@jibb-open/jssdk 3.17.1 → 3.17.3
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/package.json +2 -2
- package/ws/eventbus.js +1 -1
- package/ws/ipsa.js +1 -1
- package/ws/meeting.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jibb-open/jssdk",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "LOG_LEVEL=error mocha --timeout 10000 ",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"isomorphic-ws": "^4.0.1",
|
|
27
27
|
"jwt-decode": "^3.1.2",
|
|
28
28
|
"path": "^0.12.7",
|
|
29
|
-
"pino": "^
|
|
29
|
+
"pino": "^8.20.0",
|
|
30
30
|
"pino-pretty": "^7.5.3",
|
|
31
31
|
"protobufjs": "7.2.4",
|
|
32
32
|
"rimraf": "^3.0.2",
|
package/ws/eventbus.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBusConnection=void 0,require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.array-buffer.slice.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/esnext.aggregate-error.js"),require("core-js/modules/esnext.promise.any.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url.to-json.js"),require("core-js/modules/web.url-search-params.js");var _config=require("../config.js"),_index=require("../utils/logger/index.js"),_exceptions=require("../types/exceptions.js"),_types=require("../types/types.js"),_proto=require("../types/proto.js"),_auth=require("../api/auth.js"),_observable_connection=require("./observable_connection.js");function _classPrivateMethodInitSpec(a,b){_checkPrivateRedeclaration(a,b),b.add(a)}function _classPrivateFieldInitSpec(a,b,c){_checkPrivateRedeclaration(a,b),b.set(a,c)}function _checkPrivateRedeclaration(a,b){if(b.has(a))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldGet(b,c){return b.get(_assertClassBrand(b,c))}function _classPrivateFieldSet(b,c,a){return b.set(_assertClassBrand(b,c),a),a}function _assertClassBrand(a,b,c){if("function"==typeof a?a===b:a.has(b))return 3>arguments.length?b:c;throw new TypeError("Private element is not present on this object")}const ClientType=_proto.types.ClientType,BusMessage=_proto.cilix.BusMessage;let instance,clientType=ClientType.WEBAPP,clientName="client";const observable=new _observable_connection.Observable;var _expiryTimer=/*#__PURE__*/new WeakMap,_EventBusConnection_brand=/*#__PURE__*/new WeakSet;class EventBusConnection extends _observable_connection.ObservableRetryConnection{static getInstance(){return instance||(instance=new EventBusConnection),instance}static addEventListener(a){return observable.addEventListener(a)}static removeEventListener(a){observable.removeEventListener(a)}static setClientName(a){clientName=a}static setClientType(a){clientType=a}constructor(){super("eventbus-".concat(clientName)),_classPrivateMethodInitSpec(this,_EventBusConnection_brand),_classPrivateFieldInitSpec(this,_expiryTimer,void 0),this.observable=observable,this.userToken=null,_classPrivateFieldSet(_expiryTimer,this,null)}async stop(){clearTimeout(_classPrivateFieldGet(_expiryTimer,this)),super.stop()}async write(a){_index.logger.debug("".concat(this.name,".write: "),BusMessage.toObject(a));let b=BusMessage.encode(a).finish();return super.write(b)}writeObject(a){let b=BusMessage.verify(a);if(b)throw new Error(b);let c=BusMessage.fromObject(a);return this.write(c)}async getURI(){try{this.userToken=await(0,_auth.getUserToken)(),this.userClaims=new _types.UserClaims(this.userToken);let a=this.userClaims.getSecondsUntilExpiry();if(0>=a){let a=new _exceptions.PermissionDeniedError("user token expired");throw this.onError(a),a}_classPrivateFieldSet(_expiryTimer,this,setTimeout(()=>{this.onError(new _exceptions.SessionTimeoutError("user token expired"))},a))}catch(a){let b=new _exceptions.PermissionDeniedError(a);throw this.onError(b),b}let a=new URL(_config.Config.apiBaseURL),b=_assertClassBrand(_EventBusConnection_brand,this,_getClientTypeAsString).call(this,clientType);return"wss://".concat(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBusConnection=void 0,require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.array-buffer.slice.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/esnext.aggregate-error.js"),require("core-js/modules/esnext.promise.any.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url.to-json.js"),require("core-js/modules/web.url-search-params.js");var _config=require("../config.js"),_index=require("../utils/logger/index.js"),_exceptions=require("../types/exceptions.js"),_types=require("../types/types.js"),_proto=require("../types/proto.js"),_auth=require("../api/auth.js"),_observable_connection=require("./observable_connection.js");function _classPrivateMethodInitSpec(a,b){_checkPrivateRedeclaration(a,b),b.add(a)}function _classPrivateFieldInitSpec(a,b,c){_checkPrivateRedeclaration(a,b),b.set(a,c)}function _checkPrivateRedeclaration(a,b){if(b.has(a))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldGet(b,c){return b.get(_assertClassBrand(b,c))}function _classPrivateFieldSet(b,c,a){return b.set(_assertClassBrand(b,c),a),a}function _assertClassBrand(a,b,c){if("function"==typeof a?a===b:a.has(b))return 3>arguments.length?b:c;throw new TypeError("Private element is not present on this object")}const ClientType=_proto.types.ClientType,BusMessage=_proto.cilix.BusMessage;let instance,clientType=ClientType.WEBAPP,clientName="client";const observable=new _observable_connection.Observable;var _expiryTimer=/*#__PURE__*/new WeakMap,_EventBusConnection_brand=/*#__PURE__*/new WeakSet;class EventBusConnection extends _observable_connection.ObservableRetryConnection{static getInstance(){return instance||(instance=new EventBusConnection),instance}static addEventListener(a){return observable.addEventListener(a)}static removeEventListener(a){observable.removeEventListener(a)}static setClientName(a){clientName=a}static setClientType(a){clientType=a}constructor(){super("eventbus-".concat(clientName)),_classPrivateMethodInitSpec(this,_EventBusConnection_brand),_classPrivateFieldInitSpec(this,_expiryTimer,void 0),this.observable=observable,this.userToken=null,_classPrivateFieldSet(_expiryTimer,this,null)}async stop(){clearTimeout(_classPrivateFieldGet(_expiryTimer,this)),super.stop()}async write(a){_index.logger.debug("".concat(this.name,".write: "),BusMessage.toObject(a));let b=BusMessage.encode(a).finish();return super.write(b)}writeObject(a){let b=BusMessage.verify(a);if(b)throw new Error(b);let c=BusMessage.fromObject(a);return this.write(c)}async getURI(){try{this.userToken=await(0,_auth.getUserToken)(),this.userClaims=new _types.UserClaims(this.userToken);let a=this.userClaims.getSecondsUntilExpiry();if(0>=a){let a=new _exceptions.PermissionDeniedError("user token expired");throw this.onError(a),a}_classPrivateFieldSet(_expiryTimer,this,setTimeout(()=>{this.onError(new _exceptions.SessionTimeoutError("user token expired"))},a))}catch(a){let b=new _exceptions.PermissionDeniedError(a);throw this.onError(b),b}let a=new URL(_config.Config.apiBaseURL),b=a.host+("/"===a.pathname?"":a.pathname),c=_assertClassBrand(_EventBusConnection_brand,this,_getClientTypeAsString).call(this,clientType);return"wss://".concat(b,"/ws/eventbus/").concat(c,"?user_token=").concat(this.userToken,"&name=").concat(clientName)}onData(a){try{if(a instanceof ArrayBuffer){let b=new Uint8Array(a),c=BusMessage.decode(b);return b=null,_index.logger.debug("".concat(this.name,".read: "),c),void _assertClassBrand(_EventBusConnection_brand,this,_onMessage).call(this,c)}}catch(a){_index.logger.error(a)}this.parseJSONResponse(a)}stopStream(a){return this.writeObject({stopRequest:{},dst:{id:a}})}stopAllStreams(){return this.writeObject({stopRequest:{}})}startStream(a){let{config:b,runtimeConfig:c,camera:d,clientId:e,meetingToken:f}=a;return this.writeObject({startRequest:{config:b,runtimeConfig:c,camera:d,meetingToken:f},dst:{id:e}})}requestCameraPreview(a,b){return this.writeObject({previewRequest:{source:{id:b}},dst:{id:a}})}setRuntimeConfig(a,b){return this.writeObject({runtimeConfigRequest:b,dst:{id:a}})}getCameraList(a){return this.writeObject({cameraListRequest:{},dst:{id:a}})}sendCameraList(a,b,c){return this.writeObject({cameraListResponse:{items:a},src:b,dst:c})}getClientStatusList(){return this.writeObject({clientStatusRequest:{}})}}exports.EventBusConnection=EventBusConnection;async function _onMessage(a){if(a&&"object"==typeof a)try{a.clientConnected&&_assertClassBrand(_EventBusConnection_brand,this,_onClientConnected).call(this,a),a.clientDisconnected&&_assertClassBrand(_EventBusConnection_brand,this,_onClientDisconnected).call(this,a),a.cameraListRequest&&_assertClassBrand(_EventBusConnection_brand,this,_onCameraListRequest).call(this,a),a.cameraListResponse&&_assertClassBrand(_EventBusConnection_brand,this,_onCameraListResponse).call(this,a),a.runtimeConfigRequest&&_assertClassBrand(_EventBusConnection_brand,this,_onRuntimeConfigRequest).call(this,a),a.startRequest&&_assertClassBrand(_EventBusConnection_brand,this,_onStartRequest).call(this,a),a.stopRequest&&_assertClassBrand(_EventBusConnection_brand,this,_onStopRequest).call(this,a),a.previewRequest&&_assertClassBrand(_EventBusConnection_brand,this,_onPreviewRequest).call(this,a),a.previewResponse&&_assertClassBrand(_EventBusConnection_brand,this,_onPreviewResponse).call(this,a),a.ipsaResponse&&_assertClassBrand(_EventBusConnection_brand,this,_onIPSAResponse).call(this,a),a.tooManyPublishers&&_assertClassBrand(_EventBusConnection_brand,this,_onTooManyPublishers).call(this,a),a.recordingStarted&&_assertClassBrand(_EventBusConnection_brand,this,_onRecordingStarted).call(this,a),a.recordingStopped&&_assertClassBrand(_EventBusConnection_brand,this,_onRecordingStopped).call(this,a)}catch(a){_index.logger.error(a)}}function _getClientTypeAsString(a){let b=Object.entries(ClientType).find(b=>{let[c,d]=b;return d==a});if(!b)throw new _exceptions.InvalidArgumentError("Invalid client type: ".concat(a));let c=b[0].toLowerCase();return c}function _sendPreview(a,b){this.writeObject({previewResponse:{image:a},dst:b})}async function _onCameraListRequest(a){let b=await _assertClassBrand(_EventBusConnection_brand,this,_callSubscribers).call(this,"onCameraListRequest",a.cameraListRequest);this.sendCameraList(b,a.dst,a.src)}function _onCameraListResponse(a){observable.notify("onCameraListResponse",a.cameraListResponse)}function _onClientConnected(a){_index.logger.info("".concat(this.name,": client connected: "),a.src),observable.notify("onClientConnected",a.src)}function _onClientDisconnected(a){_index.logger.warn("".concat(this.name,": client disconnected: "),a.src),observable.notify("onClientDisconnected",a.src)}function _onRuntimeConfigRequest(a){observable.notify("onRuntimeConfigRequest",a.runtimeConfigRequest)}function _onStopRequest(a){observable.notify("onStopRequest",a.stopRequest)}async function _onPreviewRequest(a){let b=await _assertClassBrand(_EventBusConnection_brand,this,_callSubscribers).call(this,"onPreviewRequest",a.previewRequest);_assertClassBrand(_EventBusConnection_brand,this,_sendPreview).call(this,b,a.src)}function _onPreviewResponse(a){observable.notify("onPreviewResponse",a.previewResponse)}function _onStartRequest(a){var b,c;let d=a.startRequest;!(null!==d&&void 0!==d&&null!==(b=d.camera)&&void 0!==b&&b.id)&&null!==d&&void 0!==d&&null!==(c=d.inputSource)&&void 0!==c&&c.id&&(d.camera={id:d.inputSource.id}),observable.notify("onStartRequest",d)}function _onCornersReceived(a){observable.notify("onCornersReceived",a.corners.corners)}function _onIPSAResponse(a){a&&observable.notify("onIPSAResponse",a.ipsaResponse)}function _onTooManyPublishers(a){observable.notify("onTooManyPublishers",a.tooManyPublishers)}function _onRecordingStarted(a){observable.notify("onRecordingStarted",a.recordingStarted)}function _onRecordingStopped(a){observable.notify("onRecordingStopped",a.recordingStopped)}function _callSubscribers(a){for(var b=arguments.length,c=Array(1<b?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];let e=[...observable.observers].map(b=>{let[c,d]=b;return d[a]}).filter(a=>a!==void 0).map(a=>a(...c));return Promise.any(e)}
|
package/ws/ipsa.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.IPSA=void 0,require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.array-buffer.slice.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url.to-json.js"),require("core-js/modules/web.url-search-params.js");var _IPSAClass,_config=require("../config.js"),_index=require("../utils/logger/index.js"),_types=require("../types/types.js"),_proto=require("../types/proto.js"),_auth=require("../api/auth.js"),_observable_connection=require("./observable_connection.js"),_exceptions=require("../types/exceptions.js");function _classPrivateMethodInitSpec(a,b){_checkPrivateRedeclaration(a,b),b.add(a)}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(a,b,c){var d=_superPropBase(a,b);if(d){var e=Object.getOwnPropertyDescriptor(d,b);return e.get?e.get.call(3>arguments.length?a:c):e.value}},_get.apply(this,arguments)}function _superPropBase(a,b){for(;!Object.prototype.hasOwnProperty.call(a,b)&&(a=_getPrototypeOf(a),null!==a););return a}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _classPrivateFieldInitSpec(a,b,c){_checkPrivateRedeclaration(a,b),b.set(a,c)}function _checkPrivateRedeclaration(a,b){if(b.has(a))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldGet(b,c){return b.get(_assertClassBrand(b,c))}function _classPrivateFieldSet(b,c,a){return b.set(_assertClassBrand(b,c),a),a}function _assertClassBrand(a,b,c){if("function"==typeof a?a===b:a.has(b))return 3>arguments.length?b:c;throw new TypeError("Private element is not present on this object")}var _meetingExpiryTimer=/*#__PURE__*/new WeakMap,_IPSAClass_brand=/*#__PURE__*/new WeakSet;class IPSAClass extends _observable_connection.ObservableRetryConnection{constructor(a){super("ipsa",a),_classPrivateMethodInitSpec(this,_IPSAClass_brand),_classPrivateFieldInitSpec(this,_meetingExpiryTimer,void 0),this.socket=null,_classPrivateFieldSet(_meetingExpiryTimer,this,null),this.meetingToken=null,this.meetingClaims=null}async start(a){let{meetingToken:b,request:c}=a;if(this.isStarted())return void this.onError(new _exceptions.AlreadyStartedError("already started"));this.setRuntimeConfig(c.runtimeConfig),_assertClassBrand(_IPSAClass_brand,this,_setConfig).call(this,c.config),this.meetingToken=b,this.meetingClaims=new _types.MeetingClaims(this.meetingToken);let d=this.meetingClaims.getSecondsUntilExpiry();if(0>=d){let a=new _exceptions.PermissionDeniedError("meeting token expired");throw this.onError(a),a}else clearTimeout(_classPrivateFieldGet(_meetingExpiryTimer,this)),_classPrivateFieldSet(_meetingExpiryTimer,this,setTimeout(()=>{let a=new _exceptions.SessionTimeoutError("meeting token expired");this.onError(a)},d));super.start()}stop(){clearTimeout(_classPrivateFieldGet(_meetingExpiryTimer,this)),this.configRequest=null,this.runtimeConfigRequest=null,super.stop()}async getURI(){let a;try{a=await(0,_auth.getUserToken)({minExpiry:3600});let b=new _types.UserClaims(a),c=b.getSecondsUntilExpiry();if(0>=c){let a=new _exceptions.PermissionDeniedError("user token expired");throw this.onError(a),a}}catch(a){let b=new _exceptions.PermissionDeniedError(a);throw this.onError(b),b}let b=this.meetingClaims.meetindId;_index.logger.info("Starting IPSA...");let c=new URL(_config.Config.apiBaseURL);return"wss://".concat(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.IPSA=void 0,require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.array-buffer.slice.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url.to-json.js"),require("core-js/modules/web.url-search-params.js");var _IPSAClass,_config=require("../config.js"),_index=require("../utils/logger/index.js"),_types=require("../types/types.js"),_proto=require("../types/proto.js"),_auth=require("../api/auth.js"),_observable_connection=require("./observable_connection.js"),_exceptions=require("../types/exceptions.js");function _classPrivateMethodInitSpec(a,b){_checkPrivateRedeclaration(a,b),b.add(a)}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(a,b,c){var d=_superPropBase(a,b);if(d){var e=Object.getOwnPropertyDescriptor(d,b);return e.get?e.get.call(3>arguments.length?a:c):e.value}},_get.apply(this,arguments)}function _superPropBase(a,b){for(;!Object.prototype.hasOwnProperty.call(a,b)&&(a=_getPrototypeOf(a),null!==a););return a}function _getPrototypeOf(a){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(a){return a.__proto__||Object.getPrototypeOf(a)},_getPrototypeOf(a)}function _classPrivateFieldInitSpec(a,b,c){_checkPrivateRedeclaration(a,b),b.set(a,c)}function _checkPrivateRedeclaration(a,b){if(b.has(a))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldGet(b,c){return b.get(_assertClassBrand(b,c))}function _classPrivateFieldSet(b,c,a){return b.set(_assertClassBrand(b,c),a),a}function _assertClassBrand(a,b,c){if("function"==typeof a?a===b:a.has(b))return 3>arguments.length?b:c;throw new TypeError("Private element is not present on this object")}var _meetingExpiryTimer=/*#__PURE__*/new WeakMap,_IPSAClass_brand=/*#__PURE__*/new WeakSet;class IPSAClass extends _observable_connection.ObservableRetryConnection{constructor(a){super("ipsa",a),_classPrivateMethodInitSpec(this,_IPSAClass_brand),_classPrivateFieldInitSpec(this,_meetingExpiryTimer,void 0),this.socket=null,_classPrivateFieldSet(_meetingExpiryTimer,this,null),this.meetingToken=null,this.meetingClaims=null}async start(a){let{meetingToken:b,request:c}=a;if(this.isStarted())return void this.onError(new _exceptions.AlreadyStartedError("already started"));this.setRuntimeConfig(c.runtimeConfig),_assertClassBrand(_IPSAClass_brand,this,_setConfig).call(this,c.config),this.meetingToken=b,this.meetingClaims=new _types.MeetingClaims(this.meetingToken);let d=this.meetingClaims.getSecondsUntilExpiry();if(0>=d){let a=new _exceptions.PermissionDeniedError("meeting token expired");throw this.onError(a),a}else clearTimeout(_classPrivateFieldGet(_meetingExpiryTimer,this)),_classPrivateFieldSet(_meetingExpiryTimer,this,setTimeout(()=>{let a=new _exceptions.SessionTimeoutError("meeting token expired");this.onError(a)},d));super.start()}stop(){clearTimeout(_classPrivateFieldGet(_meetingExpiryTimer,this)),this.configRequest=null,this.runtimeConfigRequest=null,super.stop()}async getURI(){let a;try{a=await(0,_auth.getUserToken)({minExpiry:3600});let b=new _types.UserClaims(a),c=b.getSecondsUntilExpiry();if(0>=c){let a=new _exceptions.PermissionDeniedError("user token expired");throw this.onError(a),a}}catch(a){let b=new _exceptions.PermissionDeniedError(a);throw this.onError(b),b}let b=this.meetingClaims.meetindId;_index.logger.info("Starting IPSA...");let c=new URL(_config.Config.apiBaseURL),d=c.host+("/"===c.pathname?"":c.pathname);return"wss://".concat(d,"/ws/ipsa/").concat(b,"?user_token=").concat(a,"&meeting_token=").concat(this.meetingToken)}onData(a){try{if(a instanceof ArrayBuffer){let b=new Uint8Array(a),c=_proto.ipsa.Response.decode(b);return void this.notify("onResponse",c)}}catch(a){_index.logger.error(a)}this.parseJSONResponse(a)}writeData(a){let b=this.getBufferedAmount();0<b&&_index.logger.warn("ipsa: low internet speed connection. [buffer size: ".concat(b,"]"));let c=_proto.ipsa.Request.create({ipsa:{data:a}});return _assertClassBrand(_IPSAClass_brand,this,_write).call(this,c)}onConnected(){super.onConnected(),_assertClassBrand(_IPSAClass_brand,this,_write).call(this,this.configRequest),_assertClassBrand(_IPSAClass_brand,this,_write).call(this,this.runtimeConfigRequest)}setRuntimeConfig(a){if(!a)throw new _exceptions.InvalidArgumentError("bad request");let b=_proto.ipsa.Request.create({runtimeConfig:a});this.runtimeConfigRequest=b,this.isConnected()&&_assertClassBrand(_IPSAClass_brand,this,_write).call(this,b)}}_IPSAClass=IPSAClass;async function _write(a){let b=_proto.ipsa.Request.verify(a);if(b){let a=new _exceptions.InvalidArgumentError("invalid message: "+b);throw this.onError(a),a}if(a){let b=_proto.ipsa.Request.encode(a).finish();_get(_getPrototypeOf(_IPSAClass.prototype),"write",this).call(this,b)}}function _setConfig(a){if(!a)throw new _exceptions.InvalidArgumentError("bad request");let b=_proto.ipsa.Request.create({config:a});this.configRequest=b}let IPSA=exports.IPSA=new IPSAClass({maxRetryCount:10,minRetryIntervalMs:500,maxRetryIntervalMs:4e3});
|
package/ws/meeting.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MeetingConnection=void 0,require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.array-buffer.slice.js"),require("core-js/modules/es.global-this.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url.to-json.js"),require("core-js/modules/web.url-search-params.js");var _auth=require("../api/auth.js"),_config=require("../config.js"),_index=require("../utils/logger/index.js"),_types=require("../types/types.js"),_proto=require("../types/proto.js"),_exceptions=require("../types/exceptions.js"),_observable_connection=require("./observable_connection.js");function _classPrivateMethodInitSpec(a,b){_checkPrivateRedeclaration(a,b),b.add(a)}function _classPrivateFieldInitSpec(a,b,c){_checkPrivateRedeclaration(a,b),b.set(a,c)}function _checkPrivateRedeclaration(a,b){if(b.has(a))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldGet(b,c){return b.get(_assertClassBrand(b,c))}function _classPrivateFieldSet(b,c,a){return b.set(_assertClassBrand(b,c),a),a}function _assertClassBrand(a,b,c){if("function"==typeof a?a===b:a.has(b))return 3>arguments.length?b:c;throw new TypeError("Private element is not present on this object")}function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=typeof b&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&{}.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e.default=b,d&&d.set(b,e),e}let Message=_proto.meeting.Message,ErrorCode=_proto.types.Code;(null===globalThis||void 0===globalThis?void 0:globalThis.WebSocket)==null&&Promise.resolve().then(()=>_interopRequireWildcard(require("isomorphic-ws"))).then(a=>{globalThis.WebSocket=a.default}).catch(a=>{console.log(a)});var _expiryTimer=/*#__PURE__*/new WeakMap,_MeetingConnectionImp_brand=/*#__PURE__*/new WeakSet;class MeetingConnectionImp extends _observable_connection.ObservableRetryConnection{constructor(){let a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{maxRetryCount:10,minRetryIntervalMs:500,maxRetryIntervalMs:32e3};super("meeting",a),_classPrivateMethodInitSpec(this,_MeetingConnectionImp_brand),_classPrivateFieldInitSpec(this,_expiryTimer,void 0),this.meetingId=null,this.meetingToken=null,_classPrivateFieldSet(_expiryTimer,this,null)}start(a){this.meetingToken=a,this.meetingClaims=new _types.MeetingClaims(a),this.meetingId=this.meetingClaims.meetindId,this.name="meeting-".concat(this.meetingId);let b=this.meetingClaims.getSecondsUntilExpiry();if(0>=b){let a=new _exceptions.PermissionDeniedError("meeting token expired");throw this.onError(a),a}_classPrivateFieldSet(_expiryTimer,this,setTimeout(()=>{this.stop(),this.onError(new _exceptions.SessionTimeoutError("meeting token expired"))},b)),super.start()}stop(){clearTimeout(_classPrivateFieldGet(_expiryTimer,this)),super.stop()}async getURI(){try{if(this.meetingClaims.isExpired()){let a=new _exceptions.PermissionDeniedError("meeting token expired");throw this.onError(a),a}}catch(a){let b=new _exceptions.PermissionDeniedError(a);throw b}let a=new URL(_config.Config.apiBaseURL);return"wss://"+
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MeetingConnection=void 0,require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.array-buffer.slice.js"),require("core-js/modules/es.global-this.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.typed-array.uint8-array.js"),require("core-js/modules/es.typed-array.fill.js"),require("core-js/modules/es.typed-array.set.js"),require("core-js/modules/es.typed-array.sort.js"),require("core-js/modules/es.typed-array.to-locale-string.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url.to-json.js"),require("core-js/modules/web.url-search-params.js");var _auth=require("../api/auth.js"),_config=require("../config.js"),_index=require("../utils/logger/index.js"),_types=require("../types/types.js"),_proto=require("../types/proto.js"),_exceptions=require("../types/exceptions.js"),_observable_connection=require("./observable_connection.js");function _classPrivateMethodInitSpec(a,b){_checkPrivateRedeclaration(a,b),b.add(a)}function _classPrivateFieldInitSpec(a,b,c){_checkPrivateRedeclaration(a,b),b.set(a,c)}function _checkPrivateRedeclaration(a,b){if(b.has(a))throw new TypeError("Cannot initialize the same private elements twice on an object")}function _classPrivateFieldGet(b,c){return b.get(_assertClassBrand(b,c))}function _classPrivateFieldSet(b,c,a){return b.set(_assertClassBrand(b,c),a),a}function _assertClassBrand(a,b,c){if("function"==typeof a?a===b:a.has(b))return 3>arguments.length?b:c;throw new TypeError("Private element is not present on this object")}function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(b,c){if(!c&&b&&b.__esModule)return b;if(null===b||"object"!=typeof b&&"function"!=typeof b)return{default:b};var d=_getRequireWildcardCache(c);if(d&&d.has(b))return d.get(b);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in b)if("default"!=a&&{}.hasOwnProperty.call(b,a)){var g=f?Object.getOwnPropertyDescriptor(b,a):null;g&&(g.get||g.set)?Object.defineProperty(e,a,g):e[a]=b[a]}return e.default=b,d&&d.set(b,e),e}let Message=_proto.meeting.Message,ErrorCode=_proto.types.Code;(null===globalThis||void 0===globalThis?void 0:globalThis.WebSocket)==null&&Promise.resolve().then(()=>_interopRequireWildcard(require("isomorphic-ws"))).then(a=>{globalThis.WebSocket=a.default}).catch(a=>{console.log(a)});var _expiryTimer=/*#__PURE__*/new WeakMap,_MeetingConnectionImp_brand=/*#__PURE__*/new WeakSet;class MeetingConnectionImp extends _observable_connection.ObservableRetryConnection{constructor(){let a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{maxRetryCount:10,minRetryIntervalMs:500,maxRetryIntervalMs:32e3};super("meeting",a),_classPrivateMethodInitSpec(this,_MeetingConnectionImp_brand),_classPrivateFieldInitSpec(this,_expiryTimer,void 0),this.meetingId=null,this.meetingToken=null,_classPrivateFieldSet(_expiryTimer,this,null)}start(a){this.meetingToken=a,this.meetingClaims=new _types.MeetingClaims(a),this.meetingId=this.meetingClaims.meetindId,this.name="meeting-".concat(this.meetingId);let b=this.meetingClaims.getSecondsUntilExpiry();if(0>=b){let a=new _exceptions.PermissionDeniedError("meeting token expired");throw this.onError(a),a}_classPrivateFieldSet(_expiryTimer,this,setTimeout(()=>{this.stop(),this.onError(new _exceptions.SessionTimeoutError("meeting token expired"))},b)),super.start()}stop(){clearTimeout(_classPrivateFieldGet(_expiryTimer,this)),super.stop()}async getURI(){try{if(this.meetingClaims.isExpired()){let a=new _exceptions.PermissionDeniedError("meeting token expired");throw this.onError(a),a}}catch(a){let b=new _exceptions.PermissionDeniedError(a);throw b}let a=new URL(_config.Config.apiBaseURL),b=a.host+("/"===a.pathname?"":a.pathname);return"wss://"+b+"/ws/meetings/"+this.meetingId+"?meeting_token="+this.meetingToken}async onData(a){try{if(a instanceof ArrayBuffer){let b=new Uint8Array(a),c=Message.decode(b);return null!==c&&void 0!==c&&c.update&&(this.notify("onMeetingUpdate",c.update),await _assertClassBrand(_MeetingConnectionImp_brand,this,_sendImageAck).call(this,c.update.userId)),null!==c&&void 0!==c&&c.drawing&&this.notify("onDrawing",c.drawing),void(null!==c&&void 0!==c&&c.pointer?this.notify("onPointer",c):null!==c&&void 0!==c&&c.join?this.notify("onMeetingJoin",c.join):null!==c&&void 0!==c&&c.leave&&this.notify("onMeetingLeave",c.leave))}}catch(a){_index.logger.error(a)}this.parseJSONResponse(a)}async sendPointer(a,b,c){let d="";if(""!=c)d=c;else try{let a=await(0,_auth.getUserClaims)();d=a.email}catch(a){d=c}let e=Message.fromObject({pointer:{email:d,x:a,y:b}}),f=Message.encode(e).finish();await this.write(f)}async sendDrawing(a){let{email:b,data:c}=a,d=Message.fromObject({drawing:{email:b,data:c}});_index.logger.debug("".concat(this.name,".Drawing: "),Message.toObject(d));let e=Message.encode(d).finish();await this.write(e)}}async function _sendImageAck(a){let b=Message.fromObject({imageAck:{userId:a}}),c=Message.encode(b).finish();await this.write(c)}let MeetingConnection=exports.MeetingConnection=new MeetingConnectionImp({maxRetryCount:10,minRetryIntervalMs:500,maxRetryIntervalMs:8e3});
|