@dronedeploy/rocos-js-sdk 3.0.30 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/api/streams/caller/CallerStreamAbstract.js +1 -2
- package/cjs/api/streams/caller/CallerStreamNode.js +18 -8
- package/cjs/api/streams/command/CommandStreamNode.js +17 -7
- package/cjs/api/streams/control/ControlStreamNode.js +17 -7
- package/cjs/api/streams/fileAccessor/FileAccessorStreamNode.js +17 -7
- package/cjs/api/streams/search/SearchStreamNode.js +17 -7
- package/cjs/api/streams/telemetry/TelemetryStream.js +1 -0
- package/cjs/api/streams/telemetry/TelemetryStreamConnect.d.ts +26 -0
- package/cjs/api/streams/telemetry/TelemetryStreamConnect.js +145 -0
- package/cjs/api/streams/telemetry/TelemetryStreamNode.js +18 -9
- package/cjs/grpc/conker_pb.grpc-client.js +17 -7
- package/cjs/grpc/connect/teletubby_pb.d.ts +635 -0
- package/cjs/grpc/connect/teletubby_pb.js +196 -0
- package/cjs/grpc/filagree_pb.grpc-client.js +17 -7
- package/cjs/grpc/pigeon_pb.grpc-client.js +17 -7
- package/cjs/grpc/rambo.v1_pb.grpc-client.js +17 -7
- package/cjs/grpc/serviette.v1_pb.grpc-client.js +17 -7
- package/cjs/grpc/slowlane_pb.grpc-client.js +17 -7
- package/cjs/grpc/teletubby_pb.grpc-client.js +17 -7
- package/cjs/helpers/callerMessageHelpers.js +2 -3
- package/cjs/helpers/flattenOneOf.js +2 -3
- package/cjs/helpers/generateUUID.js +1 -2
- package/cjs/helpers/getSha256Hex.d.ts +1 -1
- package/cjs/helpers/getSha256HexNode.d.ts +1 -1
- package/cjs/helpers/kscript/index.js +17 -7
- package/cjs/helpers/kscript/utils.js +1 -2
- package/cjs/helpers/splitRobotTopic.js +1 -2
- package/cjs/helpers/stringToUint8Array.js +1 -8
- package/cjs/helpers/websandbox/connection.d.ts +1 -1
- package/cjs/logger/RocosLogger.js +9 -30
- package/cjs/models/IRocosSDKConfig.d.ts +2 -0
- package/cjs/models/IStreamConfig.d.ts +3 -0
- package/cjs/models/asset-storage/SyncIntegrations.d.ts +1 -2
- package/cjs/services/CallerService.js +1 -2
- package/cjs/services/SpotProvisioningServiceNode.d.ts +0 -1
- package/cjs/services/TelemetryService.js +5 -0
- package/esm/api/streams/caller/CallerStreamAbstract.js +1 -2
- package/esm/api/streams/caller/CallerStreamNode.js +1 -1
- package/esm/api/streams/telemetry/TelemetryStream.js +1 -0
- package/esm/api/streams/telemetry/TelemetryStreamConnect.d.ts +26 -0
- package/esm/api/streams/telemetry/TelemetryStreamConnect.js +141 -0
- package/esm/api/streams/telemetry/TelemetryStreamNode.js +1 -2
- package/esm/grpc/connect/teletubby_pb.d.ts +635 -0
- package/esm/grpc/connect/teletubby_pb.js +193 -0
- package/esm/helpers/generateUUID.js +1 -2
- package/esm/helpers/getSha256Hex.d.ts +1 -1
- package/esm/helpers/getSha256HexNode.d.ts +1 -1
- package/esm/helpers/stringToUint8Array.js +1 -8
- package/esm/helpers/websandbox/connection.d.ts +1 -1
- package/esm/logger/RocosLogger.js +9 -7
- package/esm/models/IRocosSDKConfig.d.ts +2 -0
- package/esm/models/IStreamConfig.d.ts +3 -0
- package/esm/models/asset-storage/SyncIntegrations.d.ts +1 -2
- package/esm/services/CallerService.js +1 -2
- package/esm/services/SpotProvisioningServiceNode.d.ts +0 -1
- package/esm/services/TelemetryService.js +5 -0
- package/package.json +5 -7
|
@@ -9,7 +9,6 @@ const identifier_1 = require("../../../constants/identifier");
|
|
|
9
9
|
const RocosStore_1 = require("../../../store/RocosStore");
|
|
10
10
|
const StreamRegister_1 = require("../../StreamRegister");
|
|
11
11
|
const operators_1 = require("rxjs/operators");
|
|
12
|
-
const uuid_1 = require("uuid");
|
|
13
12
|
class CallerStreamAbstract {
|
|
14
13
|
constructor(config) {
|
|
15
14
|
this.subscriberStatus = models_1.SubscriberStatusEnum.STOPPED;
|
|
@@ -81,7 +80,7 @@ class CallerStreamAbstract {
|
|
|
81
80
|
version: serviette_v1_pb_1.UIDVersion.HEADER_HASH_RAND,
|
|
82
81
|
content: {
|
|
83
82
|
oneofKind: 'hash',
|
|
84
|
-
hash: uid ??
|
|
83
|
+
hash: uid ?? crypto.randomUUID(),
|
|
85
84
|
},
|
|
86
85
|
},
|
|
87
86
|
payload: this.getPayload(payload),
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.CallerStreamNode = void 0;
|
|
27
37
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
@@ -128,7 +138,7 @@ class CallerStreamNode extends CallerStreamAbstract_1.CallerStreamAbstract {
|
|
|
128
138
|
});
|
|
129
139
|
}
|
|
130
140
|
getPayload(payload) {
|
|
131
|
-
return
|
|
141
|
+
return new TextEncoder().encode(payload);
|
|
132
142
|
}
|
|
133
143
|
getMetadata(projectId, callsign, subsystem) {
|
|
134
144
|
const meta = new grpc.Metadata();
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.CommandStreamNode = void 0;
|
|
27
37
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.ControlStreamNode = void 0;
|
|
27
37
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.FileAccessorStreamNode = void 0;
|
|
27
37
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.SearchStreamNode = void 0;
|
|
27
37
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
@@ -15,6 +15,7 @@ class TelemetryStream extends TelemetryStreamAbstract_1.TelemetryStreamAbstract
|
|
|
15
15
|
const port = config.port ? `:${config.port}` : '';
|
|
16
16
|
const transport = new grpcweb_transport_1.GrpcWebFetchTransport({
|
|
17
17
|
baseUrl: `${protocol}://${this.url}${port}`,
|
|
18
|
+
format: config.grpcWebFormat,
|
|
18
19
|
});
|
|
19
20
|
this.client = new teletubby_pb_client_1.TelemetryGatewayClient(transport);
|
|
20
21
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ITelemetryStreamConfig } from '../../../models';
|
|
2
|
+
import { TelemetryAckStatus, TelemetryQueryRequest, TelemetryRequest } from '../../../grpc/teletubby_pb';
|
|
3
|
+
import { TelemetryStreamAbstract } from './TelemetryStreamAbstract';
|
|
4
|
+
/**
|
|
5
|
+
* Connect-protocol telemetry receive stream. Mirrors TelemetryStream (grpc-web) but uses
|
|
6
|
+
* @connectrpc/connect. Selected when config.transport === 'connect'.
|
|
7
|
+
*
|
|
8
|
+
* The shared TelemetryStreamAbstract is typed with the protobuf-ts message types, while the
|
|
9
|
+
* Connect client uses @bufbuild/protobuf types. Both serialise to identical protobuf wire
|
|
10
|
+
* bytes, so we bridge across the boundary with toBinary/fromBinary rather than hand-written
|
|
11
|
+
* field mapping. This keeps all reconnect/subscription/heartbeat logic shared and untouched.
|
|
12
|
+
*/
|
|
13
|
+
export declare class TelemetryStreamConnect extends TelemetryStreamAbstract {
|
|
14
|
+
private client;
|
|
15
|
+
private abortController?;
|
|
16
|
+
constructor(config: ITelemetryStreamConfig);
|
|
17
|
+
protected stopInternal(): void;
|
|
18
|
+
protected registerReceiver(): () => void;
|
|
19
|
+
private onError;
|
|
20
|
+
private onEnd;
|
|
21
|
+
private getHeaders;
|
|
22
|
+
protected requestTelemetry(req: TelemetryRequest): Promise<void>;
|
|
23
|
+
protected requestTelemetryQuery(req: TelemetryQueryRequest): Promise<void>;
|
|
24
|
+
protected sendAcknowledgmentInternal(uid: string, status: TelemetryAckStatus, noRetry: boolean): boolean;
|
|
25
|
+
protected sendHeartbeat(): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TelemetryStreamConnect = void 0;
|
|
4
|
+
const connect_1 = require("@connectrpc/connect");
|
|
5
|
+
const models_1 = require("../../../models");
|
|
6
|
+
const teletubby_pb_1 = require("../../../grpc/connect/teletubby_pb");
|
|
7
|
+
const teletubby_pb_2 = require("../../../grpc/teletubby_pb");
|
|
8
|
+
const protobuf_1 = require("@bufbuild/protobuf");
|
|
9
|
+
const RocosLogger_1 = require("../../../logger/RocosLogger");
|
|
10
|
+
const TelemetryStreamAbstract_1 = require("./TelemetryStreamAbstract");
|
|
11
|
+
const connect_web_1 = require("@connectrpc/connect-web");
|
|
12
|
+
/**
|
|
13
|
+
* Connect-protocol telemetry receive stream. Mirrors TelemetryStream (grpc-web) but uses
|
|
14
|
+
* @connectrpc/connect. Selected when config.transport === 'connect'.
|
|
15
|
+
*
|
|
16
|
+
* The shared TelemetryStreamAbstract is typed with the protobuf-ts message types, while the
|
|
17
|
+
* Connect client uses @bufbuild/protobuf types. Both serialise to identical protobuf wire
|
|
18
|
+
* bytes, so we bridge across the boundary with toBinary/fromBinary rather than hand-written
|
|
19
|
+
* field mapping. This keeps all reconnect/subscription/heartbeat logic shared and untouched.
|
|
20
|
+
*/
|
|
21
|
+
class TelemetryStreamConnect extends TelemetryStreamAbstract_1.TelemetryStreamAbstract {
|
|
22
|
+
constructor(config) {
|
|
23
|
+
super(config);
|
|
24
|
+
this.logger = RocosLogger_1.RocosLogger.getInstance(`TelemetryStreamConnect(${this.identifier})`);
|
|
25
|
+
const protocol = config.insecure ? 'http' : 'https';
|
|
26
|
+
const port = config.port ? `:${config.port}` : '';
|
|
27
|
+
const transport = (0, connect_web_1.createConnectTransport)({
|
|
28
|
+
baseUrl: `${protocol}://${this.url}${port}`,
|
|
29
|
+
// Binary proto codec. The Connect default is JSON, which fails to decode real telemetry
|
|
30
|
+
// payloads containing control characters (verified against a live robot on dev) and is
|
|
31
|
+
// less efficient. Binary is required for correctness here.
|
|
32
|
+
useBinaryFormat: true,
|
|
33
|
+
});
|
|
34
|
+
this.client = (0, connect_1.createClient)(teletubby_pb_1.TelemetryGateway, transport);
|
|
35
|
+
}
|
|
36
|
+
stopInternal() {
|
|
37
|
+
if (this.abortController) {
|
|
38
|
+
this.logger.info('Starting stop stream process');
|
|
39
|
+
this.abortController.abort();
|
|
40
|
+
this.abortController = undefined;
|
|
41
|
+
this.logger.info('Finished stop stream process');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
registerReceiver() {
|
|
45
|
+
this.logger.info('registerReceiver');
|
|
46
|
+
// Reset counter
|
|
47
|
+
this.receivedMessagesCount = 0;
|
|
48
|
+
const abortController = new AbortController();
|
|
49
|
+
this.abortController = abortController;
|
|
50
|
+
void (async () => {
|
|
51
|
+
try {
|
|
52
|
+
const stream = this.client.registerReceiver((0, protobuf_1.create)(teletubby_pb_1.RegistrationMessageSchema, {}), {
|
|
53
|
+
headers: this.getHeaders(this.projectId),
|
|
54
|
+
signal: abortController.signal,
|
|
55
|
+
});
|
|
56
|
+
for await (const msg of stream) {
|
|
57
|
+
// Bridge connect-es message -> protobuf-ts TelemetryMessage with a direct field map.
|
|
58
|
+
// (Avoids a per-message re-serialize/re-parse; created/seq are int64/uint64 -> string
|
|
59
|
+
// for protobuf-ts's long_type_string config.)
|
|
60
|
+
const ptMsg = teletubby_pb_2.TelemetryMessage.create({
|
|
61
|
+
source: msg.source,
|
|
62
|
+
callsign: msg.callsign,
|
|
63
|
+
payload: msg.payload,
|
|
64
|
+
uid: msg.uid,
|
|
65
|
+
created: msg.created.toString(),
|
|
66
|
+
seq: msg.seq.toString(),
|
|
67
|
+
meta: msg.meta,
|
|
68
|
+
});
|
|
69
|
+
this.onData(ptMsg, false);
|
|
70
|
+
}
|
|
71
|
+
this.onEnd(true);
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
if (abortController.signal.aborted) {
|
|
75
|
+
this.logger.debug('registerReceiver', 'aborted');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
void this.onError(e);
|
|
79
|
+
this.onEnd(false);
|
|
80
|
+
}
|
|
81
|
+
})();
|
|
82
|
+
this.listenMessagesAndRenew();
|
|
83
|
+
return () => {
|
|
84
|
+
abortController.abort();
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
async onError(e) {
|
|
88
|
+
this.logger.error(`Telemetry Stream Error: ${e}, SubscriberId: ${this.subscriberId}`);
|
|
89
|
+
this.subscriberStatus = models_1.SubscriberStatusEnum.ERROR;
|
|
90
|
+
this.statusStream$.next(this.subscriberStatus);
|
|
91
|
+
}
|
|
92
|
+
onEnd(ok) {
|
|
93
|
+
this.logger.debug('registerReceiver', 'end');
|
|
94
|
+
if (ok) {
|
|
95
|
+
this.stopInternal();
|
|
96
|
+
this.registerReceiver();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
getHeaders(projectId) {
|
|
100
|
+
const result = {
|
|
101
|
+
// Canary marker: the istio VirtualService routes only requests carrying this header to
|
|
102
|
+
// the Connect-Go handler (:8083), leaving existing grpc-web traffic untouched. Harmless
|
|
103
|
+
// when the backend does a full cutover or is hit directly. Must match the chart's
|
|
104
|
+
// virtualService.routes.connect.matchHeader.
|
|
105
|
+
'x-tt-connect': '1',
|
|
106
|
+
};
|
|
107
|
+
if (this.token) {
|
|
108
|
+
result.authorization = this.token;
|
|
109
|
+
}
|
|
110
|
+
if (projectId) {
|
|
111
|
+
result['r-p'] = projectId;
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
async requestTelemetry(req) {
|
|
116
|
+
this.logger.debug('Sending telemetry request');
|
|
117
|
+
try {
|
|
118
|
+
const connectReq = (0, protobuf_1.fromBinary)(teletubby_pb_1.TelemetryRequestSchema, teletubby_pb_2.TelemetryRequest.toBinary(req));
|
|
119
|
+
await this.client.requestTelemetry(connectReq, { headers: this.getHeaders(this.projectId) });
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
this.logger.error('error requestTelemetry ', e);
|
|
123
|
+
throw e;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async requestTelemetryQuery(req) {
|
|
127
|
+
this.logger.debug('Requesting telemetry with query');
|
|
128
|
+
try {
|
|
129
|
+
const connectReq = (0, protobuf_1.fromBinary)(teletubby_pb_1.TelemetryQueryRequestSchema, teletubby_pb_2.TelemetryQueryRequest.toBinary(req));
|
|
130
|
+
await this.client.requestTelemetryQuery(connectReq, { headers: this.getHeaders(this.projectId) });
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
this.logger.error('error requestTelemetryQuery ', e);
|
|
134
|
+
throw e;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
sendAcknowledgmentInternal(uid, status, noRetry) {
|
|
138
|
+
this.logger.error('Error can not send Acknowledgment on connect client', { uid, status, noRetry });
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
sendHeartbeat() {
|
|
142
|
+
// Server-streaming Connect has no client->server channel for heartbeats.
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.TelemetryStreamConnect = TelemetryStreamConnect;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.TelemetryStreamNode = void 0;
|
|
27
37
|
const grpc = __importStar(require("@grpc/grpc-js"));
|
|
@@ -30,7 +40,6 @@ const teletubby_pb_1 = require("../../../grpc/teletubby_pb");
|
|
|
30
40
|
const RocosLogger_1 = require("../../../logger/RocosLogger");
|
|
31
41
|
const teletubby_pb_grpc_client_1 = require("../../../grpc/teletubby_pb.grpc-client");
|
|
32
42
|
const TelemetryStreamAbstract_1 = require("./TelemetryStreamAbstract");
|
|
33
|
-
const uuid_1 = require("uuid");
|
|
34
43
|
class TelemetryStreamNode extends TelemetryStreamAbstract_1.TelemetryStreamAbstract {
|
|
35
44
|
constructor(config) {
|
|
36
45
|
super(config);
|
|
@@ -130,7 +139,7 @@ class TelemetryStreamNode extends TelemetryStreamAbstract_1.TelemetryStreamAbstr
|
|
|
130
139
|
getMetaData() {
|
|
131
140
|
const meta = new grpc.Metadata();
|
|
132
141
|
meta.add('r-p', this.projectId);
|
|
133
|
-
meta.add('r-tid',
|
|
142
|
+
meta.add('r-tid', crypto.randomUUID());
|
|
134
143
|
meta.add('r-cs', 'rocos-js-sdk-agent');
|
|
135
144
|
if (this.token)
|
|
136
145
|
meta.add('authorization', this.token);
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.RobotControlClient = void 0;
|
|
27
37
|
/* eslint-disable */
|