@vertexvis/stream-api 0.24.3-canary.1 → 0.24.3-canary.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.
@@ -48842,6 +48842,119 @@ function parseEpochMillis(millis) {
48842
48842
  return { seconds: seconds * (millis < 0 ? -1 : 1), nanos: nanos };
48843
48843
  }
48844
48844
 
48845
+ function validateBoundingBox(boundingBox) {
48846
+ var boundingBoxXMaxValid = (boundingBox === null || boundingBox === void 0 ? void 0 : boundingBox.xmax) != null && Number.isFinite(boundingBox.xmax);
48847
+ var boundingBoxXMinValid = (boundingBox === null || boundingBox === void 0 ? void 0 : boundingBox.xmin) != null && Number.isFinite(boundingBox.xmin);
48848
+ var boundingBoxYMaxValid = (boundingBox === null || boundingBox === void 0 ? void 0 : boundingBox.ymax) != null && Number.isFinite(boundingBox.ymax);
48849
+ var boundingBoxYMinValid = (boundingBox === null || boundingBox === void 0 ? void 0 : boundingBox.ymin) != null && Number.isFinite(boundingBox.ymin);
48850
+ var boundingBoxZMaxValid = (boundingBox === null || boundingBox === void 0 ? void 0 : boundingBox.zmax) != null && Number.isFinite(boundingBox.zmax);
48851
+ var boundingBoxZMinValid = (boundingBox === null || boundingBox === void 0 ? void 0 : boundingBox.zmin) != null && Number.isFinite(boundingBox.zmin);
48852
+ return (boundingBoxXMaxValid &&
48853
+ boundingBoxXMinValid &&
48854
+ boundingBoxYMaxValid &&
48855
+ boundingBoxYMinValid &&
48856
+ boundingBoxZMaxValid &&
48857
+ boundingBoxZMinValid);
48858
+ }
48859
+ function validateCamera(camera) {
48860
+ // If a perspective camera is provided, verify it is valid
48861
+ if (camera.perspective != null) {
48862
+ var perspectiveCameraIsValid = validatePerspectiveCamera(camera.perspective);
48863
+ return perspectiveCameraIsValid;
48864
+ }
48865
+ // If an orthographic camera is provided, verify it is valid
48866
+ if (camera.orthographic != null) {
48867
+ var orthographicCameraIsValid = validateOrthographicCamera(camera.orthographic);
48868
+ return orthographicCameraIsValid;
48869
+ }
48870
+ return false;
48871
+ }
48872
+ function validatePerspectiveCamera(camera) {
48873
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
48874
+ var lookAtXValid = ((_a = camera.lookAt) === null || _a === void 0 ? void 0 : _a.x) != null && Number.isFinite(camera.lookAt.x);
48875
+ var lookAtYValid = ((_b = camera.lookAt) === null || _b === void 0 ? void 0 : _b.y) != null && Number.isFinite(camera.lookAt.y);
48876
+ var lookAtZValid = ((_c = camera.lookAt) === null || _c === void 0 ? void 0 : _c.z) != null && Number.isFinite(camera.lookAt.z);
48877
+ var positionXValid = ((_d = camera.position) === null || _d === void 0 ? void 0 : _d.x) != null && Number.isFinite(camera.position.x);
48878
+ var positionYValid = ((_e = camera.position) === null || _e === void 0 ? void 0 : _e.y) != null && Number.isFinite(camera.position.y);
48879
+ var positionZValid = ((_f = camera.position) === null || _f === void 0 ? void 0 : _f.z) != null && Number.isFinite(camera.position.z);
48880
+ var upXValid = ((_g = camera.up) === null || _g === void 0 ? void 0 : _g.x) != null && Number.isFinite(camera.up.x);
48881
+ var upYValid = ((_h = camera.up) === null || _h === void 0 ? void 0 : _h.y) != null && Number.isFinite(camera.up.y);
48882
+ var upZValid = ((_j = camera.up) === null || _j === void 0 ? void 0 : _j.z) != null && Number.isFinite(camera.up.z);
48883
+ // Validate up vector has non-zero length
48884
+ var upVectorValid = validateVector({ x: (_k = camera === null || camera === void 0 ? void 0 : camera.up) === null || _k === void 0 ? void 0 : _k.x, y: (_l = camera === null || camera === void 0 ? void 0 : camera.up) === null || _l === void 0 ? void 0 : _l.y, z: (_m = camera === null || camera === void 0 ? void 0 : camera.up) === null || _m === void 0 ? void 0 : _m.z }, true);
48885
+ return (lookAtXValid &&
48886
+ lookAtYValid &&
48887
+ lookAtZValid &&
48888
+ positionXValid &&
48889
+ positionYValid &&
48890
+ positionZValid &&
48891
+ upXValid &&
48892
+ upYValid &&
48893
+ upZValid &&
48894
+ upVectorValid);
48895
+ }
48896
+ function validateOrthographicCamera(camera) {
48897
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
48898
+ var fovHeightValid = camera.fovHeight != null && Number.isFinite(camera.fovHeight);
48899
+ var lookAtXValid = ((_a = camera.lookAt) === null || _a === void 0 ? void 0 : _a.x) != null && Number.isFinite(camera.lookAt.x);
48900
+ var lookAtYValid = ((_b = camera.lookAt) === null || _b === void 0 ? void 0 : _b.y) != null && Number.isFinite(camera.lookAt.y);
48901
+ var lookAtZValid = ((_c = camera.lookAt) === null || _c === void 0 ? void 0 : _c.z) != null && Number.isFinite(camera.lookAt.z);
48902
+ var upXValid = ((_d = camera.up) === null || _d === void 0 ? void 0 : _d.x) != null && Number.isFinite(camera.up.x);
48903
+ var upYValid = ((_e = camera.up) === null || _e === void 0 ? void 0 : _e.y) != null && Number.isFinite(camera.up.y);
48904
+ var upZValid = ((_f = camera.up) === null || _f === void 0 ? void 0 : _f.z) != null && Number.isFinite(camera.up.z);
48905
+ var viewVectorXValid = ((_g = camera.viewVector) === null || _g === void 0 ? void 0 : _g.x) != null && Number.isFinite(camera.viewVector.x);
48906
+ var viewVectorYValid = ((_h = camera.viewVector) === null || _h === void 0 ? void 0 : _h.y) != null && Number.isFinite(camera.viewVector.y);
48907
+ var viewVectorZValid = ((_j = camera.viewVector) === null || _j === void 0 ? void 0 : _j.z) != null && Number.isFinite(camera.viewVector.z);
48908
+ // Validate up vector has non-zero length
48909
+ var upVectorValid = validateVector({ x: (_k = camera === null || camera === void 0 ? void 0 : camera.up) === null || _k === void 0 ? void 0 : _k.x, y: (_l = camera === null || camera === void 0 ? void 0 : camera.up) === null || _l === void 0 ? void 0 : _l.y, z: (_m = camera === null || camera === void 0 ? void 0 : camera.up) === null || _m === void 0 ? void 0 : _m.z }, true);
48910
+ return (fovHeightValid &&
48911
+ lookAtXValid &&
48912
+ lookAtYValid &&
48913
+ lookAtZValid &&
48914
+ viewVectorXValid &&
48915
+ viewVectorYValid &&
48916
+ viewVectorZValid &&
48917
+ upXValid &&
48918
+ upYValid &&
48919
+ upZValid &&
48920
+ upVectorValid);
48921
+ }
48922
+ function validateDimensions(dimensions) {
48923
+ var heightValid = (dimensions === null || dimensions === void 0 ? void 0 : dimensions.height) != null &&
48924
+ Number.isFinite(dimensions.height) &&
48925
+ dimensions.height > 0;
48926
+ var widthValid = (dimensions === null || dimensions === void 0 ? void 0 : dimensions.width) != null &&
48927
+ Number.isFinite(dimensions.width) &&
48928
+ dimensions.width > 0;
48929
+ return heightValid && widthValid;
48930
+ }
48931
+ function validateNumber(number) {
48932
+ return number != null && Number.isFinite(number);
48933
+ }
48934
+ function validatePoint(point) {
48935
+ var xValid = (point === null || point === void 0 ? void 0 : point.x) != null && Number.isFinite(point.x);
48936
+ var yValid = (point === null || point === void 0 ? void 0 : point.y) != null && Number.isFinite(point.y);
48937
+ return xValid && yValid;
48938
+ }
48939
+ function validateVector(vector, verifyNonZeroLength) {
48940
+ var xValid = (vector === null || vector === void 0 ? void 0 : vector.x) != null && Number.isFinite(vector.x);
48941
+ var yValid = (vector === null || vector === void 0 ? void 0 : vector.y) != null && Number.isFinite(vector.y);
48942
+ var zValid = (vector === null || vector === void 0 ? void 0 : vector.z) != null && Number.isFinite(vector.z);
48943
+ var vectorComponentsValid = xValid && yValid && zValid;
48944
+ if (verifyNonZeroLength) {
48945
+ if ((vector === null || vector === void 0 ? void 0 : vector.x) != null && (vector === null || vector === void 0 ? void 0 : vector.y) != null && (vector === null || vector === void 0 ? void 0 : vector.z) != null) {
48946
+ var vectorMagnitudeSquared = vector.x * vector.x + vector.y * vector.y + vector.z * vector.z;
48947
+ var vectorHasNonZeroLength = vectorMagnitudeSquared !== 0;
48948
+ return vectorComponentsValid && vectorHasNonZeroLength;
48949
+ }
48950
+ else {
48951
+ // If one or more components are undefined, then the vector does not have non-zero length
48952
+ return false;
48953
+ }
48954
+ }
48955
+ return vectorComponentsValid;
48956
+ }
48957
+
48845
48958
  var WebSocketClientImpl = /** @class */ (function () {
48846
48959
  function WebSocketClientImpl() {
48847
48960
  var _this = this;
@@ -49084,6 +49197,14 @@ var StreamApi = /** @class */ (function () {
49084
49197
  */
49085
49198
  StreamApi.prototype.replaceCamera = function (payload, withResponse) {
49086
49199
  if (withResponse === void 0) { withResponse = true; }
49200
+ // If a camera is provided, verify it is valid
49201
+ if (payload.camera != null) {
49202
+ var cameraIsValid = validateCamera(payload.camera);
49203
+ if (!cameraIsValid) {
49204
+ console.warn('Invalid camera provided. Canceling replaceCamera operation.');
49205
+ return Promise.resolve({});
49206
+ }
49207
+ }
49087
49208
  return this.sendRequest({ updateCamera: payload }, withResponse);
49088
49209
  };
49089
49210
  /**
@@ -49103,6 +49224,30 @@ var StreamApi = /** @class */ (function () {
49103
49224
  */
49104
49225
  StreamApi.prototype.flyTo = function (payload, withResponse) {
49105
49226
  if (withResponse === void 0) { withResponse = true; }
49227
+ // If a bounding box is provided, verify it is valid
49228
+ if (payload.boundingBox != null) {
49229
+ var validBoundingBox = validateBoundingBox(payload.boundingBox);
49230
+ if (!validBoundingBox) {
49231
+ console.warn('Invalid bounding box provided. Canceling flyTo operation.');
49232
+ return Promise.resolve({});
49233
+ }
49234
+ }
49235
+ // If a camera is provided, verify it is valid
49236
+ if (payload.camera != null) {
49237
+ var cameraIsValid = validateCamera(payload.camera);
49238
+ if (!cameraIsValid) {
49239
+ console.warn('Invalid camera provided. Canceling flyTo operation.');
49240
+ return Promise.resolve({});
49241
+ }
49242
+ }
49243
+ // If a base camera is provided, verify it is valid
49244
+ if (payload.baseCamera != null) {
49245
+ var baseCameraIsValid = validateCamera(payload.baseCamera);
49246
+ if (!baseCameraIsValid) {
49247
+ console.warn('Invalid base camera provided. Canceling flyTo operation.');
49248
+ return Promise.resolve({});
49249
+ }
49250
+ }
49106
49251
  return this.sendRequest({ flyTo: payload }, withResponse);
49107
49252
  };
49108
49253
  /**
@@ -49138,6 +49283,14 @@ var StreamApi = /** @class */ (function () {
49138
49283
  */
49139
49284
  StreamApi.prototype.updateDimensions = function (payload, withResponse) {
49140
49285
  if (withResponse === void 0) { withResponse = true; }
49286
+ // Verify the provided dimensions are valid
49287
+ if (payload.dimensions != null) {
49288
+ var validDimensions = validateDimensions(payload.dimensions);
49289
+ if (!validDimensions) {
49290
+ console.warn('Invalid dimensions provided. Canceling updateDimensions operation.');
49291
+ return Promise.resolve({});
49292
+ }
49293
+ }
49141
49294
  return this.sendRequest({ updateDimensions: payload }, withResponse);
49142
49295
  };
49143
49296
  /**
@@ -49157,7 +49310,18 @@ var StreamApi = /** @class */ (function () {
49157
49310
  * Defaults to `true`.
49158
49311
  */
49159
49312
  StreamApi.prototype.updateCrossSectioning = function (payload, withResponse) {
49313
+ var _a, _b;
49160
49314
  if (withResponse === void 0) { withResponse = true; }
49315
+ // If a section plane is provided, verify it is valid
49316
+ var invalidSectionPlane = (_b = (_a = payload.crossSectioning) === null || _a === void 0 ? void 0 : _a.sectionPlanes) === null || _b === void 0 ? void 0 : _b.some(function (plane) {
49317
+ var validNormal = plane.normal != null && validateVector(plane.normal, true);
49318
+ var validOffset = plane.offset != null && validateNumber(plane.offset);
49319
+ return !validNormal || !validOffset;
49320
+ });
49321
+ if (invalidSectionPlane) {
49322
+ console.warn('Invalid cross section plane provided. Canceling updateCrossSectioning operation.');
49323
+ return Promise.resolve({});
49324
+ }
49161
49325
  return this.sendRequest({ updateCrossSectioning: payload }, withResponse);
49162
49326
  };
49163
49327
  /**
@@ -49193,6 +49357,14 @@ var StreamApi = /** @class */ (function () {
49193
49357
  */
49194
49358
  StreamApi.prototype.hitItems = function (payload, withResponse) {
49195
49359
  if (withResponse === void 0) { withResponse = true; }
49360
+ // If a point is provided, verify it is valid
49361
+ if (payload.point != null) {
49362
+ var validPoint = validatePoint(payload.point);
49363
+ if (!validPoint) {
49364
+ console.warn('Invalid point provided. Canceling hitItems operation.');
49365
+ return Promise.resolve({});
49366
+ }
49367
+ }
49196
49368
  return this.sendRequest({ hitItems: payload }, withResponse);
49197
49369
  };
49198
49370
  /**