@dronedeploy/rocos-js-sdk 0.0.1 → 2.6.1
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/IRocosSDK.d.ts +55 -0
- package/IRocosSDK.js +6 -0
- package/README.md +90 -0
- package/RocosSDK.d.ts +138 -0
- package/RocosSDK.js +294 -0
- package/api/StreamRegister.d.ts +13 -0
- package/api/StreamRegister.js +58 -0
- package/api/atoms/StreamHeartbeat.d.ts +27 -0
- package/api/atoms/StreamHeartbeat.js +115 -0
- package/api/streams/caller/CallerStream.d.ts +13 -0
- package/api/streams/caller/CallerStream.js +85 -0
- package/api/streams/caller/CallerStreamAbstract.d.ts +28 -0
- package/api/streams/caller/CallerStreamAbstract.js +99 -0
- package/api/streams/caller/CallerStreamNode.d.ts +13 -0
- package/api/streams/caller/CallerStreamNode.js +128 -0
- package/api/streams/command/CommandStream.d.ts +12 -0
- package/api/streams/command/CommandStream.js +68 -0
- package/api/streams/command/CommandStreamAbstract.d.ts +24 -0
- package/api/streams/command/CommandStreamAbstract.js +72 -0
- package/api/streams/command/CommandStreamNode.d.ts +12 -0
- package/api/streams/command/CommandStreamNode.js +93 -0
- package/api/streams/control/ControlStream.d.ts +14 -0
- package/api/streams/control/ControlStream.js +81 -0
- package/api/streams/control/ControlStreamAbstract.d.ts +28 -0
- package/api/streams/control/ControlStreamAbstract.js +108 -0
- package/api/streams/control/ControlStreamNode.d.ts +14 -0
- package/api/streams/control/ControlStreamNode.js +98 -0
- package/api/streams/fileAccessor/FileAccessorStream.d.ts +10 -0
- package/api/streams/fileAccessor/FileAccessorStream.js +74 -0
- package/api/streams/fileAccessor/FileAccessorStreamAbstract.d.ts +26 -0
- package/api/streams/fileAccessor/FileAccessorStreamAbstract.js +82 -0
- package/api/streams/fileAccessor/FileAccessorStreamNode.d.ts +10 -0
- package/api/streams/fileAccessor/FileAccessorStreamNode.js +96 -0
- package/api/streams/search/SearchStream.d.ts +16 -0
- package/api/streams/search/SearchStream.js +120 -0
- package/api/streams/search/SearchStreamAbstract.d.ts +30 -0
- package/api/streams/search/SearchStreamAbstract.js +74 -0
- package/api/streams/search/SearchStreamNode.d.ts +16 -0
- package/api/streams/search/SearchStreamNode.js +143 -0
- package/api/streams/telemetry/TelemetryStream.d.ts +17 -0
- package/api/streams/telemetry/TelemetryStream.js +126 -0
- package/api/streams/telemetry/TelemetryStreamAbstract.d.ts +62 -0
- package/api/streams/telemetry/TelemetryStreamAbstract.js +421 -0
- package/api/streams/telemetry/TelemetryStreamNode.d.ts +21 -0
- package/api/streams/telemetry/TelemetryStreamNode.js +195 -0
- package/api/streams/webRTCSignalling/WebRTCSignallingStream.d.ts +44 -0
- package/api/streams/webRTCSignalling/WebRTCSignallingStream.js +67 -0
- package/api/streams/webRTCSignalling/WebRTCSignallingStreamAbstract.d.ts +32 -0
- package/api/streams/webRTCSignalling/WebRTCSignallingStreamAbstract.js +65 -0
- package/constants/api.d.ts +121 -0
- package/constants/api.js +126 -0
- package/constants/grpc.d.ts +5 -0
- package/constants/grpc.js +8 -0
- package/constants/identifier.d.ts +6 -0
- package/constants/identifier.js +9 -0
- package/constants/timezones.d.ts +2 -0
- package/constants/timezones.js +430 -0
- package/demo/angular/.editorconfig +16 -0
- package/demo/angular/.eslintignore +4 -0
- package/demo/angular/.eslintrc.json +50 -0
- package/demo/angular/README.md +36 -0
- package/demo/angular/angular.json +132 -0
- package/demo/angular/karma.conf.js +44 -0
- package/demo/angular/package.json +41 -0
- package/demo/angular/src/app/app.component.css +0 -0
- package/demo/angular/src/app/app.component.html +9 -0
- package/demo/angular/src/app/app.component.ts +10 -0
- package/demo/angular/src/app/app.module.ts +38 -0
- package/demo/angular/src/app/components/assets/assets.component.css +0 -0
- package/demo/angular/src/app/components/assets/assets.component.html +29 -0
- package/demo/angular/src/app/components/assets/assets.component.ts +107 -0
- package/demo/angular/src/app/components/auth/auth.component.css +0 -0
- package/demo/angular/src/app/components/auth/auth.component.html +27 -0
- package/demo/angular/src/app/components/auth/auth.component.ts +33 -0
- package/demo/angular/src/app/components/caller/caller.component.css +0 -0
- package/demo/angular/src/app/components/caller/caller.component.html +22 -0
- package/demo/angular/src/app/components/caller/caller.component.ts +61 -0
- package/demo/angular/src/app/components/command/command.component.css +0 -0
- package/demo/angular/src/app/components/command/command.component.html +22 -0
- package/demo/angular/src/app/components/command/command.component.ts +60 -0
- package/demo/angular/src/app/components/integrations/integrations.component.ts +43 -0
- package/demo/angular/src/app/components/robots/robots.component.css +0 -0
- package/demo/angular/src/app/components/robots/robots.component.html +13 -0
- package/demo/angular/src/app/components/robots/robots.component.ts +26 -0
- package/demo/angular/src/app/components/sdk/sdk.component.css +0 -0
- package/demo/angular/src/app/components/sdk/sdk.component.html +43 -0
- package/demo/angular/src/app/components/sdk/sdk.component.ts +50 -0
- package/demo/angular/src/app/components/subscription/subscription.component.css +0 -0
- package/demo/angular/src/app/components/subscription/subscription.component.html +6 -0
- package/demo/angular/src/app/components/subscription/subscription.component.ts +40 -0
- package/demo/angular/src/app/components/telemetry/telemetry.component.css +0 -0
- package/demo/angular/src/app/components/telemetry/telemetry.component.html +19 -0
- package/demo/angular/src/app/components/telemetry/telemetry.component.ts +61 -0
- package/demo/angular/src/app/components/token/token.component.css +0 -0
- package/demo/angular/src/app/components/token/token.component.html +10 -0
- package/demo/angular/src/app/components/token/token.component.ts +18 -0
- package/demo/angular/src/app/components/video/p2pvideo/index.ts +646 -0
- package/demo/angular/src/app/components/video/video-source.ts +315 -0
- package/demo/angular/src/app/components/video/video.component.css +6 -0
- package/demo/angular/src/app/components/video/video.component.html +54 -0
- package/demo/angular/src/app/components/video/video.component.ts +151 -0
- package/demo/angular/src/app/services/sdk.service.ts +193 -0
- package/demo/angular/src/assets/.gitkeep +0 -0
- package/demo/angular/src/assets/HKGrotesk-Bold.otf +0 -0
- package/demo/angular/src/assets/HKGrotesk-Regular.otf +0 -0
- package/demo/angular/src/assets/logo.svg +16 -0
- package/demo/angular/src/environments/environment.prod.ts +3 -0
- package/demo/angular/src/environments/environment.ts +16 -0
- package/demo/angular/src/favicon.ico +0 -0
- package/demo/angular/src/index.html +15 -0
- package/demo/angular/src/main.ts +7 -0
- package/demo/angular/src/polyfills.ts +53 -0
- package/demo/angular/src/styles.css +198 -0
- package/demo/angular/tsconfig.app.json +15 -0
- package/demo/angular/tsconfig.json +39 -0
- package/demo/html/README.md +8 -0
- package/demo/html/assets/HKGrotesk-Bold.otf +0 -0
- package/demo/html/assets/HKGrotesk-Regular.otf +0 -0
- package/demo/html/assets/logo.svg +16 -0
- package/demo/html/favicon.ico +0 -0
- package/demo/html/index.html +416 -0
- package/demo/html/rocos-js-sdk.js +3 -0
- package/demo/html/rocos-js-sdk.js.LICENSE.txt +8 -0
- package/demo/html/rocos-js-sdk.js.map +1 -0
- package/demo/html/styles.css +190 -0
- package/demo/node/README.md +17 -0
- package/demo/node/index.js +134 -0
- package/demo/node/package.json +8 -0
- package/demo/react/.env +1 -0
- package/demo/react/.env.dist +1 -0
- package/demo/react/.eslintrc.json +46 -0
- package/demo/react/README.md +65 -0
- package/demo/react/package.json +60 -0
- package/demo/react/public/favicon.ico +0 -0
- package/demo/react/public/index.html +43 -0
- package/demo/react/public/logo192.png +0 -0
- package/demo/react/public/logo512.png +0 -0
- package/demo/react/public/manifest.json +25 -0
- package/demo/react/public/robots.txt +3 -0
- package/demo/react/src/App.css +190 -0
- package/demo/react/src/App.tsx +31 -0
- package/demo/react/src/actions/index.ts +8 -0
- package/demo/react/src/actions/sdkActions.ts +62 -0
- package/demo/react/src/assets/HKGrotesk-Bold.otf +0 -0
- package/demo/react/src/assets/HKGrotesk-Regular.otf +0 -0
- package/demo/react/src/assets/logo.svg +16 -0
- package/demo/react/src/components/AuthForm.tsx +76 -0
- package/demo/react/src/components/CallerBox.tsx +53 -0
- package/demo/react/src/components/CallerForm.tsx +98 -0
- package/demo/react/src/components/CommandBox.tsx +47 -0
- package/demo/react/src/components/CommandForm.tsx +98 -0
- package/demo/react/src/components/RobotsForm.tsx +51 -0
- package/demo/react/src/components/SubscriptionBox.tsx +55 -0
- package/demo/react/src/components/TelemetryForm.tsx +98 -0
- package/demo/react/src/components/TokenForm.tsx +39 -0
- package/demo/react/src/config.json +14 -0
- package/demo/react/src/controllers/RocosSDKController.ts +48 -0
- package/demo/react/src/helpers/deepEqual.ts +27 -0
- package/demo/react/src/hooks/useInput.ts +29 -0
- package/demo/react/src/index.css +11 -0
- package/demo/react/src/index.tsx +26 -0
- package/demo/react/src/react-app-env.d.ts +1 -0
- package/demo/react/src/reducers/sdkReducer.ts +133 -0
- package/demo/react/src/reportWebVitals.ts +15 -0
- package/demo/react/src/selectors/sdkSelector.ts +11 -0
- package/demo/react/src/setupTests.ts +5 -0
- package/demo/react/src/store.ts +14 -0
- package/demo/react/tsconfig.json +26 -0
- package/demo/sdk-sizer/dist/sdk-sizer/3rdpartylicenses.txt +975 -0
- package/demo/sdk-sizer/dist/sdk-sizer/favicon.ico +0 -0
- package/demo/sdk-sizer/dist/sdk-sizer/index.html +12 -0
- package/demo/sdk-sizer/dist/sdk-sizer/main.c9183649ce1856ef.js +2 -0
- package/demo/sdk-sizer/dist/sdk-sizer/main.c9183649ce1856ef.js.map +1 -0
- package/demo/sdk-sizer/dist/sdk-sizer/polyfills.701c8e5d007909aa.js +2 -0
- package/demo/sdk-sizer/dist/sdk-sizer/polyfills.701c8e5d007909aa.js.map +1 -0
- package/demo/sdk-sizer/dist/sdk-sizer/runtime.00e20e689f5284a8.js +2 -0
- package/demo/sdk-sizer/dist/sdk-sizer/runtime.00e20e689f5284a8.js.map +1 -0
- package/demo/sdk-sizer/dist/sdk-sizer/stats.json +1 -0
- package/demo/sdk-sizer/dist/sdk-sizer/styles.b45f7e627ac8cbce.css +2 -0
- package/demo/sdk-sizer/dist/sdk-sizer/styles.b45f7e627ac8cbce.css.map +1 -0
- package/grpc/file-accessor/filagree_grpc_pb.d.ts +41 -0
- package/grpc/file-accessor/filagree_grpc_pb.js +121 -0
- package/grpc/file-accessor/filagree_pb.d.ts +339 -0
- package/grpc/file-accessor/filagree_pb.js +2261 -0
- package/grpc/file-accessor/filagree_pb_service.d.ts +115 -0
- package/grpc/file-accessor/filagree_pb_service.js +257 -0
- package/grpc/rambo/rambo.v1_grpc_pb.d.ts +39 -0
- package/grpc/rambo/rambo.v1_grpc_pb.js +73 -0
- package/grpc/rambo/rambo.v1_pb.d.ts +365 -0
- package/grpc/rambo/rambo.v1_pb.js +2469 -0
- package/grpc/rambo/rambo.v1_pb_service.d.ts +76 -0
- package/grpc/rambo/rambo.v1_pb_service.js +138 -0
- package/grpc/rambo/uri.v1_grpc_pb.d.ts +1 -0
- package/grpc/rambo/uri.v1_grpc_pb.js +1 -0
- package/grpc/rambo/uri.v1_pb.d.ts +80 -0
- package/grpc/rambo/uri.v1_pb.js +563 -0
- package/grpc/rambo/uri.v1_pb_service.d.ts +3 -0
- package/grpc/rambo/uri.v1_pb_service.js +3 -0
- package/grpc/robot-control/conker_grpc_pb.d.ts +46 -0
- package/grpc/robot-control/conker_grpc_pb.js +143 -0
- package/grpc/robot-control/conker_pb.d.ts +168 -0
- package/grpc/robot-control/conker_pb.js +1287 -0
- package/grpc/robot-control/conker_pb_service.d.ts +126 -0
- package/grpc/robot-control/conker_pb_service.js +301 -0
- package/grpc/serviette/common.v1_grpc_pb.d.ts +1 -0
- package/grpc/serviette/common.v1_grpc_pb.js +1 -0
- package/grpc/serviette/common.v1_pb.d.ts +8 -0
- package/grpc/serviette/common.v1_pb.js +45 -0
- package/grpc/serviette/common.v1_pb_service.d.ts +3 -0
- package/grpc/serviette/common.v1_pb_service.js +3 -0
- package/grpc/serviette/serviette.v1_grpc_pb.d.ts +137 -0
- package/grpc/serviette/serviette.v1_grpc_pb.js +331 -0
- package/grpc/serviette/serviette.v1_pb.d.ts +884 -0
- package/grpc/serviette/serviette.v1_pb.js +6363 -0
- package/grpc/serviette/serviette.v1_pb_service.d.ts +278 -0
- package/grpc/serviette/serviette.v1_pb_service.js +699 -0
- package/grpc/serviette/uri.v1_grpc_pb.d.ts +1 -0
- package/grpc/serviette/uri.v1_grpc_pb.js +1 -0
- package/grpc/serviette/uri.v1_pb.d.ts +102 -0
- package/grpc/serviette/uri.v1_pb.js +741 -0
- package/grpc/serviette/uri.v1_pb_service.d.ts +3 -0
- package/grpc/serviette/uri.v1_pb_service.js +3 -0
- package/grpc/slowlane/slowlane_grpc_pb.d.ts +38 -0
- package/grpc/slowlane/slowlane_grpc_pb.js +132 -0
- package/grpc/slowlane/slowlane_pb.d.ts +373 -0
- package/grpc/slowlane/slowlane_pb.js +2908 -0
- package/grpc/slowlane/slowlane_pb_service.d.ts +112 -0
- package/grpc/slowlane/slowlane_pb_service.js +189 -0
- package/grpc/teletubby/teletubby_grpc_pb.d.ts +73 -0
- package/grpc/teletubby/teletubby_grpc_pb.js +231 -0
- package/grpc/teletubby/teletubby_pb.d.ts +647 -0
- package/grpc/teletubby/teletubby_pb.js +4786 -0
- package/grpc/teletubby/teletubby_pb_service.d.ts +193 -0
- package/grpc/teletubby/teletubby_pb_service.js +436 -0
- package/grpc/video/pigeon_grpc_pb.d.ts +59 -0
- package/grpc/video/pigeon_grpc_pb.js +180 -0
- package/grpc/video/pigeon_pb.d.ts +237 -0
- package/grpc/video/pigeon_pb.js +1775 -0
- package/grpc/video/pigeon_pb_service.d.ts +152 -0
- package/grpc/video/pigeon_pb_service.js +292 -0
- package/helpers/arrayRemove.d.ts +1 -0
- package/helpers/arrayRemove.js +7 -0
- package/helpers/arrayUnique.d.ts +1 -0
- package/helpers/arrayUnique.js +7 -0
- package/helpers/average.d.ts +1 -0
- package/helpers/average.js +11 -0
- package/helpers/cleanObject.d.ts +1 -0
- package/helpers/cleanObject.js +20 -0
- package/helpers/enviroment.d.ts +8 -0
- package/helpers/enviroment.js +20 -0
- package/helpers/flattenCallsignsLookup.d.ts +2 -0
- package/helpers/flattenCallsignsLookup.js +10 -0
- package/helpers/flattenObject.d.ts +1 -0
- package/helpers/flattenObject.js +17 -0
- package/helpers/formatServiceUrl.d.ts +1 -0
- package/helpers/formatServiceUrl.js +11 -0
- package/helpers/generateUUID.d.ts +1 -0
- package/helpers/generateUUID.js +8 -0
- package/helpers/getSubscriptionsDifference.d.ts +10 -0
- package/helpers/getSubscriptionsDifference.js +39 -0
- package/helpers/getUniqueConfigKey.d.ts +7 -0
- package/helpers/getUniqueConfigKey.js +19 -0
- package/helpers/getUniqueId.d.ts +9 -0
- package/helpers/getUniqueId.js +15 -0
- package/helpers/getUnixTimeMs.d.ts +1 -0
- package/helpers/getUnixTimeMs.js +8 -0
- package/helpers/index.d.ts +3 -0
- package/helpers/index.js +15 -0
- package/helpers/nanosecondToMillisecond.d.ts +1 -0
- package/helpers/nanosecondToMillisecond.js +7 -0
- package/helpers/randomString.d.ts +1 -0
- package/helpers/randomString.js +7 -0
- package/helpers/standardDeviation.d.ts +1 -0
- package/helpers/standardDeviation.js +16 -0
- package/helpers/stringToUint8Array.d.ts +1 -0
- package/helpers/stringToUint8Array.js +14 -0
- package/helpers/uint8ArrayToString.d.ts +1 -0
- package/helpers/uint8ArrayToString.js +15 -0
- package/index.d.ts +7 -0
- package/index.js +19 -0
- package/logger/RocosLogger.d.ts +7 -0
- package/logger/RocosLogger.js +63 -0
- package/models/ExportDataQuery.d.ts +8 -0
- package/models/ExportDataQuery.js +17 -0
- package/models/ExternalProject.d.ts +6 -0
- package/models/ExternalProject.js +6 -0
- package/models/IBaseService.d.ts +3 -0
- package/models/IBaseService.js +2 -0
- package/models/IConfigGroup.d.ts +5 -0
- package/models/IConfigGroup.js +2 -0
- package/models/IDebugLevel.d.ts +2 -0
- package/models/IDebugLevel.js +2 -0
- package/models/IExportDataQuery.d.ts +9 -0
- package/models/IExportDataQuery.js +2 -0
- package/models/IFunctionConfig.d.ts +8 -0
- package/models/IFunctionConfig.js +2 -0
- package/models/IInvitation.d.ts +6 -0
- package/models/IInvitation.js +2 -0
- package/models/IInvitationExists.d.ts +4 -0
- package/models/IInvitationExists.js +2 -0
- package/models/IOperation.d.ts +6 -0
- package/models/IOperation.js +2 -0
- package/models/IPersonalAccessToken.d.ts +16 -0
- package/models/IPersonalAccessToken.js +2 -0
- package/models/IProject.d.ts +4 -0
- package/models/IProject.js +2 -0
- package/models/IProjectApplication.d.ts +6 -0
- package/models/IProjectApplication.js +2 -0
- package/models/IRobot.d.ts +17 -0
- package/models/IRobot.js +2 -0
- package/models/IRobotConfig.d.ts +8 -0
- package/models/IRobotConfig.js +2 -0
- package/models/IRobotPlugin.d.ts +3 -0
- package/models/IRobotPlugin.js +2 -0
- package/models/IRobotTemplate.d.ts +10 -0
- package/models/IRobotTemplate.js +2 -0
- package/models/IRocosSDKConfig.d.ts +25 -0
- package/models/IRocosSDKConfig.js +2 -0
- package/models/ISignupParams.d.ts +8 -0
- package/models/ISignupParams.js +2 -0
- package/models/ISource.d.ts +8 -0
- package/models/ISource.js +2 -0
- package/models/IStream.d.ts +9 -0
- package/models/IStream.js +2 -0
- package/models/IStreamConfig.d.ts +9 -0
- package/models/IStreamConfig.js +2 -0
- package/models/IStreamOptions.d.ts +7 -0
- package/models/IStreamOptions.js +2 -0
- package/models/IStreamSource.d.ts +8 -0
- package/models/IStreamSource.js +2 -0
- package/models/ISubscriberStatus.d.ts +5 -0
- package/models/ISubscriberStatus.js +2 -0
- package/models/ITelemetryStreamConfig.d.ts +7 -0
- package/models/ITelemetryStreamConfig.js +2 -0
- package/models/IToken.d.ts +5 -0
- package/models/IToken.js +2 -0
- package/models/IWidget.d.ts +25 -0
- package/models/IWidget.js +2 -0
- package/models/IWidgetLineGroup.d.ts +8 -0
- package/models/IWidgetLineGroup.js +2 -0
- package/models/ResponseLevelEnum.d.ts +6 -0
- package/models/ResponseLevelEnum.js +10 -0
- package/models/Robot.d.ts +19 -0
- package/models/Robot.js +12 -0
- package/models/RobotConfig.d.ts +10 -0
- package/models/RobotConfig.js +9 -0
- package/models/RobotPlugin.d.ts +5 -0
- package/models/RobotPlugin.js +9 -0
- package/models/RobotTemplate.d.ts +12 -0
- package/models/RobotTemplate.js +30 -0
- package/models/RocosError.d.ts +30 -0
- package/models/RocosError.js +43 -0
- package/models/ServiceEnum.d.ts +26 -0
- package/models/ServiceEnum.js +30 -0
- package/models/Stream.d.ts +10 -0
- package/models/Stream.js +15 -0
- package/models/StreamOptions.d.ts +9 -0
- package/models/StreamOptions.js +37 -0
- package/models/StreamSource.d.ts +10 -0
- package/models/StreamSource.js +15 -0
- package/models/SubscriberStatusEnum.d.ts +6 -0
- package/models/SubscriberStatusEnum.js +10 -0
- package/models/Token.d.ts +8 -0
- package/models/Token.js +15 -0
- package/models/Widget.d.ts +27 -0
- package/models/Widget.js +16 -0
- package/models/WidgetLineGroup.d.ts +10 -0
- package/models/WidgetLineGroup.js +9 -0
- package/models/asset-storage/AssetModelItem.d.ts +29 -0
- package/models/asset-storage/AssetModelItem.js +2 -0
- package/models/caller/IRocosCallerMessageChunk.d.ts +9 -0
- package/models/caller/IRocosCallerMessageChunk.js +2 -0
- package/models/caller/IRocosCallerMessageChunks.d.ts +5 -0
- package/models/caller/IRocosCallerMessageChunks.js +2 -0
- package/models/caller/IRocosCallerMessageHeartbeat.d.ts +2 -0
- package/models/caller/IRocosCallerMessageHeartbeat.js +2 -0
- package/models/caller/IRocosCallerMessageResponse.d.ts +9 -0
- package/models/caller/IRocosCallerMessageResponse.js +2 -0
- package/models/caller/IRocosCallerMessageResponseAck.d.ts +2 -0
- package/models/caller/IRocosCallerMessageResponseAck.js +2 -0
- package/models/caller/IRocosCallerMessageResponseResult.d.ts +2 -0
- package/models/caller/IRocosCallerMessageResponseResult.js +2 -0
- package/models/caller/IRocosCallerMessageResponseUid.d.ts +2 -0
- package/models/caller/IRocosCallerMessageResponseUid.js +2 -0
- package/models/caller/IRocosCallerMessageResponses.d.ts +5 -0
- package/models/caller/IRocosCallerMessageResponses.js +2 -0
- package/models/caller/RocosCallerResultStatus.d.ts +1 -0
- package/models/caller/RocosCallerResultStatus.js +5 -0
- package/models/callsigns/CallsignsEnums.d.ts +13 -0
- package/models/callsigns/CallsignsEnums.js +20 -0
- package/models/callsigns/CallsignsLookup.d.ts +8 -0
- package/models/callsigns/CallsignsLookup.js +33 -0
- package/models/callsigns/CallsignsQuery.d.ts +9 -0
- package/models/callsigns/CallsignsQuery.js +18 -0
- package/models/callsigns/CallsignsQueryPredicate.d.ts +9 -0
- package/models/callsigns/CallsignsQueryPredicate.js +19 -0
- package/models/command/IRocosCommandMessageHeartbeat.d.ts +2 -0
- package/models/command/IRocosCommandMessageHeartbeat.js +2 -0
- package/models/command/IRocosCommandMessageResponse.d.ts +2 -0
- package/models/command/IRocosCommandMessageResponse.js +2 -0
- package/models/command/RocosCommandResultStatus.d.ts +1 -0
- package/models/command/RocosCommandResultStatus.js +5 -0
- package/models/file/FileEnums.d.ts +30 -0
- package/models/file/FileEnums.js +36 -0
- package/models/index.d.ts +101 -0
- package/models/index.js +113 -0
- package/models/integrations/Overlay.d.ts +49 -0
- package/models/integrations/Overlay.js +2 -0
- package/models/integrations/Plan.d.ts +324 -0
- package/models/integrations/Plan.js +2 -0
- package/models/maps/Map.d.ts +12 -0
- package/models/maps/Map.js +2 -0
- package/models/message/IRocosCallerMessage.d.ts +8 -0
- package/models/message/IRocosCallerMessage.js +2 -0
- package/models/message/IRocosChangeMessage.d.ts +6 -0
- package/models/message/IRocosChangeMessage.js +2 -0
- package/models/message/IRocosCommandMessage.d.ts +6 -0
- package/models/message/IRocosCommandMessage.js +2 -0
- package/models/message/IRocosControlMessage.d.ts +7 -0
- package/models/message/IRocosControlMessage.js +2 -0
- package/models/message/IRocosOpResultMessage.d.ts +6 -0
- package/models/message/IRocosOpResultMessage.js +2 -0
- package/models/message/IRocosSearchMessage.d.ts +5 -0
- package/models/message/IRocosSearchMessage.js +2 -0
- package/models/message/IRocosSearchRowMessage.d.ts +9 -0
- package/models/message/IRocosSearchRowMessage.js +2 -0
- package/models/message/IRocosSearchStatusMessage.d.ts +4 -0
- package/models/message/IRocosSearchStatusMessage.js +2 -0
- package/models/message/IRocosTelemetryMessage.d.ts +18 -0
- package/models/message/IRocosTelemetryMessage.js +2 -0
- package/models/message/IStreamStatusMessage.d.ts +5 -0
- package/models/message/IStreamStatusMessage.js +2 -0
- package/models/message/RocosCallerMessage.d.ts +12 -0
- package/models/message/RocosCallerMessage.js +23 -0
- package/models/message/RocosCommandMessage.d.ts +10 -0
- package/models/message/RocosCommandMessage.js +16 -0
- package/models/message/RocosControlMessage.d.ts +11 -0
- package/models/message/RocosControlMessage.js +18 -0
- package/models/message/RocosOpResultMessage.d.ts +9 -0
- package/models/message/RocosOpResultMessage.js +22 -0
- package/models/message/RocosSearchMessage.d.ts +9 -0
- package/models/message/RocosSearchMessage.js +28 -0
- package/models/message/RocosSearchRowMessage.d.ts +13 -0
- package/models/message/RocosSearchRowMessage.js +20 -0
- package/models/message/RocosTelemetryMessage.d.ts +24 -0
- package/models/message/RocosTelemetryMessage.js +105 -0
- package/models/params/ICallerParams.d.ts +15 -0
- package/models/params/ICallerParams.js +2 -0
- package/models/params/ICommandParams.d.ts +9 -0
- package/models/params/ICommandParams.js +2 -0
- package/models/params/IControlParams.d.ts +8 -0
- package/models/params/IControlParams.js +2 -0
- package/models/params/IFileAccessorParams.d.ts +11 -0
- package/models/params/IFileAccessorParams.js +2 -0
- package/models/params/ISearchParams.d.ts +10 -0
- package/models/params/ISearchParams.js +2 -0
- package/models/params/ITelemetryParams.d.ts +18 -0
- package/models/params/ITelemetryParams.js +2 -0
- package/models/params/IWebRTCSignallingParams.d.ts +21 -0
- package/models/params/IWebRTCSignallingParams.js +2 -0
- package/models/projects/ProjectUser.d.ts +6 -0
- package/models/projects/ProjectUser.js +2 -0
- package/models/schedule/IScheduleAction.d.ts +13 -0
- package/models/schedule/IScheduleAction.js +9 -0
- package/models/schedule/IScheduleInfo.d.ts +11 -0
- package/models/schedule/IScheduleInfo.js +2 -0
- package/models/schedule/IScheduleJob.d.ts +12 -0
- package/models/schedule/IScheduleJob.js +2 -0
- package/models/search/SearchQueryFilter.d.ts +5 -0
- package/models/search/SearchQueryFilter.js +9 -0
- package/models/search/SearchStreamQuery.d.ts +15 -0
- package/models/search/SearchStreamQuery.js +10 -0
- package/models/stream/IBaseStream.d.ts +8 -0
- package/models/stream/IBaseStream.js +2 -0
- package/models/stream/ICallerStream.d.ts +8 -0
- package/models/stream/ICallerStream.js +2 -0
- package/models/stream/ICommandStream.d.ts +7 -0
- package/models/stream/ICommandStream.js +2 -0
- package/models/stream/IControlStream.d.ts +9 -0
- package/models/stream/IControlStream.js +2 -0
- package/models/stream/IFileAccessorStream.d.ts +10 -0
- package/models/stream/IFileAccessorStream.js +2 -0
- package/models/stream/ISearchStream.d.ts +11 -0
- package/models/stream/ISearchStream.js +2 -0
- package/models/stream/ITelemetryStream.d.ts +10 -0
- package/models/stream/ITelemetryStream.js +2 -0
- package/models/stream/IWebRTCSignallingStream.d.ts +41 -0
- package/models/stream/IWebRTCSignallingStream.js +7 -0
- package/models/types.d.ts +5 -0
- package/models/types.js +2 -0
- package/node/RocosSDKNode.d.ts +42 -0
- package/node/RocosSDKNode.js +148 -0
- package/node/index.d.ts +7 -0
- package/node/index.js +19 -0
- package/package.json +25 -6
- package/services/AssetStorageService.d.ts +92 -0
- package/services/AssetStorageService.js +153 -0
- package/services/AuthService.d.ts +61 -0
- package/services/AuthService.js +154 -0
- package/services/BaseServiceAbstract.d.ts +38 -0
- package/services/BaseServiceAbstract.js +103 -0
- package/services/CallerService.d.ts +22 -0
- package/services/CallerService.js +96 -0
- package/services/CallerServiceNode.d.ts +6 -0
- package/services/CallerServiceNode.js +11 -0
- package/services/CommandService.d.ts +21 -0
- package/services/CommandService.js +81 -0
- package/services/CommandServiceNode.d.ts +6 -0
- package/services/CommandServiceNode.js +11 -0
- package/services/ConfigGroupService.d.ts +89 -0
- package/services/ConfigGroupService.js +157 -0
- package/services/ControlService.d.ts +23 -0
- package/services/ControlService.js +100 -0
- package/services/ControlServiceNode.d.ts +6 -0
- package/services/ControlServiceNode.js +11 -0
- package/services/DashboardService.d.ts +97 -0
- package/services/DashboardService.js +146 -0
- package/services/EventService.d.ts +53 -0
- package/services/EventService.js +89 -0
- package/services/FileAccessorService.d.ts +25 -0
- package/services/FileAccessorService.js +85 -0
- package/services/FileAccessorServiceNode.d.ts +6 -0
- package/services/FileAccessorServiceNode.js +11 -0
- package/services/FunctionService.d.ts +68 -0
- package/services/FunctionService.js +103 -0
- package/services/IntegrationService.d.ts +48 -0
- package/services/IntegrationService.js +77 -0
- package/services/MapService.d.ts +96 -0
- package/services/MapService.js +119 -0
- package/services/PlatformTimeService.d.ts +35 -0
- package/services/PlatformTimeService.js +160 -0
- package/services/ProfileService.d.ts +244 -0
- package/services/ProfileService.js +366 -0
- package/services/ProjectService.d.ts +110 -0
- package/services/ProjectService.js +164 -0
- package/services/RobotService.d.ts +282 -0
- package/services/RobotService.js +467 -0
- package/services/ScheduleService.d.ts +22 -0
- package/services/ScheduleService.js +40 -0
- package/services/SearchService.d.ts +25 -0
- package/services/SearchService.js +93 -0
- package/services/SearchServiceNode.d.ts +6 -0
- package/services/SearchServiceNode.js +11 -0
- package/services/SpotProvisioningService.d.ts +14 -0
- package/services/SpotProvisioningService.js +43 -0
- package/services/SpotProvisioningServiceNode.d.ts +15 -0
- package/services/SpotProvisioningServiceNode.js +43 -0
- package/services/StreamService.d.ts +98 -0
- package/services/StreamService.js +146 -0
- package/services/TelemetryService.d.ts +43 -0
- package/services/TelemetryService.js +144 -0
- package/services/TelemetryServiceNode.d.ts +6 -0
- package/services/TelemetryServiceNode.js +11 -0
- package/services/TimeSyncerService.d.ts +13 -0
- package/services/TimeSyncerService.js +27 -0
- package/services/UserService.d.ts +200 -0
- package/services/UserService.js +319 -0
- package/services/WebRTCSignallingService.d.ts +22 -0
- package/services/WebRTCSignallingService.js +81 -0
- package/services/WorkflowService.d.ts +71 -0
- package/services/WorkflowService.js +122 -0
- package/services/index.d.ts +26 -0
- package/services/index.js +38 -0
- package/store/RocosStore.d.ts +31 -0
- package/store/RocosStore.js +53 -0
- package/utils/axisangle.d.ts +18 -0
- package/utils/axisangle.js +48 -0
- package/utils/eulerangles.d.ts +22 -0
- package/utils/eulerangles.js +133 -0
- package/utils/helperfunctions.d.ts +5 -0
- package/utils/helperfunctions.js +50 -0
- package/utils/localtransform.d.ts +17 -0
- package/utils/localtransform.js +50 -0
- package/utils/localtransformtree.d.ts +17 -0
- package/utils/localtransformtree.js +88 -0
- package/utils/misc.d.ts +17 -0
- package/utils/misc.js +23 -0
- package/utils/positionvector.d.ts +13 -0
- package/utils/positionvector.js +79 -0
- package/utils/quaternion.d.ts +20 -0
- package/utils/quaternion.js +62 -0
- package/utils/rotationmatrix.d.ts +23 -0
- package/utils/rotationmatrix.js +262 -0
- package/utils/transformationmatrix.d.ts +12 -0
- package/utils/transformationmatrix.js +123 -0
- package/utils/vector3.d.ts +11 -0
- package/utils/vector3.js +61 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CommandRequest } from '../../../grpc/rambo/rambo.v1_pb';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { CommandStreamAbstract } from './CommandStreamAbstract';
|
|
4
|
+
import { ICommandParams } from '../../../models/params/ICommandParams';
|
|
5
|
+
import { IRocosCommandMessage } from '../../../models/message/IRocosCommandMessage';
|
|
6
|
+
import { IStreamConfig } from '../../../models/IStreamConfig';
|
|
7
|
+
export declare class CommandStreamNode extends CommandStreamAbstract {
|
|
8
|
+
private client;
|
|
9
|
+
constructor(config: IStreamConfig);
|
|
10
|
+
protected callStream(request: CommandRequest, params: ICommandParams): Observable<IRocosCommandMessage>;
|
|
11
|
+
private getMetadata;
|
|
12
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.CommandStreamNode = void 0;
|
|
23
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
24
|
+
const rxjs_1 = require("rxjs");
|
|
25
|
+
const rambo_v1_grpc_pb_1 = require("../../../grpc/rambo/rambo.v1_grpc_pb");
|
|
26
|
+
const CommandStreamAbstract_1 = require("./CommandStreamAbstract");
|
|
27
|
+
const RocosCommandMessage_1 = require("../../../models/message/RocosCommandMessage");
|
|
28
|
+
const RocosLogger_1 = require("../../../logger/RocosLogger");
|
|
29
|
+
const SubscriberStatusEnum_1 = require("../../../models/SubscriberStatusEnum");
|
|
30
|
+
class CommandStreamNode extends CommandStreamAbstract_1.CommandStreamAbstract {
|
|
31
|
+
constructor(config) {
|
|
32
|
+
super(config);
|
|
33
|
+
this.logger = RocosLogger_1.RocosLogger.getInstance(`CommandStreamNode(${this.identifier})`);
|
|
34
|
+
const port = config.port || 443;
|
|
35
|
+
const credentials = config.insecure ? grpc.credentials.createInsecure() : grpc.credentials.createSsl();
|
|
36
|
+
this.client = new rambo_v1_grpc_pb_1.CommandClient(`${this.url}:${port}`, credentials);
|
|
37
|
+
}
|
|
38
|
+
callStream(request, params) {
|
|
39
|
+
const metadata = this.getMetadata(params.projectId, params.callsign);
|
|
40
|
+
let call;
|
|
41
|
+
return new rxjs_1.Observable((emitter) => {
|
|
42
|
+
call = this.client.callCommand(request, metadata);
|
|
43
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.ALIVE;
|
|
44
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
45
|
+
call.on('data', (update) => {
|
|
46
|
+
const message = RocosCommandMessage_1.RocosCommandMessage.fromModel(update);
|
|
47
|
+
emitter.next(message);
|
|
48
|
+
this.logger.debug('invokeRequest - on(data)', {
|
|
49
|
+
message,
|
|
50
|
+
projectId: params.projectId,
|
|
51
|
+
callsign: params.callsign,
|
|
52
|
+
commandId: params.commandId,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
call.on('end', () => {
|
|
56
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.STOPPED;
|
|
57
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
58
|
+
this.logger.debug('invokeRequest - on(end)', {
|
|
59
|
+
projectId: params.projectId,
|
|
60
|
+
callsign: params.callsign,
|
|
61
|
+
commandId: params.commandId,
|
|
62
|
+
});
|
|
63
|
+
emitter.complete();
|
|
64
|
+
});
|
|
65
|
+
call.on('close', () => {
|
|
66
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.STOPPED;
|
|
67
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
68
|
+
this.logger.debug('invokeRequest - on(close)');
|
|
69
|
+
});
|
|
70
|
+
call.on('error', (error) => {
|
|
71
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.ERROR;
|
|
72
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
73
|
+
this.logger.debug('invokeRequest - on(error)', error);
|
|
74
|
+
emitter.error(error);
|
|
75
|
+
});
|
|
76
|
+
return () => {
|
|
77
|
+
this.logger.debug('unsubscribing commandStream');
|
|
78
|
+
call.cancel();
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
getMetadata(projectId, callsign, subsystem) {
|
|
83
|
+
const meta = new grpc.Metadata();
|
|
84
|
+
meta.add('authorization', this.token);
|
|
85
|
+
meta.add('r-p', projectId);
|
|
86
|
+
meta.add('r-cs', callsign);
|
|
87
|
+
if (subsystem) {
|
|
88
|
+
meta.add('r-s', subsystem);
|
|
89
|
+
}
|
|
90
|
+
return meta;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.CommandStreamNode = CommandStreamNode;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ControlMessage } from '../../../grpc/robot-control/conker_pb';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ControlStreamAbstract } from './ControlStreamAbstract';
|
|
4
|
+
import { IControlParams } from '../../../models/params/IControlParams';
|
|
5
|
+
import { IRocosControlMessage } from '../../../models/message/IRocosControlMessage';
|
|
6
|
+
import { IStreamConfig } from '../../../models/IStreamConfig';
|
|
7
|
+
export declare class ControlStream extends ControlStreamAbstract {
|
|
8
|
+
private client;
|
|
9
|
+
constructor(config: IStreamConfig);
|
|
10
|
+
protected controlRobotCall(request: ControlMessage, params: IControlParams): void;
|
|
11
|
+
protected controlRobotCallWithAckStream(request: ControlMessage, params: IControlParams): Observable<IRocosControlMessage>;
|
|
12
|
+
protected setPayload(request: ControlMessage, payload: string): void;
|
|
13
|
+
private getMetadata;
|
|
14
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ControlStream = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const conker_pb_service_1 = require("../../../grpc/robot-control/conker_pb_service");
|
|
6
|
+
const ControlStreamAbstract_1 = require("./ControlStreamAbstract");
|
|
7
|
+
const RocosControlMessage_1 = require("../../../models/message/RocosControlMessage");
|
|
8
|
+
const RocosLogger_1 = require("../../../logger/RocosLogger");
|
|
9
|
+
const SubscriberStatusEnum_1 = require("../../../models/SubscriberStatusEnum");
|
|
10
|
+
const grpc_web_1 = require("@improbable-eng/grpc-web");
|
|
11
|
+
const stringToUint8Array_1 = require("../../../helpers/stringToUint8Array");
|
|
12
|
+
class ControlStream extends ControlStreamAbstract_1.ControlStreamAbstract {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
super(config);
|
|
15
|
+
this.logger = RocosLogger_1.RocosLogger.getInstance(`ControlStream(${this.identifier})`);
|
|
16
|
+
const protocol = config.insecure ? 'http' : 'https';
|
|
17
|
+
this.client = new conker_pb_service_1.RobotControlClient(`${protocol}://${this.url}`);
|
|
18
|
+
}
|
|
19
|
+
controlRobotCall(request, params) {
|
|
20
|
+
const metadata = this.getMetadata(params.projectId, params.callsign);
|
|
21
|
+
this.client.controlRobotCall(request, metadata, (err, ack) => {
|
|
22
|
+
return null;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
controlRobotCallWithAckStream(request, params) {
|
|
26
|
+
const metadata = this.getMetadata(params.projectId, params.callsign);
|
|
27
|
+
let call;
|
|
28
|
+
return new rxjs_1.Observable((emitter) => {
|
|
29
|
+
// Send the message to back-end.
|
|
30
|
+
call = this.client.controlRobotCallWithAckStream(request, metadata);
|
|
31
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.ALIVE;
|
|
32
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
33
|
+
call.on('data', (update) => {
|
|
34
|
+
const message = RocosControlMessage_1.RocosControlMessage.fromMessage(update);
|
|
35
|
+
emitter.next(message);
|
|
36
|
+
this.logger.debug('controlRobotCallWithAckStream - on(data)', {
|
|
37
|
+
message,
|
|
38
|
+
projectId: params.projectId,
|
|
39
|
+
callsign: params.callsign,
|
|
40
|
+
destination: params.destination,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
call.on('end', () => {
|
|
44
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.STOPPED;
|
|
45
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
46
|
+
this.logger.debug('controlRobotCallWithAckStream - on(end)', {
|
|
47
|
+
projectId: params.projectId,
|
|
48
|
+
callsign: params.callsign,
|
|
49
|
+
destination: params.destination,
|
|
50
|
+
});
|
|
51
|
+
emitter.complete();
|
|
52
|
+
});
|
|
53
|
+
call.on('status', (status) => {
|
|
54
|
+
this.logger.debug('controlRobotCallWithAckStream- on(status)', {
|
|
55
|
+
status,
|
|
56
|
+
projectId: params.projectId,
|
|
57
|
+
callsign: params.callsign,
|
|
58
|
+
destination: params.destination,
|
|
59
|
+
});
|
|
60
|
+
if (status.code !== grpc_web_1.grpc.Code.OK) {
|
|
61
|
+
emitter.error({ details: status.details, code: status.code });
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return () => {
|
|
65
|
+
this.logger.debug('unsubscribing controlRobotCallWithAckStream');
|
|
66
|
+
call.cancel();
|
|
67
|
+
};
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
setPayload(request, payload) {
|
|
71
|
+
request.setPayload(stringToUint8Array_1.stringToUint8Array(payload));
|
|
72
|
+
}
|
|
73
|
+
getMetadata(projectId, callsign) {
|
|
74
|
+
return {
|
|
75
|
+
'authorization': this.token,
|
|
76
|
+
'r-p': projectId,
|
|
77
|
+
'r-cs': callsign,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.ControlStream = ControlStream;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BehaviorSubject, Observable } from 'rxjs';
|
|
2
|
+
import { ControlActionType, IControlParams } from '../../../models/params/IControlParams';
|
|
3
|
+
import { ControlMessage } from '../../../grpc/robot-control/conker_pb';
|
|
4
|
+
import { IControlStream } from '../../../models/stream/IControlStream';
|
|
5
|
+
import { IRocosControlMessage } from '../../../models/message/IRocosControlMessage';
|
|
6
|
+
import { IStreamConfig } from '../../../models/IStreamConfig';
|
|
7
|
+
import { Logger } from 'loglevel';
|
|
8
|
+
import { SubscriberStatusEnum } from '../../../models/SubscriberStatusEnum';
|
|
9
|
+
export declare abstract class ControlStreamAbstract implements IControlStream {
|
|
10
|
+
identifier: string;
|
|
11
|
+
statusStream$: BehaviorSubject<SubscriberStatusEnum>;
|
|
12
|
+
protected token: string;
|
|
13
|
+
private scope;
|
|
14
|
+
protected url: string;
|
|
15
|
+
protected subscriberStatus: SubscriberStatusEnum;
|
|
16
|
+
protected logger: Logger;
|
|
17
|
+
constructor(config: IStreamConfig);
|
|
18
|
+
protected abstract controlRobotCall(request: ControlMessage, params: IControlParams): void;
|
|
19
|
+
protected abstract controlRobotCallWithAckStream(request: ControlMessage, params: IControlParams): Observable<IRocosControlMessage>;
|
|
20
|
+
protected abstract setPayload(request: ControlMessage, payload: string): void;
|
|
21
|
+
setToken(token: string): void;
|
|
22
|
+
stopStream(): void;
|
|
23
|
+
takeActionWithAck(action: ControlActionType, params: IControlParams, ackTimeoutInSeconds?: number): Observable<string>;
|
|
24
|
+
sendCommand(params: IControlParams): void;
|
|
25
|
+
sendCommandWithAck(params: IControlParams): Observable<IRocosControlMessage>;
|
|
26
|
+
private sendCommandToRobot;
|
|
27
|
+
private setRequestMeta;
|
|
28
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ControlStreamAbstract = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const conker_pb_1 = require("../../../grpc/robot-control/conker_pb");
|
|
6
|
+
const identifier_1 = require("../../../constants/identifier");
|
|
7
|
+
const RocosStore_1 = require("../../../store/RocosStore");
|
|
8
|
+
const StreamRegister_1 = require("../../StreamRegister");
|
|
9
|
+
const SubscriberStatusEnum_1 = require("../../../models/SubscriberStatusEnum");
|
|
10
|
+
const operators_1 = require("rxjs/operators");
|
|
11
|
+
class ControlStreamAbstract {
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.STOPPED;
|
|
14
|
+
this.scope = config.scope;
|
|
15
|
+
this.identifier = StreamRegister_1.StreamRegister.getIdentifier(identifier_1.IDENTIFIER_NAME_CONTROL, this.scope);
|
|
16
|
+
this.token = config.token;
|
|
17
|
+
this.url = config.url;
|
|
18
|
+
this.statusStream$ = new rxjs_1.BehaviorSubject(SubscriberStatusEnum_1.SubscriberStatusEnum.STOPPED);
|
|
19
|
+
RocosStore_1.RocosStore.getChangeSubject()
|
|
20
|
+
.pipe(operators_1.filter((message) => {
|
|
21
|
+
return message.type === 'token' && message.url === this.url;
|
|
22
|
+
}))
|
|
23
|
+
.subscribe((msg) => {
|
|
24
|
+
this.token = msg.data;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
setToken(token) {
|
|
28
|
+
this.token = token;
|
|
29
|
+
}
|
|
30
|
+
stopStream() {
|
|
31
|
+
// do nothing for now
|
|
32
|
+
}
|
|
33
|
+
takeActionWithAck(action, params, ackTimeoutInSeconds = 15) {
|
|
34
|
+
return new rxjs_1.Observable((emitter) => {
|
|
35
|
+
if (action && params) {
|
|
36
|
+
switch (action) {
|
|
37
|
+
case 'rosbridge-control':
|
|
38
|
+
if (!params.projectId || !params.callsign) {
|
|
39
|
+
emitter.error(new Error('Cannot find the type or metadata.'));
|
|
40
|
+
emitter.complete();
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const timer = setTimeout(() => {
|
|
44
|
+
emitter.error(new Error(`Timeout (${ackTimeoutInSeconds} seconds).`));
|
|
45
|
+
emitter.complete();
|
|
46
|
+
clearTimeout(timer);
|
|
47
|
+
}, ackTimeoutInSeconds * 1000);
|
|
48
|
+
this.sendCommandWithAck(params).subscribe((msg) => {
|
|
49
|
+
const { message } = msg;
|
|
50
|
+
if (msg.stage === 'final') {
|
|
51
|
+
if (msg.success) {
|
|
52
|
+
emitter.next(`${message}`);
|
|
53
|
+
emitter.complete();
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
emitter.error(new Error('Failed!'));
|
|
57
|
+
emitter.complete();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
clearTimeout(timer);
|
|
61
|
+
}, (err) => {
|
|
62
|
+
emitter.error(err);
|
|
63
|
+
emitter.complete();
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
emitter.error(new Error(`Cannot handle this type: ${action}.`));
|
|
69
|
+
emitter.complete();
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
emitter.error(new Error('Cannot find the type or metadata.'));
|
|
75
|
+
emitter.complete();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
sendCommand(params) {
|
|
80
|
+
this.sendCommandToRobot(params);
|
|
81
|
+
}
|
|
82
|
+
sendCommandWithAck(params) {
|
|
83
|
+
const request = new conker_pb_1.ControlMessage();
|
|
84
|
+
this.setPayload(request, params.payload);
|
|
85
|
+
request.setDestination(params.destination);
|
|
86
|
+
this.setRequestMeta(request, params.meta);
|
|
87
|
+
return this.controlRobotCallWithAckStream(request, params);
|
|
88
|
+
}
|
|
89
|
+
sendCommandToRobot(params) {
|
|
90
|
+
// Compose the request message
|
|
91
|
+
const request = new conker_pb_1.ControlMessage();
|
|
92
|
+
request.setDestination(params.destination);
|
|
93
|
+
this.setPayload(request, params.payload);
|
|
94
|
+
this.setRequestMeta(request, params.meta);
|
|
95
|
+
// Send the message to back-end.
|
|
96
|
+
this.controlRobotCall(request, params);
|
|
97
|
+
}
|
|
98
|
+
setRequestMeta(request, meta) {
|
|
99
|
+
if (meta) {
|
|
100
|
+
Object.keys(meta).forEach((item) => {
|
|
101
|
+
if ((meta === null || meta === void 0 ? void 0 : meta[item]) !== undefined) {
|
|
102
|
+
request.getMetaMap().set(item, meta[item]);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.ControlStreamAbstract = ControlStreamAbstract;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ControlMessage } from '../../../grpc/robot-control/conker_pb';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ControlStreamAbstract } from './ControlStreamAbstract';
|
|
4
|
+
import { IControlParams } from '../../../models/params/IControlParams';
|
|
5
|
+
import { IRocosControlMessage } from '../../../models/message/IRocosControlMessage';
|
|
6
|
+
import { IStreamConfig } from '../../../models/IStreamConfig';
|
|
7
|
+
export declare class ControlStreamNode extends ControlStreamAbstract {
|
|
8
|
+
private client;
|
|
9
|
+
constructor(config: IStreamConfig);
|
|
10
|
+
protected controlRobotCall(request: ControlMessage, params: IControlParams): void;
|
|
11
|
+
protected controlRobotCallWithAckStream(request: ControlMessage, params: IControlParams): Observable<IRocosControlMessage>;
|
|
12
|
+
protected setPayload(request: ControlMessage, payload: string): void;
|
|
13
|
+
private getMetadata;
|
|
14
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.ControlStreamNode = void 0;
|
|
23
|
+
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
24
|
+
const rxjs_1 = require("rxjs");
|
|
25
|
+
const ControlStreamAbstract_1 = require("./ControlStreamAbstract");
|
|
26
|
+
const conker_grpc_pb_1 = require("../../../grpc/robot-control/conker_grpc_pb");
|
|
27
|
+
const RocosControlMessage_1 = require("../../../models/message/RocosControlMessage");
|
|
28
|
+
const RocosLogger_1 = require("../../../logger/RocosLogger");
|
|
29
|
+
const SubscriberStatusEnum_1 = require("../../../models/SubscriberStatusEnum");
|
|
30
|
+
class ControlStreamNode extends ControlStreamAbstract_1.ControlStreamAbstract {
|
|
31
|
+
constructor(config) {
|
|
32
|
+
super(config);
|
|
33
|
+
this.logger = RocosLogger_1.RocosLogger.getInstance(`ControlStreamNode(${this.identifier})`);
|
|
34
|
+
const port = config.port || 443;
|
|
35
|
+
const credentials = config.insecure ? grpc.credentials.createInsecure() : grpc.credentials.createSsl();
|
|
36
|
+
this.client = new conker_grpc_pb_1.RobotControlClient(`${this.url}:${port}`, credentials);
|
|
37
|
+
}
|
|
38
|
+
controlRobotCall(request, params) {
|
|
39
|
+
const metadata = this.getMetadata(params.projectId, params.callsign);
|
|
40
|
+
this.client.controlRobotCall(request, metadata, (err, ack) => {
|
|
41
|
+
return null;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
controlRobotCallWithAckStream(request, params) {
|
|
45
|
+
const metadata = this.getMetadata(params.projectId, params.callsign);
|
|
46
|
+
let call;
|
|
47
|
+
return new rxjs_1.Observable((emitter) => {
|
|
48
|
+
call = this.client.controlRobotCallWithAckStream(request, metadata);
|
|
49
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.ALIVE;
|
|
50
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
51
|
+
call.on('data', (update) => {
|
|
52
|
+
const message = RocosControlMessage_1.RocosControlMessage.fromMessage(update);
|
|
53
|
+
emitter.next(message);
|
|
54
|
+
this.logger.debug('controlRobotCallWithAckStream - on(data)', {
|
|
55
|
+
projectId: params.projectId,
|
|
56
|
+
callsign: params.callsign,
|
|
57
|
+
destination: params.destination,
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
call.on('end', () => {
|
|
61
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.STOPPED;
|
|
62
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
63
|
+
this.logger.debug('controlRobotCallWithAckStream - on(end)', {
|
|
64
|
+
projectId: params.projectId,
|
|
65
|
+
callsign: params.callsign,
|
|
66
|
+
destination: params.destination,
|
|
67
|
+
});
|
|
68
|
+
emitter.complete();
|
|
69
|
+
});
|
|
70
|
+
call.on('close', () => {
|
|
71
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.STOPPED;
|
|
72
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
73
|
+
this.logger.debug('controlRobotCallWithAckStream - on(close)');
|
|
74
|
+
});
|
|
75
|
+
call.on('error', (error) => {
|
|
76
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.ERROR;
|
|
77
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
78
|
+
this.logger.debug('controlRobotCallWithAckStream - on(error)', error);
|
|
79
|
+
emitter.error(error);
|
|
80
|
+
});
|
|
81
|
+
return () => {
|
|
82
|
+
this.logger.debug('unsubscribing controlRobotCallWithAckStream');
|
|
83
|
+
call.cancel();
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
setPayload(request, payload) {
|
|
88
|
+
request.setPayload(Buffer.from(payload).toString('base64'));
|
|
89
|
+
}
|
|
90
|
+
getMetadata(projectId, callsign) {
|
|
91
|
+
const meta = new grpc.Metadata();
|
|
92
|
+
meta.add('authorization', this.token);
|
|
93
|
+
meta.add('r-p', projectId);
|
|
94
|
+
meta.add('r-cs', callsign);
|
|
95
|
+
return meta;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.ControlStreamNode = ControlStreamNode;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FileAccessorStreamAbstract } from './FileAccessorStreamAbstract';
|
|
2
|
+
import { IFileAccessorReqOpParams } from '../../../models/params/IFileAccessorParams';
|
|
3
|
+
import { IRocosOpResultMessage } from '../../../models/message/IRocosOpResultMessage';
|
|
4
|
+
import { IStreamConfig } from '../../../models/IStreamConfig';
|
|
5
|
+
export declare class FileAccessorStream extends FileAccessorStreamAbstract {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(config: IStreamConfig);
|
|
8
|
+
serverReqOpInternal(params: IFileAccessorReqOpParams): Promise<IRocosOpResultMessage[]>;
|
|
9
|
+
private getMetadata;
|
|
10
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileAccessorStream = void 0;
|
|
4
|
+
const filagree_pb_1 = require("../../../grpc/file-accessor/filagree_pb");
|
|
5
|
+
const filagree_pb_service_1 = require("../../../grpc/file-accessor/filagree_pb_service");
|
|
6
|
+
const FileAccessorStreamAbstract_1 = require("./FileAccessorStreamAbstract");
|
|
7
|
+
const FileEnums_1 = require("../../../models/file/FileEnums");
|
|
8
|
+
const RocosLogger_1 = require("../../../logger/RocosLogger");
|
|
9
|
+
const RocosOpResultMessage_1 = require("../../../models/message/RocosOpResultMessage");
|
|
10
|
+
const SubscriberStatusEnum_1 = require("../../../models/SubscriberStatusEnum");
|
|
11
|
+
class FileAccessorStream extends FileAccessorStreamAbstract_1.FileAccessorStreamAbstract {
|
|
12
|
+
constructor(config) {
|
|
13
|
+
super(config);
|
|
14
|
+
this.logger = RocosLogger_1.RocosLogger.getInstance(`FileAccessorStream(${this.identifier})`);
|
|
15
|
+
const protocol = config.insecure ? 'http' : 'https';
|
|
16
|
+
this.client = new filagree_pb_service_1.FilagreeClient(`${protocol}://${this.url}`);
|
|
17
|
+
}
|
|
18
|
+
serverReqOpInternal(params) {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.ALIVE;
|
|
21
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
22
|
+
this.logger.debug('serverReqOp - request', {
|
|
23
|
+
status: this.subscriberStatus,
|
|
24
|
+
projectId: params.projectId,
|
|
25
|
+
callsign: params.callsign,
|
|
26
|
+
});
|
|
27
|
+
const req = new filagree_pb_1.OpRequest();
|
|
28
|
+
req.setOpcode(params.opCode);
|
|
29
|
+
req.setPath(params.path);
|
|
30
|
+
req.setTarget(params.target || FileEnums_1.OpRequestTarget.AGENT);
|
|
31
|
+
// Set map values
|
|
32
|
+
if (params.args) {
|
|
33
|
+
Object.keys(params.args).forEach((key) => {
|
|
34
|
+
var _a;
|
|
35
|
+
if ((_a = params === null || params === void 0 ? void 0 : params.args) === null || _a === void 0 ? void 0 : _a[key]) {
|
|
36
|
+
req.getArgsMap().set(key, params.args[key]);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const reqs = new filagree_pb_1.OpRequests();
|
|
41
|
+
reqs.setRequestsList([req]);
|
|
42
|
+
const metadata = this.getMetadata(params.projectId, params.callsign);
|
|
43
|
+
this.client.serverReqOp(reqs, metadata, (err, data) => {
|
|
44
|
+
if (err) {
|
|
45
|
+
reject(err);
|
|
46
|
+
}
|
|
47
|
+
else if (data) {
|
|
48
|
+
resolve(RocosOpResultMessage_1.RocosOpResultMessage.fromMessages(data));
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
reject('Error in serverReqOp call');
|
|
52
|
+
}
|
|
53
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.STOPPED;
|
|
54
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
55
|
+
this.logger.debug('serverReqOp - response', {
|
|
56
|
+
status: this.subscriberStatus,
|
|
57
|
+
projectId: params.projectId,
|
|
58
|
+
callsign: params.callsign,
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
getMetadata(projectId, callsign) {
|
|
64
|
+
const result = { authorization: this.token };
|
|
65
|
+
if (projectId) {
|
|
66
|
+
result['r-p'] = projectId;
|
|
67
|
+
}
|
|
68
|
+
if (callsign) {
|
|
69
|
+
result['r-cs'] = callsign;
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.FileAccessorStream = FileAccessorStream;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IFileAccessorParams, IFileAccessorReqOpParams } from '../../../models/params/IFileAccessorParams';
|
|
2
|
+
import { BehaviorSubject } from 'rxjs';
|
|
3
|
+
import { IFileAccessorStream } from '../../../models/stream/IFileAccessorStream';
|
|
4
|
+
import { IRocosOpResultMessage } from '../../../models/message/IRocosOpResultMessage';
|
|
5
|
+
import { IStreamConfig } from '../../../models/IStreamConfig';
|
|
6
|
+
import { Logger } from 'loglevel';
|
|
7
|
+
import { SubscriberStatusEnum } from '../../../models/SubscriberStatusEnum';
|
|
8
|
+
export declare abstract class FileAccessorStreamAbstract implements IFileAccessorStream {
|
|
9
|
+
identifier: string;
|
|
10
|
+
statusStream$: BehaviorSubject<SubscriberStatusEnum>;
|
|
11
|
+
protected token: string;
|
|
12
|
+
private scope;
|
|
13
|
+
protected url: string;
|
|
14
|
+
protected subscriberStatus: SubscriberStatusEnum;
|
|
15
|
+
protected logger: Logger;
|
|
16
|
+
constructor(config: IStreamConfig);
|
|
17
|
+
protected abstract serverReqOpInternal(params: IFileAccessorReqOpParams): Promise<IRocosOpResultMessage[]>;
|
|
18
|
+
setToken(token: string): void;
|
|
19
|
+
stopStream(): void;
|
|
20
|
+
serverReqOp(params: IFileAccessorReqOpParams): Promise<IRocosOpResultMessage[]>;
|
|
21
|
+
listFolder(params: IFileAccessorParams): Promise<IRocosOpResultMessage[]>;
|
|
22
|
+
downloadFile(params: IFileAccessorParams): Promise<IRocosOpResultMessage[]>;
|
|
23
|
+
getDownloadFileLinkByUsingBlob(params: IFileAccessorParams): Promise<any>;
|
|
24
|
+
uploadFile(params: IFileAccessorParams, file: File): Promise<any>;
|
|
25
|
+
private getPathForBlobSas;
|
|
26
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileAccessorStreamAbstract = void 0;
|
|
4
|
+
const FileEnums_1 = require("../../../models/file/FileEnums");
|
|
5
|
+
// import { BlockBlobClient } from '@azure/storage-blob'
|
|
6
|
+
const rxjs_1 = require("rxjs");
|
|
7
|
+
const identifier_1 = require("../../../constants/identifier");
|
|
8
|
+
const RocosStore_1 = require("../../../store/RocosStore");
|
|
9
|
+
const StreamRegister_1 = require("../../StreamRegister");
|
|
10
|
+
const SubscriberStatusEnum_1 = require("../../../models/SubscriberStatusEnum");
|
|
11
|
+
const operators_1 = require("rxjs/operators");
|
|
12
|
+
class FileAccessorStreamAbstract {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.subscriberStatus = SubscriberStatusEnum_1.SubscriberStatusEnum.STOPPED;
|
|
15
|
+
this.scope = config.scope;
|
|
16
|
+
this.identifier = StreamRegister_1.StreamRegister.getIdentifier(identifier_1.IDENTIFIER_NAME_FILE_ACCESSOR, this.scope);
|
|
17
|
+
this.token = config.token;
|
|
18
|
+
this.url = config.url;
|
|
19
|
+
this.statusStream$ = new rxjs_1.BehaviorSubject(SubscriberStatusEnum_1.SubscriberStatusEnum.STOPPED);
|
|
20
|
+
RocosStore_1.RocosStore.getChangeSubject()
|
|
21
|
+
.pipe(operators_1.filter((message) => {
|
|
22
|
+
return message.type === 'token' && message.url === this.url;
|
|
23
|
+
}))
|
|
24
|
+
.subscribe((msg) => {
|
|
25
|
+
this.token = msg.data;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
setToken(token) {
|
|
29
|
+
this.token = token;
|
|
30
|
+
}
|
|
31
|
+
stopStream() {
|
|
32
|
+
// do nothing for now
|
|
33
|
+
}
|
|
34
|
+
async serverReqOp(params) {
|
|
35
|
+
return this.serverReqOpInternal(params);
|
|
36
|
+
}
|
|
37
|
+
async listFolder(params) {
|
|
38
|
+
return this.serverReqOp(Object.assign(Object.assign({}, params), { opCode: FileEnums_1.OpCode.INFO }));
|
|
39
|
+
}
|
|
40
|
+
async downloadFile(params) {
|
|
41
|
+
return this.serverReqOp(Object.assign(Object.assign({}, params), { opCode: FileEnums_1.OpCode.READFILE }));
|
|
42
|
+
}
|
|
43
|
+
async getDownloadFileLinkByUsingBlob(params) {
|
|
44
|
+
const pathForBlobSas = this.getPathForBlobSas(params.projectId, params.callsign, params.path);
|
|
45
|
+
const msgs = await this.serverReqOp(Object.assign(Object.assign({}, params), { path: pathForBlobSas, opCode: FileEnums_1.OpCode.READFILE, target: FileEnums_1.OpRequestTarget.SERVER }));
|
|
46
|
+
if (msgs && msgs.length > 0) {
|
|
47
|
+
const [{ data: url }] = msgs;
|
|
48
|
+
if (url) {
|
|
49
|
+
return this.serverReqOp(Object.assign(Object.assign({}, params), { opCode: FileEnums_1.OpCode.BLOBPUT, target: FileEnums_1.OpRequestTarget.AGENT, args: { url } }));
|
|
50
|
+
}
|
|
51
|
+
throw new Error('Could not create SAS');
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
throw new Error('Could not create SAS');
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
async uploadFile(params, file) {
|
|
58
|
+
const pathForBlobSas = this.getPathForBlobSas(params.projectId, params.callsign, params.path);
|
|
59
|
+
const msgs = await this.serverReqOp(Object.assign(Object.assign({}, params), { path: pathForBlobSas, opCode: FileEnums_1.OpCode.BLOBSAS, target: FileEnums_1.OpRequestTarget.SERVER }));
|
|
60
|
+
if (msgs && msgs.length > 0) {
|
|
61
|
+
// TODO(matej): implement file upload using azure blob
|
|
62
|
+
// const [{ data: url }] = msgs
|
|
63
|
+
//
|
|
64
|
+
// if (url) {
|
|
65
|
+
// const client = new BlockBlobClient(url)
|
|
66
|
+
// return from(client.uploadBrowserData(file)).pipe(
|
|
67
|
+
// mergeMap((res) => {
|
|
68
|
+
// return this.serverReqOp(projectId, callsign, path, OpCode.BLOBGET, OpRequest.Target.AGENT, {
|
|
69
|
+
// url,
|
|
70
|
+
// })
|
|
71
|
+
// }),
|
|
72
|
+
// )
|
|
73
|
+
// }
|
|
74
|
+
throw new Error('Could not create SAS');
|
|
75
|
+
}
|
|
76
|
+
throw new Error('Could not create SAS');
|
|
77
|
+
}
|
|
78
|
+
getPathForBlobSas(projectId, callsign, path) {
|
|
79
|
+
return `/${callsign}${path}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.FileAccessorStreamAbstract = FileAccessorStreamAbstract;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FileAccessorStreamAbstract } from './FileAccessorStreamAbstract';
|
|
2
|
+
import { IFileAccessorReqOpParams } from '../../../models/params/IFileAccessorParams';
|
|
3
|
+
import { IRocosOpResultMessage } from '../../../models/message/IRocosOpResultMessage';
|
|
4
|
+
import { IStreamConfig } from '../../../models/IStreamConfig';
|
|
5
|
+
export declare class FileAccessorStreamNode extends FileAccessorStreamAbstract {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(config: IStreamConfig);
|
|
8
|
+
serverReqOpInternal(params: IFileAccessorReqOpParams): Promise<IRocosOpResultMessage[]>;
|
|
9
|
+
private getMetadata;
|
|
10
|
+
}
|