@jibb-open/jssdk 3.6.2 → 3.6.6

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/api/auth.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Auth=void 0,require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.promise.js");var _config=require("../config.js"),_index=require("../utils/logger/index.js"),_types=require("../types/types.js"),_index2=require("../utils/http/index.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 _classPrivateMethodGet(a,b,c){if(!b.has(a))throw new TypeError("attempted to get private field on non-instance");return c}function _classPrivateFieldGet(a,b){var c=_classExtractFieldDescriptor(a,b,"get");return _classApplyDescriptorGet(a,c)}function _classApplyDescriptorGet(a,b){return b.get?b.get.call(a):b.value}function _classPrivateFieldSet(a,b,c){var d=_classExtractFieldDescriptor(a,b,"set");return _classApplyDescriptorSet(a,d,c),c}function _classExtractFieldDescriptor(a,b,c){if(!b.has(a))throw new TypeError("attempted to "+c+" private field on non-instance");return b.get(a)}function _classApplyDescriptorSet(a,b,c){if(b.set)b.set.call(a,c);else{if(!b.writable)throw new TypeError("attempted to set read only private field");b.value=c}}var _userClaims=/*#__PURE__*/new WeakMap,_getUserTokenFromApiKey=/*#__PURE__*/new WeakSet,_getUserTokenFromIDToken=/*#__PURE__*/new WeakSet,_refreshUserToken=/*#__PURE__*/new WeakSet;class AuthClass{constructor(){_classPrivateMethodInitSpec(this,_refreshUserToken),_classPrivateMethodInitSpec(this,_getUserTokenFromIDToken),_classPrivateMethodInitSpec(this,_getUserTokenFromApiKey),_classPrivateFieldInitSpec(this,_userClaims,{writable:!0,value:void 0}),_index.logger.debug("Creating new Auth instance"),this.apiKey=void 0,_classPrivateFieldSet(this,_userClaims,new Map),this.getIdToken=void 0}setUserToken(a){let b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:_types.AccessLevel.USER,c=new _types.UserClaims(a);_classPrivateFieldGet(this,_userClaims).set(b,c)}setApiKey(a){this.apiKey=a,_classPrivateFieldGet(this,_userClaims).clear()}async getUserClaims(){return await this.getUserToken(),_classPrivateFieldGet(this,_userClaims).get(_types.AccessLevel.USER)}async getUserToken(){let a,{expiry:b,refresh:c,accessLevel:d}=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(c=c||!1,d=d||_types.AccessLevel.USER,b=b||3600,!0===c&&(await _classPrivateMethodGet(this,_refreshUserToken,_refreshUserToken2).call(this,{expiry:b,accessLevel:d})),a=_classPrivateFieldGet(this,_userClaims).get(d),void 0!==a&&!a.isExpired())return a.token;if(await _classPrivateMethodGet(this,_refreshUserToken,_refreshUserToken2).call(this,{expiry:b,accessLevel:d}),a=_classPrivateFieldGet(this,_userClaims).get(d),void 0!==a&&!a.isExpired())return a.token;throw new Error("could not create user token")}logout(){_classPrivateFieldGet(this,_userClaims).clear()}async generateAPIKey(){let a={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await this.getUserToken()},b=await _index2.http.get("".concat(_config.Config.apiBaseURL,"/v1/auth/apikey"),a);return b.data.apiKey}async generateCustomAuthPassword(){let a={"Content-Type":"application/json",Accept:"application/json","x-jibb-id-jwt":await this.getIdToken()},b=await _index2.http.get("".concat(_config.Config.apiBaseURL,"/v1/auth/custom"),a);return b.data.password}}async function _getUserTokenFromApiKey2(a){let b,{expiry:c,accessLevel:d}=a,e={api_key:this.apiKey,expiry:{seconds:c}};switch(d){case _types.AccessLevel.ADMIN:b="".concat(_config.Config.apiBaseURL,"/v1/admin/auth/token");break;case _types.AccessLevel.SUPERADMIN:b="".concat(_config.Config.apiBaseURL,"/v1/superadmin/auth/token");break;default:b="".concat(_config.Config.apiBaseURL,"/v1/auth/token");}let f=await _index2.http.post(b,e,{"Content-Type":"application/json",Accept:"application/json"});return f.data.token}async function _getUserTokenFromIDToken2(a){let b,{expiry:c,accessLevel:d}=a,e={"Content-Type":"application/json",Accept:"application/json","x-jibb-id-jwt":await this.getIdToken()};switch(d){case _types.AccessLevel.ADMIN:b="".concat(_config.Config.apiBaseURL,"/v1/admin/auth/token");break;case _types.AccessLevel.SUPERADMIN:b="".concat(_config.Config.apiBaseURL,"/v1/superadmin/auth/token");break;default:b="".concat(_config.Config.apiBaseURL,"/v1/auth/token");}let f=await _index2.http.post(b,{expiry:{seconds:c}},e);return f.data.token}async function _refreshUserToken2(a){let{expiry:b,accessLevel:c}=a;if(this.apiKey){let a=await _classPrivateMethodGet(this,_getUserTokenFromApiKey,_getUserTokenFromApiKey2).call(this,{expiry:b,accessLevel:c});return this.setUserToken(a,c),a}try{let a=await _classPrivateMethodGet(this,_getUserTokenFromIDToken,_getUserTokenFromIDToken2).call(this,{expiry:b,accessLevel:c});return this.setUserToken(a,c),a}catch(a){_index.logger.error(a)}}let Auth=new AuthClass;exports.Auth=Auth;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Auth=void 0,require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.promise.js");var _config=require("../config.js"),_index=require("../utils/logger/index.js"),_types=require("../types/types.js"),_index2=require("../utils/http/index.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 _classPrivateMethodGet(a,b,c){if(!b.has(a))throw new TypeError("attempted to get private field on non-instance");return c}function _classPrivateFieldGet(a,b){var c=_classExtractFieldDescriptor(a,b,"get");return _classApplyDescriptorGet(a,c)}function _classApplyDescriptorGet(a,b){return b.get?b.get.call(a):b.value}function _classPrivateFieldSet(a,b,c){var d=_classExtractFieldDescriptor(a,b,"set");return _classApplyDescriptorSet(a,d,c),c}function _classExtractFieldDescriptor(a,b,c){if(!b.has(a))throw new TypeError("attempted to "+c+" private field on non-instance");return b.get(a)}function _classApplyDescriptorSet(a,b,c){if(b.set)b.set.call(a,c);else{if(!b.writable)throw new TypeError("attempted to set read only private field");b.value=c}}var _userClaims=/*#__PURE__*/new WeakMap,_getUserTokenFromApiKey=/*#__PURE__*/new WeakSet,_getUserTokenFromIDToken=/*#__PURE__*/new WeakSet,_refreshUserToken=/*#__PURE__*/new WeakSet;class AuthClass{constructor(){_classPrivateMethodInitSpec(this,_refreshUserToken),_classPrivateMethodInitSpec(this,_getUserTokenFromIDToken),_classPrivateMethodInitSpec(this,_getUserTokenFromApiKey),_classPrivateFieldInitSpec(this,_userClaims,{writable:!0,value:void 0}),_index.logger.debug("Creating new Auth instance"),this.apiKey=void 0,_classPrivateFieldSet(this,_userClaims,new Map),this.getIdToken=void 0}setUserToken(a){let b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:_types.AccessLevel.USER,c=new _types.UserClaims(a);_classPrivateFieldGet(this,_userClaims).set(b,c)}setApiKey(a){this.apiKey=a,_classPrivateFieldGet(this,_userClaims).clear()}async getUserClaims(){return await this.getUserToken(),_classPrivateFieldGet(this,_userClaims).get(_types.AccessLevel.USER)}async getUserToken(){let a,{expiry:b,refresh:c,accessLevel:d}=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(c=c||!1,d=d||_types.AccessLevel.USER,!0===c&&(await _classPrivateMethodGet(this,_refreshUserToken,_refreshUserToken2).call(this,{expiry:b,accessLevel:d})),a=_classPrivateFieldGet(this,_userClaims).get(d),void 0!==a&&!a.isExpired())return a.token;if(await _classPrivateMethodGet(this,_refreshUserToken,_refreshUserToken2).call(this,{expiry:b,accessLevel:d}),a=_classPrivateFieldGet(this,_userClaims).get(d),void 0!==a&&!a.isExpired())return a.token;throw new Error("could not create user token")}logout(){_classPrivateFieldGet(this,_userClaims).clear()}async generateAPIKey(){let a={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await this.getUserToken()},b=await _index2.http.get("".concat(_config.Config.apiBaseURL,"/v1/auth/apikey"),a);return b.data.apiKey}async generateCustomAuthPassword(){let a={"Content-Type":"application/json",Accept:"application/json","x-jibb-id-jwt":await this.getIdToken()},b=await _index2.http.get("".concat(_config.Config.apiBaseURL,"/v1/auth/custom"),a);return b.data.password}}async function _getUserTokenFromApiKey2(a){let{expiry:b,accessLevel:c}=a,d={api_key:this.apiKey};b!==void 0&&(d.expiry={seconds:b});let e;switch(c){case _types.AccessLevel.ADMIN:e="".concat(_config.Config.apiBaseURL,"/v1/admin/auth/token");break;case _types.AccessLevel.SUPERADMIN:e="".concat(_config.Config.apiBaseURL,"/v1/superadmin/auth/token");break;default:e="".concat(_config.Config.apiBaseURL,"/v1/auth/token");}let f=await _index2.http.post(e,d,{"Content-Type":"application/json",Accept:"application/json"});return f.data.token}async function _getUserTokenFromIDToken2(a){let{expiry:b,accessLevel:c}=a,d={"Content-Type":"application/json",Accept:"application/json","x-jibb-id-jwt":await this.getIdToken()},e={};b!==void 0&&(e.expiry={seconds:b});let f;switch(c){case _types.AccessLevel.ADMIN:f="".concat(_config.Config.apiBaseURL,"/v1/admin/auth/token");break;case _types.AccessLevel.SUPERADMIN:f="".concat(_config.Config.apiBaseURL,"/v1/superadmin/auth/token");break;default:f="".concat(_config.Config.apiBaseURL,"/v1/auth/token");}let g=await _index2.http.post(f,e,d);return g.data.token}async function _refreshUserToken2(a){let{expiry:b,accessLevel:c}=a;if(this.apiKey){let a=await _classPrivateMethodGet(this,_getUserTokenFromApiKey,_getUserTokenFromApiKey2).call(this,{expiry:b,accessLevel:c});return this.setUserToken(a,c),a}try{let a=await _classPrivateMethodGet(this,_getUserTokenFromIDToken,_getUserTokenFromIDToken2).call(this,{expiry:b,accessLevel:c});return this.setUserToken(a,c),a}catch(a){_index.logger.error(a)}}let Auth=new AuthClass;exports.Auth=Auth;
package/api/recording.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.deleteImage=deleteImage,exports.deleteRecording=deleteRecording,exports.getAllRecordImages=getAllRecordImages,exports.getImage=getImage,exports.getImageList=getImageList,exports.getRecording=getRecording,exports.getRecordingList=getRecordingList,exports.startRecording=startRecording,exports.stopRecording=stopRecording,exports.takeSnapshot=takeSnapshot,exports.updateRecording=updateRecording,require("core-js/modules/es.promise.js"),require("core-js/modules/es.json.stringify.js"),require("core-js/modules/web.dom-collections.iterator.js");var _config=require("../config.js"),_auth=require("./auth.js"),_index=require("../utils/http/index.js");async function updateRecording(a){let{recordingId:b,title:c}=a,d={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()};return _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/").concat(b),{title:c},d)}async function getRecording(a){let b={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()},c=await _index.http.get("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/").concat(a),b);return c.data}async function getRecordingList(a){let b={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()};void 0!==a&&(b["x-jibb-pagination"]=JSON.stringify(a));let c=await _index.http.get("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings"),b);return a=c.headers["x-jibb-pagination"],a=a&&JSON.parse(a),{items:c.data.items,pagination:a}}async function deleteRecording(a){let b={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()};return _index.http.delete("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/").concat(a),b)}async function getImageList(a){let b={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()},c=await _index.http.get("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/").concat(a,"/images"),b);return c.data.imageName}async function getImage(a){let{recordingId:b,imageName:c}=a,d={"Content-Type":"application/json",Accept:"image/jpeg","x-jibb-user-jwt":await _auth.Auth.getUserToken()},e="".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/").concat(b,"/images/").concat(c),f=await _index.http.get(e,d,{responseType:"arraybuffer"});return f.data}async function getAllRecordImages(a){let b=[],c=await this.getImageList(a);for(const d of c){let c={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()},e=await _index.http.get("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/").concat(a,"/images/").concat(d),{headers:c});b.push({imageName:d,data:e.data})}return b}async function deleteImage(a){let{recordingId:b,imageName:c}=a,d={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()};return _index.http.delete("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/").concat(b,"/images/").concat(c),d)}async function startRecording(){let a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{meetingId,meetingToken,title:"UNTITLED",interval:60};return async function(){let b=null===a||void 0===a?void 0:a.meetingToken,c=(null===a||void 0===a?void 0:a.title)||"UNTITLED",d=(null===a||void 0===a?void 0:a.interval)||60,e=null===a||void 0===a?void 0:a.meetingId,f={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken(),"x-jibb-meeting-jwt":b},g=await _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/start"),{title:c,write_interval:d,meeting_id:e},f);return g.data}()}async function stopRecording(){let a={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()},b=await _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/stop"),{},a);return b.data}async function takeSnapshot(){let a={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()},b=await _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/snapshot"),{},a);return b.data}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.startRecording=startRecording,exports.stopRecording=stopRecording,exports.takeSnapshot=takeSnapshot,require("core-js/modules/es.promise.js");var _config=require("../config.js"),_auth=require("./auth.js"),_index=require("../utils/http/index.js");async function startRecording(){let a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{meetingId,meetingToken,title:"UNTITLED",interval:60};return async function(){let b=null===a||void 0===a?void 0:a.meetingToken,c=(null===a||void 0===a?void 0:a.title)||"UNTITLED",d=null===a||void 0===a?void 0:a.meetingId,e=null===a||void 0===a?void 0:a.interval;e===void 0&&(e=60);let f={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken(),"x-jibb-meeting-jwt":b},g={title:c,write_interval:e,meeting_id:d},h=await _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/start"),g,f);return h.data}()}async function stopRecording(){let a={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()},b=await _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/stop"),{},a);return b.data}async function takeSnapshot(){let a={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()},b=await _index.http.post("".concat(_config.Config.apiBaseURL,"/v1/meetings/recordings/snapshot"),{},a);return b.data}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jibb-open/jssdk",
3
- "version": "3.6.2",
3
+ "version": "3.6.6",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "LOG_LEVEL=error mocha --timeout 10000 ",
package/types/jibb.pb.js CHANGED
@@ -1 +1 @@
1
- "use strict";var $protobuf=require("protobufjs/light"),$root=($protobuf.roots["default"]||($protobuf.roots["default"]=new $protobuf.Root)).addJSON({types:{options:{go_package:"github.com/Inkerz/jibbapis/sdk/go/types"},nested:{Code:{values:{SUCCESS:0,ERR_IO:4e3,ERR_CLOSED:4001,ERR_TIMEOUT:4002,ERR_BAD_REQUEST:4003,ERR_UNAUTHORIZED:4004,ERR_INTERNAL:4005,ERR_TOO_MANY_CONNECTIONS:4006,ERR_OUT_OF_LICENSE:4008}},ErrorLevel:{values:{DEBUG:0,INFO:1,WARNING:2,ERROR:3,CRITICAL:4}},Error:{fields:{level:{type:"ErrorLevel",id:1},code:{type:"Code",id:2},reason:{type:"string",id:3}}},TriState:{values:{DEFAULT:0,ENABLE:1,DISABLE:2}},SurfaceType:{values:{UNKNOWN:0,PAPER:1,WHITEBOARD:2}},ClientType:{options:{allow_alias:!0},values:{UNKNOWN_CLIENT_TYPE:0,ANY:0,IPSA:1,MOBILE:2,WEBAPP:3,COMPANION:4,ipsa:1,mobile:2,webapp:3,companion:4}},ClientDetails:{fields:{clientType:{type:"ClientType",id:1},id:{type:"string",id:2},name:{type:"string",id:3}}},ContentType:{values:{UNKNOWN_TYPE:0,IMAGE_JPEG:1,IMAGE_WEBP:2}}}},jibb:{nested:{ipsa:{nested:{v1:{options:{java_package:"ai.jibb.ipsa",java_outer_classname:"IPSA",go_package:"github.com/Inkerz/jibbapis/sdk/go/ipsa"},nested:{StatusCode:{values:{SUCCESS:0,INVALID_INPUT:3,SESSION_BUSY:6,SURFACE_DETECTED:110,SURFACE_NOT_DETECTED:100,SURFACE_NOT_STABILIZED:101,SURFACE_CHANGED:103,SURFACE_TOO_LEFT:104,SURFACE_TOO_RIGHT:105,SURFACE_TOO_CLOSE:106,SURFACE_TOO_FAR:109,SURFACE_TOO_DARK:107,SURFACE_TOO_BRIGHT:108,INTERNAL_ERROR:200}},Rotation:{values:{ROTATE_0:0,ROTATE_90_CLOCKWISE:1,ROTATE_180:2,ROTATE_90_COUNTERCLOCKWISE:3}},Config:{fields:{surfaceType:{type:"types.SurfaceType",id:1},enableStabilization:{type:"types.TriState",id:3},enableTransformation:{type:"types.TriState",id:4},userId:{type:"int32",id:5},meetingToken:{type:"string",id:6},mbusTopicStatus:{type:"string",id:7},mbusTopicImage:{type:"string",id:8}}},RuntimeConfig:{fields:{customCorners:{rule:"repeated",type:"sint32",id:1},fixedCorners:{type:"bool",id:2},enableColor:{type:"bool",id:3},rotation:{type:"Rotation",id:4},flipUpDown:{type:"bool",id:5},flipLeftRight:{type:"bool",id:6},enableEstimation:{type:"bool",id:7}}},VersionResponse:{fields:{version:{type:"string",id:1}}},SurfaceTransformationRequest:{fields:{surfaceType:{type:"types.SurfaceType",id:1},img:{type:"bytes",id:2}}},SurfaceTransformationResponse:{fields:{img:{type:"bytes",id:1}}},SurfaceSegmentationRequest:{fields:{surfaceType:{type:"types.SurfaceType",id:1},overlay:{type:"bool",id:2},img:{type:"bytes",id:3}}},SurfaceSegmentationResponse:{fields:{img:{type:"bytes",id:1}}},SurfaceDetectionRequest:{fields:{surfaceType:{type:"types.SurfaceType",id:1},img:{type:"bytes",id:2},overlay:{type:"bool",id:3}}},SurfaceDetectionResponse:{fields:{img:{type:"bytes",id:1},corners:{rule:"repeated",type:"sint32",id:2}}},ObjectRemovalRequest:{fields:{surfaceType:{type:"types.SurfaceType",id:1},overlay:{type:"bool",id:2},enableTransformation:{type:"bool",id:3},img:{type:"bytes",id:4}}},ObjectRemovalResponse:{fields:{img:{type:"bytes",id:1}}},ContentExtractionRequest:{fields:{surfaceType:{type:"types.SurfaceType",id:1},enableTransformation:{type:"bool",id:2},enableColor:{type:"bool",id:4},img:{type:"bytes",id:3}}},ContentExtractionResponse:{fields:{img:{type:"bytes",id:1},transformedImg:{type:"bytes",id:2}}},GetSimilarityRequest:{fields:{newImage:{type:"bytes",id:1},prevImage:{type:"bytes",id:2}}},GetSimilarityResponse:{fields:{similarity:{type:"double",id:1}}},Ipsa:{fields:{data:{type:"bytes",id:1}}},Request:{oneofs:{Command:{oneof:["config","ipsa","resetSession","recalibrate","runtimeConfig"]}},fields:{id:{type:"int32",id:1},config:{type:"Config",id:2},ipsa:{type:"Ipsa",id:3},resetSession:{type:"google.protobuf.Empty",id:4},recalibrate:{type:"google.protobuf.Empty",id:5},runtimeConfig:{type:"RuntimeConfig",id:6}}},Status:{fields:{userId:{type:"int32",id:1},corners:{rule:"repeated",type:"float",id:2},codes:{rule:"repeated",type:"StatusCode",id:3},processingTime:{type:"int32",id:4},upsampling:{type:"float",id:5},paperDetectionConfidence:{type:"int32",id:6}}},Image:{fields:{userId:{type:"int32",id:1},data:{type:"bytes",id:2}}},Response:{fields:{id:{type:"int32",id:1},image:{type:"bytes",id:5},status:{type:"Status",id:8}}}}}}}}},user:{options:{go_package:"github.com/Inkerz/jibbapis/sdk/go/user"},nested:{Level:{values:{FREE:0,BASIC:1,STUDENT:2,PRO:3,BUSINESS:4,ENTERPRISE:5,EDUCATION:6}},UserType:{values:{UNKNOWN:0,LIMITED:1,MEMBER:2,ADMIN:3,OWNER:4}},UserDetails:{fields:{organizationName:{type:"string",id:2},level:{type:"Level",id:3},firstName:{type:"string",id:4},lastName:{type:"string",id:5},organizationId:{type:"int32",id:6},userType:{type:"UserType",id:7},activated:{type:"bool",id:8},userId:{type:"int32",id:9},email:{type:"string",id:10}}},UserList:{fields:{users:{rule:"repeated",type:"UserDetails",id:1}}},CreateOrganizationUserRequest:{fields:{organizationId:{type:"int32",id:1},users:{rule:"repeated",type:"User",id:2}},nested:{User:{fields:{email:{type:"string",id:2},firstName:{type:"string",id:3},lastName:{type:"string",id:4},userType:{type:"UserType",id:5}}}}},CreateOrganizationUserResponse:{fields:{failedUsers:{rule:"repeated",type:"string",id:1}}},DeleteOrganizationUserRequest:{fields:{organizationId:{type:"int32",id:1},userId:{type:"int32",id:2}}},ChangeOrganizationUserTypeRequest:{fields:{organizationId:{type:"int32",id:1},userId:{type:"int32",id:2},userType:{type:"UserType",id:3}}},GetOrganizationUsersListRequest:{fields:{organizationId:{type:"int32",id:1}}},GetOrganizationUserRequest:{fields:{organizationId:{type:"int32",id:1},userId:{type:"int32",id:2}}},CreateOrganizationRequest:{fields:{name:{type:"string",id:1},ownerEmail:{type:"string",id:2},level:{type:"Level",id:3},licenseCount:{type:"int32",id:4},expiryDate:{type:"google.protobuf.Timestamp",id:5},subdomainName:{type:"string",id:6}}},DeleteOrganizationRequest:{fields:{organizationId:{type:"int32",id:1}}},DeleteSAMLRequest:{fields:{organizationId:{type:"int32",id:1}}},GetSAMLRequest:{fields:{organizationId:{type:"int32",id:1}}},GetOrganizationSettingsRequest:{fields:{organizationId:{type:"int32",id:1}}},SAMLDetails:{fields:{organizationId:{type:"int32",id:1},metadata:{type:"string",id:3},autoAddUsers:{type:"bool",id:4},defaultUserType:{type:"UserType",id:5},enabled:{type:"bool",id:6}}},GetOrganizationRequest:{fields:{organizationId:{type:"int32",id:1}}},OrganizationDetails:{fields:{name:{type:"string",id:1},ownerEmail:{type:"string",id:2},level:{type:"Level",id:3},licenseCount:{type:"int32",id:4},usersCount:{type:"int32",id:5},creationDate:{type:"google.protobuf.Timestamp",id:6},expiryDate:{type:"google.protobuf.Timestamp",id:7},organizationId:{type:"int32",id:8},subdomainName:{type:"string",id:9}}},OrganizationList:{fields:{organizations:{rule:"repeated",type:"OrganizationDetails",id:1}}},UserClaims:{fields:{level:{type:"Level",id:2},organizationIds:{rule:"repeated",type:"int32",id:3},email:{type:"string",id:4}}},GetUserTokenRequest:{fields:{expiry:{type:"google.protobuf.Duration",id:1},apiKey:{type:"string",id:2}}},GetUserTokenResponse:{fields:{token:{type:"string",id:1}}},GenerateAPIKeyResponse:{fields:{apiKey:{type:"string",id:1}}},GenerateCustomAuthResponse:{fields:{password:{type:"string",id:1}}},VerifyCustomAuthRequest:{fields:{username:{type:"string",id:1},password:{type:"string",id:2}}},VerifyCustomAuthResponse:{fields:{verified:{type:"bool",id:1}}},GetOrganizationIdRequest:{fields:{organizationName:{type:"string",id:1},subdomainName:{type:"string",id:2},domainName:{type:"string",id:3},userEmail:{type:"string",id:4}}},GetOrganizationIdResponse:{fields:{organizationId:{type:"int32",id:1}}},CreateDomainRequest:{fields:{organizationId:{type:"int32",id:1},domainName:{type:"string",id:2}}},DeleteDomainRequest:{fields:{organizationId:{type:"int32",id:1},domainId:{type:"int32",id:2}}},VerifyDomainRequest:{fields:{organizationId:{type:"int32",id:1},domainId:{type:"int32",id:2}}},GetDomainListRequest:{fields:{organizationId:{type:"int32",id:1}}},GetDomainListResponse:{fields:{domains:{rule:"repeated",type:"DomainDetails",id:1}}},GetDomainRequest:{fields:{organizationId:{type:"int32",id:1},domainId:{type:"int32",id:2}}},DomainDetails:{fields:{organizationId:{type:"int32",id:1},domainId:{type:"int32",id:2},domainName:{type:"string",id:3},verificationCode:{type:"string",id:4},verified:{type:"bool",id:5}}},ActivateUserRequest:{fields:{organizationId:{type:"int32",id:1}}},SendUserActivationEmailRequest:{fields:{organizationId:{type:"int32",id:1},userIds:{rule:"repeated",type:"int32",id:2}}},GetUserIdRequest:{fields:{email:{type:"string",id:1},createIfNotExists:{type:"bool",id:2}}},GetUserIdResponse:{fields:{userId:{type:"int32",id:1}}},GetUserDetailsRequest:{fields:{userId:{type:"int32",id:1}}}}},google:{nested:{protobuf:{nested:{Empty:{fields:{}},Duration:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}},Timestamp:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}}}},meeting:{options:{go_package:"github.com/Inkerz/jibbapis/sdk/go/meeting"},nested:{Participant:{fields:{id:{type:"int32",id:1},userId:{type:"int32",id:2},email:{type:"string",id:3}}},Update:{fields:{id:{type:"int32",id:1},userId:{type:"int32",id:2},email:{type:"string",id:3},title:{type:"string",id:4},image:{type:"bytes",id:5}}},Drawing:{fields:{id:{type:"int32",id:1},userId:{type:"int32",id:2},email:{type:"string",id:3},data:{type:"string",id:4}}},Pointer:{fields:{id:{type:"int32",id:1},userId:{type:"int32",id:2},email:{type:"string",id:3},x:{type:"int32",id:4},y:{type:"int32",id:5}}},Message:{oneofs:{event:{oneof:["join","leave","update","drawing","pointer"]}},fields:{join:{type:"Participant",id:1},leave:{type:"Participant",id:2},update:{type:"Update",id:3},drawing:{type:"Drawing",id:6},pointer:{type:"Pointer",id:7}}}}},cilix:{options:{go_package:"github.com/Inkerz/jibbapis/sdk/go/cilix"},nested:{CameraDescription:{fields:{id:{type:"string",id:1},name:{type:"string",id:2}}},StartRequest:{fields:{config:{type:"jibb.ipsa.v1.Config",id:2},runtimeConfig:{type:"jibb.ipsa.v1.RuntimeConfig",id:4},camera:{type:"CameraDescription",id:5}}},PreviewRequest:{fields:{source:{type:"CameraDescription",id:2}}},PreviewResponse:{fields:{image:{type:"bytes",id:1}}},GetCameraListResponse:{fields:{items:{rule:"repeated",type:"CameraDescription",id:1}}},GetClientStatusListResponse:{fields:{clients:{rule:"repeated",type:"types.ClientDetails",id:1}}},BusMessage:{oneofs:{messageType:{oneof:["clientConnected","clientDisconnected","tooManyPublishers","ipsaResponse","startRequest","stopRequest","newPageRequest","previewRequest","previewResponse","cameraListRequest","cameraListResponse","runtimeConfigRequest","clientStatusRequest","recordingStarted","recordingStopped","error"]}},fields:{clientConnected:{type:"google.protobuf.Empty",id:2},clientDisconnected:{type:"google.protobuf.Empty",id:3},tooManyPublishers:{type:"google.protobuf.Empty",id:4},ipsaResponse:{type:"jibb.ipsa.v1.Response",id:6},startRequest:{type:"StartRequest",id:50},stopRequest:{type:"google.protobuf.Empty",id:51},newPageRequest:{type:"google.protobuf.Empty",id:52},previewRequest:{type:"PreviewRequest",id:53},previewResponse:{type:"PreviewResponse",id:54},cameraListRequest:{type:"google.protobuf.Empty",id:55},cameraListResponse:{type:"GetCameraListResponse",id:56},runtimeConfigRequest:{type:"jibb.ipsa.v1.RuntimeConfig",id:57},clientStatusRequest:{type:"google.protobuf.Empty",id:58},recordingStarted:{type:"google.protobuf.Empty",id:59},recordingStopped:{type:"google.protobuf.Empty",id:60},error:{type:"types.Code",id:100},src:{type:"types.ClientDetails",id:30},dst:{type:"types.ClientDetails",id:31}}}}}});module.exports=$root;
1
+ "use strict";var $protobuf=require("protobufjs/light"),$root=($protobuf.roots["default"]||($protobuf.roots["default"]=new $protobuf.Root)).addJSON({types:{options:{go_package:"github.com/Inkerz/jibbapis/sdk/go/types"},nested:{Code:{values:{SUCCESS:0,ERR_IO:4e3,ERR_CLOSED:4001,ERR_TIMEOUT:4002,ERR_BAD_REQUEST:4003,ERR_UNAUTHORIZED:4004,ERR_INTERNAL:4005,ERR_TOO_MANY_CONNECTIONS:4006,ERR_OUT_OF_LICENSE:4008}},ErrorLevel:{values:{DEBUG:0,INFO:1,WARNING:2,ERROR:3,CRITICAL:4}},Error:{fields:{level:{type:"ErrorLevel",id:1},code:{type:"Code",id:2},reason:{type:"string",id:3}}},TriState:{values:{DEFAULT:0,ENABLE:1,DISABLE:2}},SurfaceType:{values:{UNKNOWN:0,PAPER:1,WHITEBOARD:2}},ClientType:{options:{allow_alias:!0},values:{UNKNOWN_CLIENT_TYPE:0,ANY:0,IPSA:1,MOBILE:2,WEBAPP:3,COMPANION:4,ipsa:1,mobile:2,webapp:3,companion:4}},ClientDetails:{fields:{clientType:{type:"ClientType",id:1},id:{type:"string",id:2},name:{type:"string",id:3}}},ContentType:{values:{UNKNOWN_TYPE:0,IMAGE_JPEG:1,IMAGE_WEBP:2}}}},jibb:{nested:{ipsa:{nested:{v1:{options:{java_package:"ai.jibb.ipsa",java_outer_classname:"IPSA",go_package:"github.com/Inkerz/jibbapis/sdk/go/ipsa"},nested:{StatusCode:{values:{SUCCESS:0,INVALID_INPUT:3,SESSION_BUSY:6,SURFACE_DETECTED:110,SURFACE_NOT_DETECTED:100,SURFACE_NOT_STABILIZED:101,SURFACE_CHANGED:103,SURFACE_TOO_LEFT:104,SURFACE_TOO_RIGHT:105,SURFACE_TOO_CLOSE:106,SURFACE_TOO_FAR:109,SURFACE_TOO_DARK:107,SURFACE_TOO_BRIGHT:108,INTERNAL_ERROR:200}},Rotation:{values:{ROTATE_0:0,ROTATE_90_CLOCKWISE:1,ROTATE_180:2,ROTATE_90_COUNTERCLOCKWISE:3}},Config:{fields:{surfaceType:{type:"types.SurfaceType",id:1},enableStabilization:{type:"types.TriState",id:3},enableTransformation:{type:"types.TriState",id:4},userId:{type:"int32",id:5},mbusTopicStatus:{type:"string",id:7},mbusTopicImage:{type:"string",id:8},isVideoSession:{type:"bool",id:9}}},RuntimeConfig:{fields:{customCorners:{rule:"repeated",type:"sint32",id:1},fixedCorners:{type:"bool",id:2},enableColor:{type:"bool",id:3},rotation:{type:"Rotation",id:4},flipUpDown:{type:"bool",id:5},flipLeftRight:{type:"bool",id:6},enableEstimation:{type:"bool",id:7}}},VersionResponse:{fields:{version:{type:"string",id:1}}},SurfaceTransformationRequest:{fields:{surfaceType:{type:"types.SurfaceType",id:1},img:{type:"bytes",id:2}}},SurfaceTransformationResponse:{fields:{img:{type:"bytes",id:1}}},SurfaceSegmentationRequest:{fields:{surfaceType:{type:"types.SurfaceType",id:1},overlay:{type:"bool",id:2},img:{type:"bytes",id:3}}},SurfaceSegmentationResponse:{fields:{img:{type:"bytes",id:1}}},SurfaceDetectionRequest:{fields:{surfaceType:{type:"types.SurfaceType",id:1},img:{type:"bytes",id:2},overlay:{type:"bool",id:3}}},SurfaceDetectionResponse:{fields:{img:{type:"bytes",id:1},corners:{rule:"repeated",type:"sint32",id:2}}},ObjectRemovalRequest:{fields:{surfaceType:{type:"types.SurfaceType",id:1},overlay:{type:"bool",id:2},enableTransformation:{type:"bool",id:3},img:{type:"bytes",id:4}}},ObjectRemovalResponse:{fields:{img:{type:"bytes",id:1}}},ContentExtractionRequest:{fields:{surfaceType:{type:"types.SurfaceType",id:1},enableTransformation:{type:"bool",id:2},enableColor:{type:"bool",id:4},img:{type:"bytes",id:3}}},ContentExtractionResponse:{fields:{img:{type:"bytes",id:1},transformedImg:{type:"bytes",id:2}}},GetSimilarityRequest:{fields:{newImage:{type:"bytes",id:1},prevImage:{type:"bytes",id:2}}},GetSimilarityResponse:{fields:{similarity:{type:"double",id:1}}},GetContentStatsRequest:{fields:{image:{type:"bytes",id:1}}},GetContentStatsResponse:{fields:{contentPercentage:{type:"int32",id:1},contentCount:{type:"int32",id:2}}},Ipsa:{fields:{data:{type:"bytes",id:1}}},Request:{oneofs:{Command:{oneof:["config","ipsa","resetSession","recalibrate","runtimeConfig"]}},fields:{id:{type:"int32",id:1},config:{type:"Config",id:2},ipsa:{type:"Ipsa",id:3},resetSession:{type:"google.protobuf.Empty",id:4},recalibrate:{type:"google.protobuf.Empty",id:5},runtimeConfig:{type:"RuntimeConfig",id:6}}},Status:{fields:{userId:{type:"int32",id:1},corners:{rule:"repeated",type:"float",id:2},codes:{rule:"repeated",type:"StatusCode",id:3},processingTime:{type:"int32",id:4},upsampling:{type:"float",id:5},paperDetectionConfidence:{type:"int32",id:6}}},Image:{fields:{userId:{type:"int32",id:1},data:{type:"bytes",id:2}}},Response:{fields:{id:{type:"int32",id:1},image:{type:"bytes",id:5},status:{type:"Status",id:8}}}}}}}}},user:{options:{go_package:"github.com/Inkerz/jibbapis/sdk/go/user"},nested:{Level:{values:{FREE:0,BASIC:1,STUDENT:2,PRO:3,BUSINESS:4,ENTERPRISE:5,EDUCATION:6}},UserType:{values:{UNKNOWN:0,LIMITED:1,MEMBER:2,ADMIN:3,OWNER:4}},UserDetails:{fields:{organizationName:{type:"string",id:2},level:{type:"Level",id:3},firstName:{type:"string",id:4},lastName:{type:"string",id:5},organizationId:{type:"int32",id:6},userType:{type:"UserType",id:7},activated:{type:"bool",id:8},userId:{type:"int32",id:9},email:{type:"string",id:10}}},UserList:{fields:{users:{rule:"repeated",type:"UserDetails",id:1}}},CreateOrganizationUserRequest:{fields:{organizationId:{type:"int32",id:1},users:{rule:"repeated",type:"User",id:2}},nested:{User:{fields:{email:{type:"string",id:2},firstName:{type:"string",id:3},lastName:{type:"string",id:4},userType:{type:"UserType",id:5}}}}},CreateOrganizationUserResponse:{fields:{failedUsers:{rule:"repeated",type:"string",id:1}}},DeleteOrganizationUserRequest:{fields:{organizationId:{type:"int32",id:1},userId:{type:"int32",id:2}}},ChangeOrganizationUserTypeRequest:{fields:{organizationId:{type:"int32",id:1},userId:{type:"int32",id:2},userType:{type:"UserType",id:3}}},GetOrganizationUsersListRequest:{fields:{organizationId:{type:"int32",id:1}}},GetOrganizationUserRequest:{fields:{organizationId:{type:"int32",id:1},userId:{type:"int32",id:2}}},CreateOrganizationRequest:{fields:{name:{type:"string",id:1},ownerEmail:{type:"string",id:2},level:{type:"Level",id:3},licenseCount:{type:"int32",id:4},expiryDate:{type:"google.protobuf.Timestamp",id:5},subdomainName:{type:"string",id:6}}},DeleteOrganizationRequest:{fields:{organizationId:{type:"int32",id:1}}},DeleteSAMLRequest:{fields:{organizationId:{type:"int32",id:1}}},GetSAMLRequest:{fields:{organizationId:{type:"int32",id:1}}},GetOrganizationSettingsRequest:{fields:{organizationId:{type:"int32",id:1}}},SAMLDetails:{fields:{organizationId:{type:"int32",id:1},metadata:{type:"string",id:3},autoAddUsers:{type:"bool",id:4},defaultUserType:{type:"UserType",id:5},enabled:{type:"bool",id:6}}},GetOrganizationRequest:{fields:{organizationId:{type:"int32",id:1}}},OrganizationDetails:{fields:{name:{type:"string",id:1},ownerEmail:{type:"string",id:2},level:{type:"Level",id:3},licenseCount:{type:"int32",id:4},usersCount:{type:"int32",id:5},creationDate:{type:"google.protobuf.Timestamp",id:6},expiryDate:{type:"google.protobuf.Timestamp",id:7},organizationId:{type:"int32",id:8},subdomainName:{type:"string",id:9}}},OrganizationList:{fields:{organizations:{rule:"repeated",type:"OrganizationDetails",id:1}}},UserClaims:{fields:{level:{type:"Level",id:2},organizationIds:{rule:"repeated",type:"int32",id:3},email:{type:"string",id:4}}},GetUserTokenRequest:{fields:{expiry:{type:"google.protobuf.Duration",id:1},apiKey:{type:"string",id:2}}},GetUserTokenResponse:{fields:{token:{type:"string",id:1}}},GenerateAPIKeyResponse:{fields:{apiKey:{type:"string",id:1}}},GenerateCustomAuthResponse:{fields:{password:{type:"string",id:1}}},VerifyCustomAuthRequest:{fields:{username:{type:"string",id:1},password:{type:"string",id:2}}},VerifyCustomAuthResponse:{fields:{verified:{type:"bool",id:1}}},GetOrganizationIdRequest:{fields:{organizationName:{type:"string",id:1},subdomainName:{type:"string",id:2},domainName:{type:"string",id:3},userEmail:{type:"string",id:4}}},GetOrganizationIdResponse:{fields:{organizationId:{type:"int32",id:1}}},CreateDomainRequest:{fields:{organizationId:{type:"int32",id:1},domainName:{type:"string",id:2}}},DeleteDomainRequest:{fields:{organizationId:{type:"int32",id:1},domainId:{type:"int32",id:2}}},VerifyDomainRequest:{fields:{organizationId:{type:"int32",id:1},domainId:{type:"int32",id:2}}},GetDomainListRequest:{fields:{organizationId:{type:"int32",id:1}}},GetDomainListResponse:{fields:{domains:{rule:"repeated",type:"DomainDetails",id:1}}},GetDomainRequest:{fields:{organizationId:{type:"int32",id:1},domainId:{type:"int32",id:2}}},DomainDetails:{fields:{organizationId:{type:"int32",id:1},domainId:{type:"int32",id:2},domainName:{type:"string",id:3},verificationCode:{type:"string",id:4},verified:{type:"bool",id:5}}},ActivateUserRequest:{fields:{organizationId:{type:"int32",id:1}}},SendUserActivationEmailRequest:{fields:{organizationId:{type:"int32",id:1},userIds:{rule:"repeated",type:"int32",id:2}}},GetUserIdRequest:{fields:{email:{type:"string",id:1},createIfNotExists:{type:"bool",id:2}}},GetUserIdResponse:{fields:{userId:{type:"int32",id:1}}},GetUserDetailsRequest:{fields:{userId:{type:"int32",id:1}}}}},google:{nested:{protobuf:{nested:{Empty:{fields:{}},Duration:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}},Timestamp:{fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}}}},meeting:{options:{go_package:"github.com/Inkerz/jibbapis/sdk/go/meeting"},nested:{Participant:{fields:{id:{type:"int32",id:1},userId:{type:"int32",id:2},email:{type:"string",id:3}}},Update:{fields:{id:{type:"int32",id:1},userId:{type:"int32",id:2},email:{type:"string",id:3},title:{type:"string",id:4},image:{type:"bytes",id:5}}},Drawing:{fields:{id:{type:"int32",id:1},userId:{type:"int32",id:2},email:{type:"string",id:3},data:{type:"string",id:4}}},Pointer:{fields:{id:{type:"int32",id:1},userId:{type:"int32",id:2},email:{type:"string",id:3},x:{type:"int32",id:4},y:{type:"int32",id:5}}},Message:{oneofs:{event:{oneof:["join","leave","update","drawing","pointer"]}},fields:{join:{type:"Participant",id:1},leave:{type:"Participant",id:2},update:{type:"Update",id:3},drawing:{type:"Drawing",id:6},pointer:{type:"Pointer",id:7}}}}},cilix:{options:{go_package:"github.com/Inkerz/jibbapis/sdk/go/cilix"},nested:{CameraDescription:{fields:{id:{type:"string",id:1},name:{type:"string",id:2}}},StartRequest:{fields:{config:{type:"jibb.ipsa.v1.Config",id:2},runtimeConfig:{type:"jibb.ipsa.v1.RuntimeConfig",id:4},camera:{type:"CameraDescription",id:5},meetingToken:{type:"string",id:6}}},PreviewRequest:{fields:{source:{type:"CameraDescription",id:2}}},PreviewResponse:{fields:{image:{type:"bytes",id:1}}},GetCameraListResponse:{fields:{items:{rule:"repeated",type:"CameraDescription",id:1}}},GetClientStatusListResponse:{fields:{clients:{rule:"repeated",type:"types.ClientDetails",id:1}}},BusMessage:{oneofs:{messageType:{oneof:["clientConnected","clientDisconnected","tooManyPublishers","ipsaResponse","startRequest","stopRequest","newPageRequest","previewRequest","previewResponse","cameraListRequest","cameraListResponse","runtimeConfigRequest","clientStatusRequest","recordingStarted","recordingStopped","error"]}},fields:{clientConnected:{type:"google.protobuf.Empty",id:2},clientDisconnected:{type:"google.protobuf.Empty",id:3},tooManyPublishers:{type:"google.protobuf.Empty",id:4},ipsaResponse:{type:"jibb.ipsa.v1.Response",id:6},startRequest:{type:"StartRequest",id:50},stopRequest:{type:"google.protobuf.Empty",id:51},newPageRequest:{type:"google.protobuf.Empty",id:52},previewRequest:{type:"PreviewRequest",id:53},previewResponse:{type:"PreviewResponse",id:54},cameraListRequest:{type:"google.protobuf.Empty",id:55},cameraListResponse:{type:"GetCameraListResponse",id:56},runtimeConfigRequest:{type:"jibb.ipsa.v1.RuntimeConfig",id:57},clientStatusRequest:{type:"google.protobuf.Empty",id:58},recordingStarted:{type:"google.protobuf.Empty",id:59},recordingStopped:{type:"google.protobuf.Empty",id:60},error:{type:"types.Code",id:100},src:{type:"types.ClientDetails",id:30},dst:{type:"types.ClientDetails",id:31}}}}}});module.exports=$root;
package/ws/eventbus.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBusConnection=void 0,require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.array-buffer.slice.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");var _config=require("../config.js"),_index=require("../utils/logger/index.js"),_exceptions=require("../types/exceptions.js"),_retry_connection=require("./retry_connection.js"),_connection_base=require("./connection_base.js"),_types=require("../types/types.js"),_proto=require("../types/proto.js"),_auth=require("../api/auth.js");function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}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 _classPrivateMethodGet(a,b,c){if(!b.has(a))throw new TypeError("attempted to get private field on non-instance");return c}function _classPrivateFieldGet(a,b){var c=_classExtractFieldDescriptor(a,b,"get");return _classApplyDescriptorGet(a,c)}function _classApplyDescriptorGet(a,b){return b.get?b.get.call(a):b.value}function _classPrivateFieldSet(a,b,c){var d=_classExtractFieldDescriptor(a,b,"set");return _classApplyDescriptorSet(a,d,c),c}function _classExtractFieldDescriptor(a,b,c){if(!b.has(a))throw new TypeError("attempted to "+c+" private field on non-instance");return b.get(a)}function _classApplyDescriptorSet(a,b,c){if(b.set)b.set.call(a,c);else{if(!b.writable)throw new TypeError("attempted to set read only private field");b.value=c}}const ClientType=_proto.types.ClientType,ErrorCode=_proto.types.Code,BusMessage=_proto.cilix.BusMessage;function getClientNameByType(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}var _expiryTimer=/*#__PURE__*/new WeakMap,_handleMessage=/*#__PURE__*/new WeakSet;class WSConnection extends _retry_connection.RetryConnection{constructor(a,b){let c=getClientNameByType(a).toLowerCase();super("eventbus-".concat(c)),_classPrivateMethodInitSpec(this,_handleMessage),_classPrivateFieldInitSpec(this,_expiryTimer,{writable:!0,value:void 0}),this.clientType=a,this.socket=null,this.userToken=null,this.clientName=c,this.name=b,_classPrivateFieldSet(this,_expiryTimer,null)}async start(){this.userToken=await _auth.Auth.getUserToken(),this.userClaims=new _types.UserClaims(this.userToken);let a=this.userClaims.getSecondsUntilExpiry();return 0>=a?void this.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired"):void(_classPrivateFieldSet(this,_expiryTimer,setTimeout(()=>{this.stop(),this.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired")},a)),super.start())}async stop(){clearTimeout(_classPrivateFieldGet(this,_expiryTimer)),super.stop()}disconnect(){null!=this.socket&&(this.socket.close(),this.socket=null,_index.logger.info("eventbus disconnect ",this.clientName)),super.disconnect()}async write(a){await super.waitForConnection(),_index.logger.debug("".concat(this.getName(),".write: "),BusMessage.toObject(a));let b=BusMessage.encode(a).finish();this.socket.send(b)}writeObject(a){let b=BusMessage.verify(a);if(b)throw new Error(b);let c=BusMessage.fromObject(a);return this.write(c)}async connect(){if(this.getConnectionStatus()!=_connection_base.ConnectionStatus.DISCONNECTED)return;super.connect();let a=this;try{let b=new _types.UserClaims(this.userToken);if(b.isExpired())return void a.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired")}catch(b){return _index.logger.error(e),void a.onErrorMessage(ErrorCode.ERR_UNAUTHORIZED,"unauthorized")}let b=new URL(_config.Config.apiBaseURL),c="wss://".concat(b.hostname,"/ws/eventbus/").concat(this.clientName,"?user_token=").concat(this.userToken,"&name=").concat(this.name);this.socket=new WebSocket(c),this.socket.binaryType="arraybuffer",this.socket.addEventListener("open",()=>{a.onConnected()}),this.socket.addEventListener("close",()=>{a.onDisconnected()}),this.socket.addEventListener("message",b=>{_classPrivateMethodGet(a,_handleMessage,_handleMessage2).call(a,b.data)}),this.socket.addEventListener("error",b=>{a.onWarningMessage(ErrorCode.ERR_IO,b)})}onMessage(a){_index.logger.debug(a)}}async function _handleMessage2(a){try{if(a instanceof ArrayBuffer){let b=new Uint8Array(a),c=BusMessage.decode(b);return b=null,_index.logger.debug("".concat(this.getName(),".read: "),c),void this.onMessage(c)}}catch(a){_index.logger.error(a)}try{let b=JSON.parse(a);switch(b.code){case ErrorCode.ERR_TOO_MANY_CONNECTIONS:case ErrorCode.ERR_UNAUTHORIZED:case ErrorCode.ERR_BAD_REQUEST:case ErrorCode.ERR_TIMEOUT:this.onErrorMessage(b.code,b.reason);break;default:this.onInfoMessage(b.code,b.reason);}}catch(a){this.onWarningMessage(ErrorCode.ERR_IO,a)}}var _sendPreview=/*#__PURE__*/new WeakSet,_onCameraListRequest=/*#__PURE__*/new WeakSet,_onCameraListResponse=/*#__PURE__*/new WeakSet,_onClientConnected=/*#__PURE__*/new WeakSet,_onClientDisconnected=/*#__PURE__*/new WeakSet,_onRuntimeConfigRequest=/*#__PURE__*/new WeakSet,_onStopRequest=/*#__PURE__*/new WeakSet,_onPreviewRequest=/*#__PURE__*/new WeakSet,_onPreviewResponse=/*#__PURE__*/new WeakSet,_onStartRequest=/*#__PURE__*/new WeakSet,_onCornersReceived=/*#__PURE__*/new WeakSet,_onIPSAResponse=/*#__PURE__*/new WeakSet,_onTooManyPublishers=/*#__PURE__*/new WeakSet,_onRecordingStarted=/*#__PURE__*/new WeakSet,_onRecordingStopped=/*#__PURE__*/new WeakSet;class EventBusConnection extends WSConnection{static getInstance(){let a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:ClientType.WEBAPP,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",d=EventBusConnection.instances.get(a);return d||(d=new EventBusConnection(a,b),EventBusConnection.instances.set(a,d)),d}constructor(){let a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:ClientType.WEBAPP,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"";super(a,b),_classPrivateMethodInitSpec(this,_onRecordingStopped),_classPrivateMethodInitSpec(this,_onRecordingStarted),_classPrivateMethodInitSpec(this,_onTooManyPublishers),_classPrivateMethodInitSpec(this,_onIPSAResponse),_classPrivateMethodInitSpec(this,_onCornersReceived),_classPrivateMethodInitSpec(this,_onStartRequest),_classPrivateMethodInitSpec(this,_onPreviewResponse),_classPrivateMethodInitSpec(this,_onPreviewRequest),_classPrivateMethodInitSpec(this,_onStopRequest),_classPrivateMethodInitSpec(this,_onRuntimeConfigRequest),_classPrivateMethodInitSpec(this,_onClientDisconnected),_classPrivateMethodInitSpec(this,_onClientConnected),_classPrivateMethodInitSpec(this,_onCameraListResponse),_classPrivateMethodInitSpec(this,_onCameraListRequest),_classPrivateMethodInitSpec(this,_sendPreview)}async onMessage(a){if(a&&"object"==typeof a)try{a.clientConnected&&_classPrivateMethodGet(this,_onClientConnected,_onClientConnected2).call(this,a),a.clientDisconnected&&_classPrivateMethodGet(this,_onClientDisconnected,_onClientDisconnected2).call(this,a),a.cameraListRequest&&_classPrivateMethodGet(this,_onCameraListRequest,_onCameraListRequest2).call(this,a),a.cameraListResponse&&_classPrivateMethodGet(this,_onCameraListResponse,_onCameraListResponse2).call(this,a),a.runtimeConfigRequest&&_classPrivateMethodGet(this,_onRuntimeConfigRequest,_onRuntimeConfigRequest2).call(this,a),a.startRequest&&_classPrivateMethodGet(this,_onStartRequest,_onStartRequest2).call(this,a),a.stopRequest&&_classPrivateMethodGet(this,_onStopRequest,_onStopRequest2).call(this,a),a.previewRequest&&_classPrivateMethodGet(this,_onPreviewRequest,_onPreviewRequest2).call(this,a),a.previewResponse&&_classPrivateMethodGet(this,_onPreviewResponse,_onPreviewResponse2).call(this,a),a.ipsaResponse&&_classPrivateMethodGet(this,_onIPSAResponse,_onIPSAResponse2).call(this,a),a.tooManyPublishers&&_classPrivateMethodGet(this,_onTooManyPublishers,_onTooManyPublishers2).call(this,a),a.recordingStarted&&_classPrivateMethodGet(this,_onRecordingStarted,_onRecordingStarted2).call(this,a),a.recordingStopped&&_classPrivateMethodGet(this,_onRecordingStopped,_onRecordingStopped2).call(this,a)}catch(a){_index.logger.error(a)}}stopStream(a){return this.writeObject({stopRequest:{},dst:{id:a}})}stopAllStreams(){return this.writeObject({stopRequest:{}})}startStream(a){let{config:b,runtimeConfig:c,camera:d,sipUri:f,clientId:g}=a;return this.writeObject({startRequest:{config:b,runtimeConfig:c,camera:d,sipUri:f},dst:{id:g}})}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.write({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;function _sendPreview2(a,b){return this.write({previewResponse:{image:a},dst:b})}async function _onCameraListRequest2(a){let b=await this.callSubscribers("onCameraListRequest",a.cameraListRequest);this.sendCameraList(b,a.dst,a.src)}function _onCameraListResponse2(a){this.notify("onCameraListResponse",a.cameraListResponse)}function _onClientConnected2(a){_index.logger.info("".concat(this.getName(),": client connected: "),a.src),this.notify("onClientConnected",a.src)}function _onClientDisconnected2(a){_index.logger.warn("".concat(this.getName(),": client disconnected: "),a.src),this.notify("onClientDisconnected",a.src)}function _onRuntimeConfigRequest2(a){this.notify("onRuntimeConfigRequest",a.runtimeConfigRequest)}function _onStopRequest2(a){this.notify("onStopRequest",a.stopRequest)}async function _onPreviewRequest2(a){let b=await this.callSubscribers("onPreviewRequest",a.previewRequest);_classPrivateMethodGet(this,_sendPreview,_sendPreview2).call(this,b,a.src)}function _onPreviewResponse2(a){this.notify("onPreviewResponse",a.previewResponse)}function _onStartRequest2(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&&d.sipUri||null===d||void 0===d||null===(c=d.inputSource)||void 0===c||!c.id||(d.camera={id:d.inputSource.id}),this.notify("onStartRequest",d)}function _onCornersReceived2(a){this.notify("onCornersReceived",a.corners.corners)}function _onIPSAResponse2(a){a&&this.notify("onIPSAResponse",a.ipsaResponse)}function _onTooManyPublishers2(a){this.notify("onTooManyPublishers",a.tooManyPublishers)}function _onRecordingStarted2(a){this.notify("onRecordingStarted",a.recordingStarted)}function _onRecordingStopped2(a){this.notify("onRecordingStopped",a.recordingStopped)}_defineProperty(EventBusConnection,"instances",new Map);
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBusConnection=void 0,require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.array-buffer.slice.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");var _config=require("../config.js"),_index=require("../utils/logger/index.js"),_exceptions=require("../types/exceptions.js"),_retry_connection=require("./retry_connection.js"),_connection_base=require("./connection_base.js"),_types=require("../types/types.js"),_proto=require("../types/proto.js"),_auth=require("../api/auth.js");function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}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 _classPrivateMethodGet(a,b,c){if(!b.has(a))throw new TypeError("attempted to get private field on non-instance");return c}function _classPrivateFieldGet(a,b){var c=_classExtractFieldDescriptor(a,b,"get");return _classApplyDescriptorGet(a,c)}function _classApplyDescriptorGet(a,b){return b.get?b.get.call(a):b.value}function _classPrivateFieldSet(a,b,c){var d=_classExtractFieldDescriptor(a,b,"set");return _classApplyDescriptorSet(a,d,c),c}function _classExtractFieldDescriptor(a,b,c){if(!b.has(a))throw new TypeError("attempted to "+c+" private field on non-instance");return b.get(a)}function _classApplyDescriptorSet(a,b,c){if(b.set)b.set.call(a,c);else{if(!b.writable)throw new TypeError("attempted to set read only private field");b.value=c}}const ClientType=_proto.types.ClientType,ErrorCode=_proto.types.Code,BusMessage=_proto.cilix.BusMessage;function getClientNameByType(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}var _expiryTimer=/*#__PURE__*/new WeakMap,_handleMessage=/*#__PURE__*/new WeakSet;class WSConnection extends _retry_connection.RetryConnection{constructor(a,b){let c=getClientNameByType(a).toLowerCase();super("eventbus-".concat(c)),_classPrivateMethodInitSpec(this,_handleMessage),_classPrivateFieldInitSpec(this,_expiryTimer,{writable:!0,value:void 0}),this.clientType=a,this.socket=null,this.userToken=null,this.clientName=c,this.name=b,_classPrivateFieldSet(this,_expiryTimer,null)}async start(){this.userToken=await _auth.Auth.getUserToken(),this.userClaims=new _types.UserClaims(this.userToken);let a=this.userClaims.getSecondsUntilExpiry();return 0>=a?void this.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired"):void(_classPrivateFieldSet(this,_expiryTimer,setTimeout(()=>{this.stop(),this.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired")},a)),super.start())}async stop(){clearTimeout(_classPrivateFieldGet(this,_expiryTimer)),super.stop()}disconnect(){null!=this.socket&&(this.socket.close(),this.socket=null,_index.logger.info("eventbus disconnect ",this.clientName)),super.disconnect()}async write(a){await super.waitForConnection(),_index.logger.debug("".concat(this.getName(),".write: "),BusMessage.toObject(a));let b=BusMessage.encode(a).finish();this.socket.send(b)}writeObject(a){let b=BusMessage.verify(a);if(b)throw new Error(b);let c=BusMessage.fromObject(a);return this.write(c)}async connect(){if(this.getConnectionStatus()!=_connection_base.ConnectionStatus.DISCONNECTED)return;super.connect();let a=this;try{let b=new _types.UserClaims(this.userToken);if(b.isExpired())return void a.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired")}catch(b){return _index.logger.error(e),void a.onErrorMessage(ErrorCode.ERR_UNAUTHORIZED,"unauthorized")}let b=new URL(_config.Config.apiBaseURL),c="wss://".concat(b.hostname,"/ws/eventbus/").concat(this.clientName,"?user_token=").concat(this.userToken,"&name=").concat(this.name);this.socket=new WebSocket(c),this.socket.binaryType="arraybuffer",this.socket.addEventListener("open",()=>{a.onConnected()}),this.socket.addEventListener("close",()=>{a.onDisconnected()}),this.socket.addEventListener("message",b=>{_classPrivateMethodGet(a,_handleMessage,_handleMessage2).call(a,b.data)}),this.socket.addEventListener("error",b=>{a.onWarningMessage(ErrorCode.ERR_IO,b)})}onMessage(a){_index.logger.debug(a)}}async function _handleMessage2(a){try{if(a instanceof ArrayBuffer){let b=new Uint8Array(a),c=BusMessage.decode(b);return b=null,_index.logger.debug("".concat(this.getName(),".read: "),c),void this.onMessage(c)}}catch(a){_index.logger.error(a)}try{let b=JSON.parse(a);switch(b.code){case ErrorCode.ERR_TOO_MANY_CONNECTIONS:case ErrorCode.ERR_UNAUTHORIZED:case ErrorCode.ERR_BAD_REQUEST:case ErrorCode.ERR_TIMEOUT:this.onErrorMessage(b.code,b.reason);break;default:this.onInfoMessage(b.code,b.reason);}}catch(a){this.onWarningMessage(ErrorCode.ERR_IO,a)}}var _sendPreview=/*#__PURE__*/new WeakSet,_onCameraListRequest=/*#__PURE__*/new WeakSet,_onCameraListResponse=/*#__PURE__*/new WeakSet,_onClientConnected=/*#__PURE__*/new WeakSet,_onClientDisconnected=/*#__PURE__*/new WeakSet,_onRuntimeConfigRequest=/*#__PURE__*/new WeakSet,_onStopRequest=/*#__PURE__*/new WeakSet,_onPreviewRequest=/*#__PURE__*/new WeakSet,_onPreviewResponse=/*#__PURE__*/new WeakSet,_onStartRequest=/*#__PURE__*/new WeakSet,_onCornersReceived=/*#__PURE__*/new WeakSet,_onIPSAResponse=/*#__PURE__*/new WeakSet,_onTooManyPublishers=/*#__PURE__*/new WeakSet,_onRecordingStarted=/*#__PURE__*/new WeakSet,_onRecordingStopped=/*#__PURE__*/new WeakSet;class EventBusConnection extends WSConnection{static getInstance(){let a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:ClientType.WEBAPP,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"",d=EventBusConnection.instances.get(a);return d||(d=new EventBusConnection(a,b),EventBusConnection.instances.set(a,d)),d}constructor(){let a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:ClientType.WEBAPP,b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:"";super(a,b),_classPrivateMethodInitSpec(this,_onRecordingStopped),_classPrivateMethodInitSpec(this,_onRecordingStarted),_classPrivateMethodInitSpec(this,_onTooManyPublishers),_classPrivateMethodInitSpec(this,_onIPSAResponse),_classPrivateMethodInitSpec(this,_onCornersReceived),_classPrivateMethodInitSpec(this,_onStartRequest),_classPrivateMethodInitSpec(this,_onPreviewResponse),_classPrivateMethodInitSpec(this,_onPreviewRequest),_classPrivateMethodInitSpec(this,_onStopRequest),_classPrivateMethodInitSpec(this,_onRuntimeConfigRequest),_classPrivateMethodInitSpec(this,_onClientDisconnected),_classPrivateMethodInitSpec(this,_onClientConnected),_classPrivateMethodInitSpec(this,_onCameraListResponse),_classPrivateMethodInitSpec(this,_onCameraListRequest),_classPrivateMethodInitSpec(this,_sendPreview)}async onMessage(a){if(a&&"object"==typeof a)try{a.clientConnected&&_classPrivateMethodGet(this,_onClientConnected,_onClientConnected2).call(this,a),a.clientDisconnected&&_classPrivateMethodGet(this,_onClientDisconnected,_onClientDisconnected2).call(this,a),a.cameraListRequest&&_classPrivateMethodGet(this,_onCameraListRequest,_onCameraListRequest2).call(this,a),a.cameraListResponse&&_classPrivateMethodGet(this,_onCameraListResponse,_onCameraListResponse2).call(this,a),a.runtimeConfigRequest&&_classPrivateMethodGet(this,_onRuntimeConfigRequest,_onRuntimeConfigRequest2).call(this,a),a.startRequest&&_classPrivateMethodGet(this,_onStartRequest,_onStartRequest2).call(this,a),a.stopRequest&&_classPrivateMethodGet(this,_onStopRequest,_onStopRequest2).call(this,a),a.previewRequest&&_classPrivateMethodGet(this,_onPreviewRequest,_onPreviewRequest2).call(this,a),a.previewResponse&&_classPrivateMethodGet(this,_onPreviewResponse,_onPreviewResponse2).call(this,a),a.ipsaResponse&&_classPrivateMethodGet(this,_onIPSAResponse,_onIPSAResponse2).call(this,a),a.tooManyPublishers&&_classPrivateMethodGet(this,_onTooManyPublishers,_onTooManyPublishers2).call(this,a),a.recordingStarted&&_classPrivateMethodGet(this,_onRecordingStarted,_onRecordingStarted2).call(this,a),a.recordingStopped&&_classPrivateMethodGet(this,_onRecordingStopped,_onRecordingStopped2).call(this,a)}catch(a){_index.logger.error(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:f,meetingToken:g}=a;return this.writeObject({startRequest:{config:b,runtimeConfig:c,camera:d,meetingToken:g},dst:{id:f}})}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.write({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;function _sendPreview2(a,b){return this.write({previewResponse:{image:a},dst:b})}async function _onCameraListRequest2(a){let b=await this.callSubscribers("onCameraListRequest",a.cameraListRequest);this.sendCameraList(b,a.dst,a.src)}function _onCameraListResponse2(a){this.notify("onCameraListResponse",a.cameraListResponse)}function _onClientConnected2(a){_index.logger.info("".concat(this.getName(),": client connected: "),a.src),this.notify("onClientConnected",a.src)}function _onClientDisconnected2(a){_index.logger.warn("".concat(this.getName(),": client disconnected: "),a.src),this.notify("onClientDisconnected",a.src)}function _onRuntimeConfigRequest2(a){this.notify("onRuntimeConfigRequest",a.runtimeConfigRequest)}function _onStopRequest2(a){this.notify("onStopRequest",a.stopRequest)}async function _onPreviewRequest2(a){let b=await this.callSubscribers("onPreviewRequest",a.previewRequest);_classPrivateMethodGet(this,_sendPreview,_sendPreview2).call(this,b,a.src)}function _onPreviewResponse2(a){this.notify("onPreviewResponse",a.previewResponse)}function _onStartRequest2(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}),this.notify("onStartRequest",d)}function _onCornersReceived2(a){this.notify("onCornersReceived",a.corners.corners)}function _onIPSAResponse2(a){a&&this.notify("onIPSAResponse",a.ipsaResponse)}function _onTooManyPublishers2(a){this.notify("onTooManyPublishers",a.tooManyPublishers)}function _onRecordingStarted2(a){this.notify("onRecordingStarted",a.recordingStarted)}function _onRecordingStopped2(a){this.notify("onRecordingStopped",a.recordingStopped)}_defineProperty(EventBusConnection,"instances",new Map);
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.promise.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/es.array.reduce.js"),require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.array-buffer.slice.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");var _config=require("../config.js"),_index=require("../utils/logger/index.js"),_retry_connection=require("./retry_connection.js"),_connection_base=require("./connection_base.js"),_types=require("../types/types.js"),_proto=require("../types/proto.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(a,b){var c=_classExtractFieldDescriptor(a,b,"get");return _classApplyDescriptorGet(a,c)}function _classApplyDescriptorGet(a,b){return b.get?b.get.call(a):b.value}function _classPrivateMethodGet(a,b,c){if(!b.has(a))throw new TypeError("attempted to get private field on non-instance");return c}function _classPrivateFieldSet(a,b,c){var d=_classExtractFieldDescriptor(a,b,"set");return _classApplyDescriptorSet(a,d,c),c}function _classExtractFieldDescriptor(a,b,c){if(!b.has(a))throw new TypeError("attempted to "+c+" private field on non-instance");return b.get(a)}function _classApplyDescriptorSet(a,b,c){if(b.set)b.set.call(a,c);else{if(!b.writable)throw new TypeError("attempted to set read only private field");b.value=c}}const ErrorCode=_proto.types.Code;var _expiryTimer=/*#__PURE__*/new WeakMap,_clear=/*#__PURE__*/new WeakSet,_write=/*#__PURE__*/new WeakSet,_handleMessage=/*#__PURE__*/new WeakSet,_onResponse=/*#__PURE__*/new WeakSet,_writeInputImage=/*#__PURE__*/new WeakSet,_setConfig=/*#__PURE__*/new WeakSet;class IPSAClass extends _retry_connection.RetryConnection{constructor(){super("ipsa"),_classPrivateMethodInitSpec(this,_setConfig),_classPrivateMethodInitSpec(this,_writeInputImage),_classPrivateMethodInitSpec(this,_onResponse),_classPrivateMethodInitSpec(this,_handleMessage),_classPrivateMethodInitSpec(this,_write),_classPrivateMethodInitSpec(this,_clear),_classPrivateFieldInitSpec(this,_expiryTimer,{writable:!0,value:void 0}),this.socket=null,this.onInputImage=null,this.onError=null,this.onResponse=null,this.userToken=null,_classPrivateFieldSet(this,_expiryTimer,null),_classPrivateMethodGet(this,_clear,_clear2).call(this),this.meetingId=null}start(a){let{userToken:b,request:c,onInputImage:d,onError:e,onResponse:f}=a;if(!this.isStarted()){let a=new _types.MeetingClaims(c.config.meetingToken);this.setRuntimeConfig(c.runtimeConfig),_classPrivateMethodGet(this,_setConfig,_setConfig2).call(this,c.config),this.onInputImage=d,this.onError=e,this.onResponse=f,this.userToken=b,this.meetingId=a.meetindId;let g=new _types.UserClaims(this.userToken),h=Math.min(g.getSecondsUntilExpiry(),a.getSecondsUntilExpiry());if(0>=h)return void this.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired");_classPrivateFieldSet(this,_expiryTimer,setTimeout(()=>{this.stop(),this.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired")},h))}super.start()}stop(){clearTimeout(_classPrivateFieldGet(this,_expiryTimer)),_classPrivateMethodGet(this,_clear,_clear2).call(this),super.stop()}disconnect(){super.disconnect(),null!=this.socket&&(this.socket.close(),this.socket=null)}async connect(){if(this.getConnectionStatus()!=_connection_base.ConnectionStatus.DISCONNECTED)return;super.connect();let a=this.configRequest.config.meetingToken,b=this.meetingId;try{let a=new _types.UserClaims(this.userToken);if(a.isExpired())return void this.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired")}catch(a){return void this.onErrorMessage(ErrorCode.ERR_UNAUTHORIZED,"unauthorized")}_index.logger.info("Connecting IPSA to meeting ".concat(b,"..."));let c=new URL(_config.Config.apiBaseURL),d="wss://".concat(c.hostname,"/ws/ipsa/").concat(b,"?user_token=").concat(this.userToken,"&meeting_token=").concat(a);this.socket=new WebSocket(d),this.socket.binaryType="arraybuffer",this.socket.addEventListener("open",async()=>{try{await _classPrivateMethodGet(this,_write,_write2).call(this,this.configRequest),await _classPrivateMethodGet(this,_write,_write2).call(this,this.runtimeConfigRequest),this.onConnected()}catch(a){return this.onWarningMessage(ErrorCode.ERR_IO,a),void this.disconnect()}let a=()=>{this.isConnected()&&this.isStarted()&&(0<this.socket.bufferedAmount?(_index.logger.warn("ipsa: low internet speed connection"),setTimeout(a,100)):(setTimeout(a,500),_classPrivateMethodGet(this,_writeInputImage,_writeInputImage2).call(this).catch(a=>_index.logger.error(a))))};a()}),this.socket.addEventListener("close",()=>{this.onDisconnected()}),this.socket.addEventListener("message",a=>{_classPrivateMethodGet(this,_handleMessage,_handleMessage2).call(this,a.data)}),this.socket.addEventListener("error",a=>{this.onWarningMessage(ErrorCode.ERR_IO,a)})}getAverageResponseTime(){let a=NaN;try{let b=Array.from(this.stats.values()).map(a=>a.responseTime-a.requestTime).filter(a=>!isNaN(a)),c=b.reduce((c,a)=>c+a);a=c/b.length}catch(a){}return a}setRuntimeConfig(a){let b=_proto.ipsa.Request.create({runtimeConfig:a});this.runtimeConfigRequest=b,this.isConnected()&&_classPrivateMethodGet(this,_write,_write2).call(this,b)}}function _clear2(){this.configRequest=null,this.runtimeConfigRequest=null,this.stats=new Map,this.requestId=0}async function _write2(a){let b=_proto.ipsa.Request.verify(a);if(b)throw new Error("invalid message: "+b);if(a){let b=_proto.ipsa.Request.encode(a).finish();this.socket.send(b)}}async function _handleMessage2(a){var b,c,d,e;try{if(a instanceof ArrayBuffer){let b=new Uint8Array(a),c=_proto.ipsa.Response.decode(b);return void _classPrivateMethodGet(this,_onResponse,_onResponse2).call(this,c)}}catch(a){_index.logger.error(a)}try{switch(a=JSON.parse(a),a.code){case ErrorCode.ERR_TOO_MANY_CONNECTIONS:case ErrorCode.ERR_UNAUTHORIZED:case ErrorCode.ERR_BAD_REQUEST:this.onErrorMessage(null===(b=a)||void 0===b?void 0:b.code,null===(c=a)||void 0===c?void 0:c.reason),this.stop();break;default:this.onInfoMessage(null===(d=a)||void 0===d?void 0:d.code,null===(e=a)||void 0===e?void 0:e.reason);}}catch(a){this.onWarningMessage(ErrorCode.ERR_IO,a)}}function _onResponse2(a){if(100<=a.id){let b=a.id-100,c=this.stats.get(b)||{};c.responseTime=performance.now(),this.stats.set(b,c)}this.onResponse&&this.onResponse(a)}async function _writeInputImage2(){let a=await this.onInputImage();this.requestId=(this.requestId+1)%8,this.stats.set(this.requestId,{requestTime:performance.now()});let b=_proto.ipsa.Request.create({id:this.requestId+100,ipsa:{data:a}});_classPrivateMethodGet(this,_write,_write2).call(this,b)}function _setConfig2(a){let b=_proto.ipsa.Request.create({config:a});this.configRequest=b,this.isConnected()&&_classPrivateMethodGet(this,_write,_write2).call(this,b)}let IPSA=new IPSAClass;exports.IPSA=IPSA;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.IPSA=void 0,require("core-js/modules/es.promise.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/es.array.reduce.js"),require("core-js/modules/es.array-buffer.constructor.js"),require("core-js/modules/es.array-buffer.slice.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");var _config=require("../config.js"),_index=require("../utils/logger/index.js"),_retry_connection=require("./retry_connection.js"),_connection_base=require("./connection_base.js"),_types=require("../types/types.js"),_proto=require("../types/proto.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(a,b){var c=_classExtractFieldDescriptor(a,b,"get");return _classApplyDescriptorGet(a,c)}function _classApplyDescriptorGet(a,b){return b.get?b.get.call(a):b.value}function _classPrivateMethodGet(a,b,c){if(!b.has(a))throw new TypeError("attempted to get private field on non-instance");return c}function _classPrivateFieldSet(a,b,c){var d=_classExtractFieldDescriptor(a,b,"set");return _classApplyDescriptorSet(a,d,c),c}function _classExtractFieldDescriptor(a,b,c){if(!b.has(a))throw new TypeError("attempted to "+c+" private field on non-instance");return b.get(a)}function _classApplyDescriptorSet(a,b,c){if(b.set)b.set.call(a,c);else{if(!b.writable)throw new TypeError("attempted to set read only private field");b.value=c}}const ErrorCode=_proto.types.Code;var _expiryTimer=/*#__PURE__*/new WeakMap,_clear=/*#__PURE__*/new WeakSet,_write=/*#__PURE__*/new WeakSet,_handleMessage=/*#__PURE__*/new WeakSet,_onResponse=/*#__PURE__*/new WeakSet,_writeInputImage=/*#__PURE__*/new WeakSet,_setConfig=/*#__PURE__*/new WeakSet;class IPSAClass extends _retry_connection.RetryConnection{constructor(){super("ipsa"),_classPrivateMethodInitSpec(this,_setConfig),_classPrivateMethodInitSpec(this,_writeInputImage),_classPrivateMethodInitSpec(this,_onResponse),_classPrivateMethodInitSpec(this,_handleMessage),_classPrivateMethodInitSpec(this,_write),_classPrivateMethodInitSpec(this,_clear),_classPrivateFieldInitSpec(this,_expiryTimer,{writable:!0,value:void 0}),this.socket=null,this.onInputImage=null,this.onError=null,this.onResponse=null,this.userToken=null,_classPrivateFieldSet(this,_expiryTimer,null),_classPrivateMethodGet(this,_clear,_clear2).call(this),this.meetingId=null,this.meetingToken=null}start(a){let{meetingToken:b,userToken:c,request:d,onInputImage:e,onError:f,onResponse:g}=a;if(!this.isStarted()){let a=new _types.MeetingClaims(b);this.setRuntimeConfig(d.runtimeConfig),_classPrivateMethodGet(this,_setConfig,_setConfig2).call(this,d.config),this.onInputImage=e,this.onError=f,this.onResponse=g,this.userToken=c,this.meetingToken=b,this.meetingId=a.meetindId;let h=new _types.UserClaims(this.userToken),i=Math.min(h.getSecondsUntilExpiry(),a.getSecondsUntilExpiry());if(0>=i)return void this.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired");_classPrivateFieldSet(this,_expiryTimer,setTimeout(()=>{this.stop(),this.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired")},i))}super.start()}stop(){clearTimeout(_classPrivateFieldGet(this,_expiryTimer)),_classPrivateMethodGet(this,_clear,_clear2).call(this),super.stop()}disconnect(){super.disconnect(),null!=this.socket&&(this.socket.close(),this.socket=null)}async connect(){if(this.getConnectionStatus()!=_connection_base.ConnectionStatus.DISCONNECTED)return;super.connect();let a=this.meetingToken,b=this.meetingId;try{let a=new _types.UserClaims(this.userToken);if(a.isExpired())return void this.onErrorMessage(ErrorCode.ERR_TIMEOUT,"token expired")}catch(a){return void this.onErrorMessage(ErrorCode.ERR_UNAUTHORIZED,"unauthorized")}_index.logger.info("Connecting IPSA to meeting ".concat(b,"..."));let c=new URL(_config.Config.apiBaseURL),d="wss://".concat(c.hostname,"/ws/ipsa/").concat(b,"?user_token=").concat(this.userToken,"&meeting_token=").concat(a);this.socket=new WebSocket(d),this.socket.binaryType="arraybuffer",this.socket.addEventListener("open",async()=>{try{await _classPrivateMethodGet(this,_write,_write2).call(this,this.configRequest),await _classPrivateMethodGet(this,_write,_write2).call(this,this.runtimeConfigRequest),this.onConnected()}catch(a){return this.onWarningMessage(ErrorCode.ERR_IO,a),void this.disconnect()}let a=()=>{this.isConnected()&&this.isStarted()&&(0<this.socket.bufferedAmount?(_index.logger.warn("ipsa: low internet speed connection"),setTimeout(a,100)):(setTimeout(a,500),_classPrivateMethodGet(this,_writeInputImage,_writeInputImage2).call(this).catch(a=>_index.logger.error(a))))};a()}),this.socket.addEventListener("close",()=>{this.onDisconnected()}),this.socket.addEventListener("message",a=>{_classPrivateMethodGet(this,_handleMessage,_handleMessage2).call(this,a.data)}),this.socket.addEventListener("error",a=>{this.onWarningMessage(ErrorCode.ERR_IO,a)})}getAverageResponseTime(){let a=NaN;try{let b=Array.from(this.stats.values()).map(a=>a.responseTime-a.requestTime).filter(a=>!isNaN(a)),c=b.reduce((c,a)=>c+a);a=c/b.length}catch(a){}return a}setRuntimeConfig(a){let b=_proto.ipsa.Request.create({runtimeConfig:a});this.runtimeConfigRequest=b,this.isConnected()&&_classPrivateMethodGet(this,_write,_write2).call(this,b)}}function _clear2(){this.configRequest=null,this.runtimeConfigRequest=null,this.stats=new Map,this.requestId=0}async function _write2(a){let b=_proto.ipsa.Request.verify(a);if(b)throw new Error("invalid message: "+b);if(a){let b=_proto.ipsa.Request.encode(a).finish();this.socket.send(b)}}async function _handleMessage2(a){var b,c,d,e;try{if(a instanceof ArrayBuffer){let b=new Uint8Array(a),c=_proto.ipsa.Response.decode(b);return void _classPrivateMethodGet(this,_onResponse,_onResponse2).call(this,c)}}catch(a){_index.logger.error(a)}try{switch(a=JSON.parse(a),a.code){case ErrorCode.ERR_TOO_MANY_CONNECTIONS:case ErrorCode.ERR_UNAUTHORIZED:case ErrorCode.ERR_BAD_REQUEST:this.onErrorMessage(null===(b=a)||void 0===b?void 0:b.code,null===(c=a)||void 0===c?void 0:c.reason),this.stop();break;default:this.onInfoMessage(null===(d=a)||void 0===d?void 0:d.code,null===(e=a)||void 0===e?void 0:e.reason);}}catch(a){this.onWarningMessage(ErrorCode.ERR_IO,a)}}function _onResponse2(a){if(100<=a.id){let b=a.id-100,c=this.stats.get(b)||{};c.responseTime=performance.now(),this.stats.set(b,c)}this.onResponse&&this.onResponse(a)}async function _writeInputImage2(){let a=await this.onInputImage();this.requestId=(this.requestId+1)%8,this.stats.set(this.requestId,{requestTime:performance.now()});let b=_proto.ipsa.Request.create({id:this.requestId+100,ipsa:{data:a}});_classPrivateMethodGet(this,_write,_write2).call(this,b)}function _setConfig2(a){let b=_proto.ipsa.Request.create({config:a});this.configRequest=b,this.isConnected()&&_classPrivateMethodGet(this,_write,_write2).call(this,b)}let IPSA=new IPSAClass;exports.IPSA=IPSA;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PostProcessing=void 0,require("core-js/modules/es.promise.js");var _config=require("./config.js"),_auth=require("./auth.js"),_index=_interopRequireDefault(require("../http/index.js"));function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}class PostProcessing{async createPDFNotes(a){let b=1<arguments.length&&arguments[1]!==void 0?arguments[1]:void 0,c={"Content-Type":"application/json",Accept:"application/json","x-jibb-user-jwt":await _auth.Auth.getUserToken()},d={config:{surfaceType:"WHITEBOARD"},runtimeConfig:{enable_estimation:!0,fixed_corners:!0,flip_up_down:!1,flip_left_right:!1,rotation:"RATATE_0",enableColor:!1},sourceUrl:a};b&&(d.runtimeConfig.customCorners=b);let e=await _index.default.post("".concat(_config.Config.apiBaseURL,"/v1/ipsa-post-processing/run"),d,{headers:c});return e.data}}exports.PostProcessing=PostProcessing;