@dronedeploy/rocos-js-sdk 4.4.4 → 4.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +3 -0
- package/cjs/api/StreamRegister.d.ts +18 -3
- package/cjs/api/StreamRegister.js +71 -38
- package/cjs/api/atoms/StreamHeartbeat.js +2 -2
- package/cjs/api/streams/telemetry/TelemetryStreamAbstract.d.ts +8 -1
- package/cjs/api/streams/telemetry/TelemetryStreamAbstract.js +87 -40
- package/cjs/api/streams/webRTCSignalling/WebRTCSignallingStreamAbstract.js +1 -1
- package/cjs/constants/api.d.ts +3 -2
- package/cjs/constants/api.js +5 -4
- package/cjs/constants/identifier.d.ts +1 -0
- package/cjs/constants/identifier.js +2 -1
- package/cjs/helpers/getUniqueId.js +2 -1
- package/cjs/models/callsigns/CallsignsLookup.d.ts +4 -0
- package/cjs/models/callsigns/CallsignsLookup.js +19 -0
- package/cjs/models/robot-status/RobotStatus.d.ts +23 -0
- package/cjs/models/robot-status/RobotStatusEnums.d.ts +18 -6
- package/cjs/models/robot-status/RobotStatusEnums.js +18 -6
- package/cjs/services/AssetStorageService.js +6 -1
- package/cjs/services/BaseServiceAbstract.js +1 -1
- package/cjs/services/BaseStreamService.d.ts +12 -1
- package/cjs/services/BaseStreamService.js +19 -30
- package/cjs/services/EnvironmentService.d.ts +4 -0
- package/cjs/services/EnvironmentService.js +5 -1
- package/cjs/services/MapService.d.ts +15 -3
- package/cjs/services/MapService.js +25 -13
- package/cjs/services/RobotStatusService.d.ts +20 -1
- package/cjs/services/RobotStatusService.js +5 -0
- package/cjs/services/SearchService.js +1 -1
- package/cjs/services/TargetService.js +2 -2
- package/cjs/services/TelemetryService.d.ts +1 -2
- package/cjs/services/TelemetryService.js +30 -28
- package/cjs/services/WebRTCSignallingService.js +7 -9
- package/cjs/services/robot-status/connectivity.d.ts +16 -12
- package/cjs/services/robot-status/connectivity.js +26 -15
- package/cjs/services/robot-status/reportedStatus.d.ts +14 -1
- package/cjs/services/robot-status/reportedStatus.js +36 -1
- package/esm/api/StreamRegister.d.ts +18 -3
- package/esm/api/StreamRegister.js +71 -38
- package/esm/api/atoms/StreamHeartbeat.js +2 -2
- package/esm/api/streams/telemetry/TelemetryStreamAbstract.d.ts +8 -1
- package/esm/api/streams/telemetry/TelemetryStreamAbstract.js +88 -41
- package/esm/api/streams/webRTCSignalling/WebRTCSignallingStreamAbstract.js +2 -2
- package/esm/constants/api.d.ts +3 -2
- package/esm/constants/api.js +3 -2
- package/esm/constants/identifier.d.ts +1 -0
- package/esm/constants/identifier.js +1 -0
- package/esm/helpers/getUniqueId.js +2 -1
- package/esm/models/callsigns/CallsignsLookup.d.ts +4 -0
- package/esm/models/callsigns/CallsignsLookup.js +19 -0
- package/esm/models/robot-status/RobotStatus.d.ts +23 -0
- package/esm/models/robot-status/RobotStatusEnums.d.ts +18 -6
- package/esm/models/robot-status/RobotStatusEnums.js +18 -6
- package/esm/services/AssetStorageService.js +6 -1
- package/esm/services/BaseServiceAbstract.js +1 -1
- package/esm/services/BaseStreamService.d.ts +12 -1
- package/esm/services/BaseStreamService.js +19 -30
- package/esm/services/EnvironmentService.d.ts +4 -0
- package/esm/services/EnvironmentService.js +5 -1
- package/esm/services/MapService.d.ts +15 -3
- package/esm/services/MapService.js +26 -14
- package/esm/services/RobotStatusService.d.ts +20 -1
- package/esm/services/RobotStatusService.js +6 -1
- package/esm/services/SearchService.js +2 -2
- package/esm/services/TargetService.js +3 -3
- package/esm/services/TelemetryService.d.ts +1 -2
- package/esm/services/TelemetryService.js +31 -29
- package/esm/services/WebRTCSignallingService.js +8 -10
- package/esm/services/robot-status/connectivity.d.ts +16 -12
- package/esm/services/robot-status/connectivity.js +26 -15
- package/esm/services/robot-status/reportedStatus.d.ts +14 -1
- package/esm/services/robot-status/reportedStatus.js +35 -1
- package/package.json +7 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Copyright (c) 2026 DroneDeploy, Inc. All rights reserved.
|
|
2
|
+
|
|
3
|
+
This software is the confidential, proprietary property of DroneDeploy, Inc. and is licensed, not sold. No use, copying, modification, or distribution is permitted without DroneDeploy's prior written consent. Provided "AS IS" without warranty of any kind.
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import { IBaseStream } from '../models';
|
|
2
|
+
export interface IAcquiredStream<T extends IBaseStream> {
|
|
3
|
+
stream: T;
|
|
4
|
+
isNew: boolean;
|
|
5
|
+
/** Settles when the stream's one-time init completes; rejects (and evicts) if init fails. */
|
|
6
|
+
ready: Promise<void>;
|
|
7
|
+
/** Releases this holder's refcount. One-shot: extra calls are ignored. */
|
|
8
|
+
release: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Sole owner of stream lifecycle. Streams are shared per identifier and refcounted: acquireStream
|
|
12
|
+
* gets-or-creates and increments in one synchronous step, and the returned handle's release()
|
|
13
|
+
* tears the stream down when the last holder leaves. Teardown never happens outside
|
|
14
|
+
* release/removeAllStreams, so a held stream can not be stopped or replaced underneath its holders.
|
|
15
|
+
*/
|
|
2
16
|
export declare class StreamRegister {
|
|
3
|
-
private
|
|
17
|
+
private entries;
|
|
4
18
|
private logger;
|
|
5
19
|
private static instance;
|
|
6
20
|
private constructor();
|
|
7
21
|
static getInstance(): StreamRegister;
|
|
8
22
|
static getIdentifier($identifier: string, scope?: string): string;
|
|
9
|
-
|
|
23
|
+
acquireStream<T extends IBaseStream>(identifier: string, create: () => T, init: (stream: T) => Promise<void>): IAcquiredStream<T>;
|
|
10
24
|
getStream(identifier: string): IBaseStream | undefined;
|
|
11
|
-
removeStream(stream: IBaseStream): void;
|
|
12
25
|
removeAllStreams(): boolean;
|
|
26
|
+
private release;
|
|
27
|
+
private evict;
|
|
13
28
|
}
|
|
@@ -3,9 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StreamRegister = void 0;
|
|
4
4
|
const models_1 = require("../models");
|
|
5
5
|
const RocosLogger_1 = require("../logger/RocosLogger");
|
|
6
|
+
/**
|
|
7
|
+
* Sole owner of stream lifecycle. Streams are shared per identifier and refcounted: acquireStream
|
|
8
|
+
* gets-or-creates and increments in one synchronous step, and the returned handle's release()
|
|
9
|
+
* tears the stream down when the last holder leaves. Teardown never happens outside
|
|
10
|
+
* release/removeAllStreams, so a held stream can not be stopped or replaced underneath its holders.
|
|
11
|
+
*/
|
|
6
12
|
class StreamRegister {
|
|
7
13
|
constructor() {
|
|
8
|
-
this.
|
|
14
|
+
this.entries = new Map();
|
|
9
15
|
this.logger = RocosLogger_1.RocosLogger.getInstance('StreamRegister');
|
|
10
16
|
}
|
|
11
17
|
static getInstance() {
|
|
@@ -17,55 +23,83 @@ class StreamRegister {
|
|
|
17
23
|
static getIdentifier($identifier, scope) {
|
|
18
24
|
return `${$identifier}-${scope ?? ''}`;
|
|
19
25
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
existing.stopStream();
|
|
26
|
-
}
|
|
27
|
-
this.teleStreams.set(stream.identifier, stream);
|
|
26
|
+
acquireStream(identifier, create, init) {
|
|
27
|
+
let entry = this.entries.get(identifier);
|
|
28
|
+
let isNew = false;
|
|
29
|
+
if (entry) {
|
|
30
|
+
entry.refCount++;
|
|
28
31
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
else {
|
|
33
|
+
isNew = true;
|
|
34
|
+
const stream = create();
|
|
35
|
+
const ready = init(stream).catch((error) => {
|
|
36
|
+
this.logger.error(`Stream init failed, evicting. identifier: ${identifier}`, error);
|
|
37
|
+
try {
|
|
38
|
+
this.evict(identifier, stream);
|
|
39
|
+
}
|
|
40
|
+
catch (evictionError) {
|
|
41
|
+
this.logger.error(`Failed to evict after init failure. identifier: ${identifier}`, evictionError);
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
});
|
|
45
|
+
// `ready` is stored and shared; this discarded catch pins a rejection observer so an init
|
|
46
|
+
// failure can never surface as an unhandled rejection, while holders still see the rejection.
|
|
47
|
+
void ready.catch(() => undefined);
|
|
48
|
+
entry = { stream, refCount: 1, ready };
|
|
49
|
+
this.entries.set(identifier, entry);
|
|
37
50
|
}
|
|
51
|
+
const held = entry;
|
|
52
|
+
let released = false;
|
|
53
|
+
const release = () => {
|
|
54
|
+
// One-shot so a double release can never consume another holder's refcount.
|
|
55
|
+
if (released)
|
|
56
|
+
return;
|
|
57
|
+
released = true;
|
|
58
|
+
this.release(identifier, held);
|
|
59
|
+
};
|
|
60
|
+
return { stream: entry.stream, isNew, ready: entry.ready, release };
|
|
38
61
|
}
|
|
39
62
|
getStream(identifier) {
|
|
40
|
-
return this.
|
|
63
|
+
return this.entries.get(identifier)?.stream;
|
|
41
64
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// and evicting that would leave subscribers forking duplicate streams for the scope.
|
|
47
|
-
if (this.teleStreams.get(stream.identifier) === stream) {
|
|
48
|
-
this.teleStreams.delete(stream.identifier);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
catch (e) {
|
|
52
|
-
this.logger.error(`Failed to remove stream from list. identifier: ${stream.identifier}`, e);
|
|
53
|
-
if (e instanceof Error || typeof e === 'string') {
|
|
54
|
-
throw new models_1.RocosError(e, models_1.errorCodes.STREAM_LISTENER_ERROR);
|
|
65
|
+
removeAllStreams() {
|
|
66
|
+
for (const [, entry] of this.entries.entries()) {
|
|
67
|
+
try {
|
|
68
|
+
entry.stream.stopStream();
|
|
55
69
|
}
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
catch (e) {
|
|
71
|
+
this.logger.error(`error removing stream, ${e}`);
|
|
58
72
|
}
|
|
59
73
|
}
|
|
74
|
+
this.entries.clear();
|
|
75
|
+
return true;
|
|
60
76
|
}
|
|
61
|
-
|
|
77
|
+
release(identifier, entry) {
|
|
78
|
+
if (this.entries.get(identifier) !== entry)
|
|
79
|
+
return; // already evicted, or force-removed
|
|
80
|
+
entry.refCount--;
|
|
81
|
+
if (entry.refCount > 0)
|
|
82
|
+
return;
|
|
83
|
+
// Wait for init to settle before tearing down, so init can never open resources on an already
|
|
84
|
+
// stopped stream. A re-acquire in the meantime revives the entry and cancels the teardown.
|
|
85
|
+
void entry.ready
|
|
86
|
+
.catch(() => undefined)
|
|
87
|
+
.then(() => {
|
|
88
|
+
if (this.entries.get(identifier) === entry && entry.refCount <= 0) {
|
|
89
|
+
this.evict(identifier, entry.stream);
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
.catch((e) => this.logger.error(`Failed to evict stream. identifier: ${identifier}`, e));
|
|
93
|
+
}
|
|
94
|
+
evict(identifier, stream) {
|
|
62
95
|
try {
|
|
63
|
-
|
|
64
|
-
this.
|
|
96
|
+
if (this.entries.get(identifier)?.stream === stream) {
|
|
97
|
+
this.entries.delete(identifier);
|
|
65
98
|
}
|
|
99
|
+
stream.stopStream();
|
|
66
100
|
}
|
|
67
101
|
catch (e) {
|
|
68
|
-
this.logger.error(`
|
|
102
|
+
this.logger.error(`Failed to remove stream from list. identifier: ${identifier}`, e);
|
|
69
103
|
if (e instanceof Error || typeof e === 'string') {
|
|
70
104
|
throw new models_1.RocosError(e, models_1.errorCodes.STREAM_LISTENER_ERROR);
|
|
71
105
|
}
|
|
@@ -73,7 +107,6 @@ class StreamRegister {
|
|
|
73
107
|
throw e;
|
|
74
108
|
}
|
|
75
109
|
}
|
|
76
|
-
return true;
|
|
77
110
|
}
|
|
78
111
|
}
|
|
79
112
|
exports.StreamRegister = StreamRegister;
|
|
@@ -38,7 +38,7 @@ class StreamHeartbeat {
|
|
|
38
38
|
this.callback = callback;
|
|
39
39
|
this.timeout = timeout;
|
|
40
40
|
this.logger.info('Creating stream heartbeat');
|
|
41
|
-
this.interval = setInterval(this.callback, this.timeout);
|
|
41
|
+
this.interval = setInterval(() => this.callback?.(), this.timeout);
|
|
42
42
|
}
|
|
43
43
|
else {
|
|
44
44
|
this.logger.warn('Stream heartbeat already exists');
|
|
@@ -58,7 +58,7 @@ class StreamHeartbeat {
|
|
|
58
58
|
// if the health check has not started yet, we initialise it
|
|
59
59
|
if (!this.healthInterval) {
|
|
60
60
|
this.logger.debug('Starting health check timer');
|
|
61
|
-
this.healthInterval = setInterval(this.checkHealth, this.healthTimeout);
|
|
61
|
+
this.healthInterval = setInterval(() => void this.checkHealth(), this.healthTimeout);
|
|
62
62
|
this.healthLastSeenDate = new Date();
|
|
63
63
|
this.healthMisses = 0;
|
|
64
64
|
}
|
|
@@ -14,6 +14,7 @@ export declare abstract class TelemetryStreamAbstract implements ITelemetryStrea
|
|
|
14
14
|
protected token?: string;
|
|
15
15
|
private scope;
|
|
16
16
|
protected url: string;
|
|
17
|
+
private telemetryActionQueue;
|
|
17
18
|
private timerIntervalInSec;
|
|
18
19
|
protected subscriberStatus: SubscriberStatusEnum;
|
|
19
20
|
private checkerStartedAt?;
|
|
@@ -40,10 +41,17 @@ export declare abstract class TelemetryStreamAbstract implements ITelemetryStrea
|
|
|
40
41
|
stopStream(): void;
|
|
41
42
|
addSubscription(params: ITelemetryParams): void;
|
|
42
43
|
removeSubscription(params: ITelemetryParams, terminateReceiverGroup?: boolean): Promise<void>;
|
|
44
|
+
private isQueryLookup;
|
|
45
|
+
private getSubscribedSources;
|
|
43
46
|
sendAcknowledgment(uid: string, status: TelemetryAckStatus, noRetry: boolean): boolean;
|
|
44
47
|
private getSubscriptions;
|
|
45
48
|
protected onData(message: TelemetryStreamMessage, isStream: true): void;
|
|
46
49
|
protected onData(message: TelemetryMessage, isStream: false): void;
|
|
50
|
+
/**
|
|
51
|
+
* Gateway subscription state is a set mutated by deltas, so ordering is correctness: a concurrent
|
|
52
|
+
* unsubscribe landing last strands a subscribe and nothing re-adds it.
|
|
53
|
+
*/
|
|
54
|
+
private enqueueTelemetryAction;
|
|
47
55
|
private takeTelemetryAction;
|
|
48
56
|
protected listenMessagesAndRenew(): void;
|
|
49
57
|
private addTerminateToAction;
|
|
@@ -52,7 +60,6 @@ export declare abstract class TelemetryStreamAbstract implements ITelemetryStrea
|
|
|
52
60
|
* Auto resubscribe to reduce CPU usage.
|
|
53
61
|
*/
|
|
54
62
|
private autoResubscribe;
|
|
55
|
-
private isFoundCallsign;
|
|
56
63
|
private isFoundSource;
|
|
57
64
|
private isRegisteredMessage;
|
|
58
65
|
private updateReceivedDataStatsWithMessage;
|
|
@@ -9,11 +9,13 @@ const identifier_1 = require("../../../constants/identifier");
|
|
|
9
9
|
const RocosStore_1 = require("../../../store/RocosStore");
|
|
10
10
|
const StreamHeartbeat_1 = require("../../atoms/StreamHeartbeat");
|
|
11
11
|
const StreamRegister_1 = require("../../StreamRegister");
|
|
12
|
+
const arrayRemove_1 = require("../../../helpers/arrayRemove");
|
|
12
13
|
const arrayUnique_1 = require("../../../helpers/arrayUnique");
|
|
13
14
|
const operators_1 = require("rxjs/operators");
|
|
14
15
|
const getSubscriptionsDifference_1 = require("../../../helpers/getSubscriptionsDifference");
|
|
15
16
|
class TelemetryStreamAbstract {
|
|
16
17
|
constructor(config) {
|
|
18
|
+
this.telemetryActionQueue = Promise.resolve();
|
|
17
19
|
// /////////////////
|
|
18
20
|
// Subscriber Check
|
|
19
21
|
this.timerIntervalInSec = 1;
|
|
@@ -60,27 +62,44 @@ class TelemetryStreamAbstract {
|
|
|
60
62
|
}
|
|
61
63
|
this.subscriberStatus = models_1.SubscriberStatusEnum.STOPPED;
|
|
62
64
|
this.statusStream$.next(this.subscriberStatus);
|
|
65
|
+
// The stream is being torn down (the registry only stops a stream when it is evicted), so
|
|
66
|
+
// complete the status stream: this releases every service-level forwarder subscribed to it
|
|
67
|
+
// rather than leaving them attached to a dead instance.
|
|
68
|
+
this.statusStream$.complete();
|
|
63
69
|
}
|
|
64
70
|
addSubscription(params) {
|
|
65
71
|
this.logger.info('Adding subscriptions from stream', params.uniqueId);
|
|
66
72
|
if (!this.subscriptions.has(params.uniqueId)) {
|
|
73
|
+
const isQuery = this.isQueryLookup();
|
|
67
74
|
// get subscriptions before change
|
|
68
|
-
const before = this.getSubscriptions();
|
|
75
|
+
const before = isQuery ? {} : this.getSubscriptions();
|
|
69
76
|
this.subscriptions.set(params.uniqueId, {
|
|
70
77
|
...params,
|
|
71
78
|
count: 1, // set the count to one just in case it's set in param
|
|
72
79
|
});
|
|
73
80
|
// get subscriptions after change
|
|
74
|
-
const after = this.getSubscriptions();
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
const after = isQuery ? {} : this.getSubscriptions();
|
|
82
|
+
if (isQuery) {
|
|
83
|
+
// A query stream selects its callsigns server-side, so the callsign-keyed view above holds
|
|
84
|
+
// nothing for it: keep the query and diff on sources alone.
|
|
85
|
+
const sourcesBefore = this.sources;
|
|
86
|
+
this.sources = this.getSubscribedSources();
|
|
87
|
+
const toAdd = (0, arrayRemove_1.arrayRemove)(this.sources, sourcesBefore);
|
|
88
|
+
if (toAdd.length) {
|
|
89
|
+
this.logger.debug('New query subscriptions added, we need to refresh sources', { toAdd });
|
|
90
|
+
void this.enqueueTelemetryAction('subscribe', this.callsignsLookup, toAdd);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// assign the current values from state after change
|
|
95
|
+
this.callsignsLookup = new models_1.CallsignsLookup(Object.keys(after));
|
|
96
|
+
this.sources = (0, arrayUnique_1.arrayUnique)(Object.values(after).reduce((a, v) => a.concat(v), []));
|
|
97
|
+
// compare before and after subscriptions and only add the difference
|
|
98
|
+
const { toAdd } = (0, getSubscriptionsDifference_1.getSubscriptionsDifference)(before, after);
|
|
99
|
+
if (toAdd.callsigns.length && toAdd.sources.length) {
|
|
100
|
+
this.logger.debug('New subscriptions added, we need to refresh sources', { toAdd });
|
|
101
|
+
void this.enqueueTelemetryAction('subscribe', new models_1.CallsignsLookup(toAdd.callsigns), toAdd.sources);
|
|
102
|
+
}
|
|
84
103
|
}
|
|
85
104
|
}
|
|
86
105
|
else {
|
|
@@ -100,16 +119,24 @@ class TelemetryStreamAbstract {
|
|
|
100
119
|
if (subs.count)
|
|
101
120
|
return;
|
|
102
121
|
this.logger.info('Removing subscriptions from stream registry', params.uniqueId);
|
|
103
|
-
const
|
|
122
|
+
const isQuery = this.isQueryLookup();
|
|
123
|
+
const before = isQuery ? {} : this.getSubscriptions();
|
|
104
124
|
this.subscriptions.delete(params.uniqueId);
|
|
105
|
-
const after = this.getSubscriptions();
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
this.
|
|
109
|
-
this.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
125
|
+
const after = isQuery ? {} : this.getSubscriptions();
|
|
126
|
+
if (isQuery) {
|
|
127
|
+
const sourcesBefore = this.sources;
|
|
128
|
+
this.sources = this.getSubscribedSources();
|
|
129
|
+
const toRemove = (0, arrayRemove_1.arrayRemove)(sourcesBefore, this.sources);
|
|
130
|
+
if (toRemove.length) {
|
|
131
|
+
this.logger.debug('Query subscriptions removed, we need to refresh sources', { toRemove });
|
|
132
|
+
try {
|
|
133
|
+
await this.enqueueTelemetryAction('unsubscribe', this.callsignsLookup, toRemove, terminateReceiverGroup);
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
this.logger.error(`Failed to unsubscribe: ${err}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return;
|
|
113
140
|
}
|
|
114
141
|
// assign the current values from state after change
|
|
115
142
|
this.callsignsLookup = new models_1.CallsignsLookup(Object.keys(after));
|
|
@@ -118,13 +145,23 @@ class TelemetryStreamAbstract {
|
|
|
118
145
|
if (toRemove.callsigns.length && toRemove.sources.length) {
|
|
119
146
|
this.logger.debug('Subscriptions removed, we need to refresh sources', { toRemove });
|
|
120
147
|
try {
|
|
121
|
-
await this.
|
|
148
|
+
await this.enqueueTelemetryAction('unsubscribe', new models_1.CallsignsLookup(toRemove.callsigns), toRemove.sources, terminateReceiverGroup);
|
|
122
149
|
}
|
|
123
150
|
catch (err) {
|
|
124
151
|
this.logger.error(`Failed to unsubscribe: ${err}`);
|
|
125
152
|
}
|
|
126
153
|
}
|
|
127
154
|
}
|
|
155
|
+
isQueryLookup() {
|
|
156
|
+
return this.callsignsLookup?.isQuery() ?? false;
|
|
157
|
+
}
|
|
158
|
+
getSubscribedSources() {
|
|
159
|
+
const sources = [];
|
|
160
|
+
this.subscriptions.forEach((data) => {
|
|
161
|
+
sources.push(...data.sources);
|
|
162
|
+
});
|
|
163
|
+
return (0, arrayUnique_1.arrayUnique)(sources);
|
|
164
|
+
}
|
|
128
165
|
sendAcknowledgment(uid, status, noRetry) {
|
|
129
166
|
return this.sendAcknowledgmentInternal(uid, status, noRetry);
|
|
130
167
|
}
|
|
@@ -174,8 +211,8 @@ class TelemetryStreamAbstract {
|
|
|
174
211
|
this.subscriberId = subscriberId;
|
|
175
212
|
rocosMessage.subscriberId = this.subscriberId;
|
|
176
213
|
this.logger.info('onData', `subscriberId has been updated - ${subscriberId}`, { subscriberId });
|
|
177
|
-
void this.
|
|
178
|
-
this.heartbeat.start(this.sendHeartbeat, this.sendHeartbeatTime);
|
|
214
|
+
void this.enqueueTelemetryAction('subscribe');
|
|
215
|
+
this.heartbeat.start(() => this.sendHeartbeat(), this.sendHeartbeatTime);
|
|
179
216
|
isRobotMessage = false;
|
|
180
217
|
break;
|
|
181
218
|
}
|
|
@@ -211,25 +248,40 @@ class TelemetryStreamAbstract {
|
|
|
211
248
|
});
|
|
212
249
|
}
|
|
213
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Gateway subscription state is a set mutated by deltas, so ordering is correctness: a concurrent
|
|
253
|
+
* unsubscribe landing last strands a subscribe and nothing re-adds it.
|
|
254
|
+
*/
|
|
255
|
+
enqueueTelemetryAction(actionType, callsignsLookup, sources, terminate) {
|
|
256
|
+
const takeAction = () => this.takeTelemetryAction(actionType, callsignsLookup, sources, terminate);
|
|
257
|
+
const run = this.telemetryActionQueue.then(takeAction);
|
|
258
|
+
// The tail only signals whose turn it is, so it must never reject, otherwise one failed op
|
|
259
|
+
// would wedge every op queued behind it. Callers still see the failure through `run`.
|
|
260
|
+
this.telemetryActionQueue = run.then(() => undefined, () => undefined);
|
|
261
|
+
return run;
|
|
262
|
+
}
|
|
214
263
|
async takeTelemetryAction(actionType, callsignsLookup, sources, terminate) {
|
|
215
264
|
this.logger.debug('takeTelemetryAction', actionType);
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
265
|
+
// A config fault, not a race: this stream can never address a request.
|
|
266
|
+
if (!this.projectId) {
|
|
267
|
+
this.logger.warn('takeTelemetryAction', actionType, `${actionType} without a projectId - dropped`);
|
|
268
|
+
return Promise.resolve();
|
|
269
|
+
}
|
|
270
|
+
if (!this.subscriberId) {
|
|
271
|
+
// Deferred, not lost: `onData` re-asserts `this.sources` when the subscriberId arrives.
|
|
272
|
+
this.logger.debug('takeTelemetryAction', actionType, `${actionType} before the receiver was registered - deferred to the post-registration re-assert`);
|
|
221
273
|
return Promise.resolve();
|
|
222
274
|
}
|
|
223
275
|
const actionSources = sources ?? this.sources;
|
|
224
276
|
const actionCallsigns = callsignsLookup ?? this.callsignsLookup;
|
|
225
|
-
if (
|
|
277
|
+
if (!actionCallsigns.isQuery()) {
|
|
226
278
|
// Compose the request message
|
|
227
279
|
const req = teletubby_pb_1.TelemetryRequest.create({
|
|
228
280
|
subscriberId: this.subscriberId,
|
|
229
281
|
requestedActions: [
|
|
230
282
|
{
|
|
231
283
|
operation: actionType,
|
|
232
|
-
callsigns: actionCallsigns.
|
|
284
|
+
callsigns: actionCallsigns.getCallsigns(),
|
|
233
285
|
sources: actionSources,
|
|
234
286
|
},
|
|
235
287
|
],
|
|
@@ -241,12 +293,12 @@ class TelemetryStreamAbstract {
|
|
|
241
293
|
// Send the message to back-end.
|
|
242
294
|
return this.requestTelemetry(req);
|
|
243
295
|
}
|
|
244
|
-
|
|
245
|
-
|
|
296
|
+
const query = actionCallsigns.getQuery();
|
|
297
|
+
if (query) {
|
|
246
298
|
// We don't support nested query at the moment
|
|
247
299
|
const queryOrPredicatesList = [];
|
|
248
300
|
// Loop through user provided predicates to construct a telemetry query request
|
|
249
|
-
|
|
301
|
+
query.predicates.forEach((callsignsPredicate) => {
|
|
250
302
|
const queryOrPredicate = teletubby_pb_1.QueryOrPredicate.create({
|
|
251
303
|
content: {
|
|
252
304
|
oneofKind: 'predicate',
|
|
@@ -265,7 +317,7 @@ class TelemetryStreamAbstract {
|
|
|
265
317
|
sources: actionSources,
|
|
266
318
|
operation: actionType,
|
|
267
319
|
callsignQuery: {
|
|
268
|
-
operation:
|
|
320
|
+
operation: query.operation.valueOf(),
|
|
269
321
|
queryOrPredicates: queryOrPredicatesList,
|
|
270
322
|
},
|
|
271
323
|
});
|
|
@@ -382,16 +434,11 @@ class TelemetryStreamAbstract {
|
|
|
382
434
|
this.lastRobotMessageReceived = undefined;
|
|
383
435
|
this.registerReceiver();
|
|
384
436
|
}
|
|
385
|
-
isFoundCallsign(callsign) {
|
|
386
|
-
return this.callsignsLookup.lookupType === models_1.CallsignsLookupType.List
|
|
387
|
-
? this.callsignsLookup.lookupValue.indexOf(callsign) !== -1
|
|
388
|
-
: true; // If callsigns lookup option is query, we always return true
|
|
389
|
-
}
|
|
390
437
|
isFoundSource(source) {
|
|
391
438
|
return this.sources.indexOf(source) !== -1;
|
|
392
439
|
}
|
|
393
440
|
isRegisteredMessage(callsign, source) {
|
|
394
|
-
return this.
|
|
441
|
+
return this.callsignsLookup.includesCallsign(callsign) && this.isFoundSource(source);
|
|
395
442
|
}
|
|
396
443
|
updateReceivedDataStatsWithMessage(msg) {
|
|
397
444
|
const { source } = msg;
|
|
@@ -12,7 +12,7 @@ class WebRTCSignallingStreamAbstract {
|
|
|
12
12
|
constructor(config) {
|
|
13
13
|
this.subscriberStatus = models_1.SubscriberStatusEnum.STOPPED;
|
|
14
14
|
this.scope = config.scope;
|
|
15
|
-
this.identifier = StreamRegister_1.StreamRegister.getIdentifier(identifier_1.
|
|
15
|
+
this.identifier = StreamRegister_1.StreamRegister.getIdentifier(identifier_1.IDENTIFIER_NAME_WEBRTC_SIGNALLING, this.scope);
|
|
16
16
|
this.token = config.token;
|
|
17
17
|
this.url = config.url;
|
|
18
18
|
this.statusStream$ = new rxjs_1.BehaviorSubject(models_1.SubscriberStatusEnum.STOPPED);
|
package/cjs/constants/api.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare const API_PROJECT_ASSET_INTEGRATION_PROVIDERS_PATH_URL = "https:/
|
|
|
36
36
|
export declare const API_PROJECT_ASSET_INTEGRATIONS_PATH_URL = "https://{url}/projects/{projectId}/integrations";
|
|
37
37
|
export declare const API_PROJECT_ASSET_INTEGRATION_PATH_URL = "https://{url}/projects/{projectId}/integrations/{integrationId}";
|
|
38
38
|
export declare const API_PROJECT_ROBOT_ASSET_PATH_URL = "https://{url}/projects/{projectId}/robots/{callsign}/assets";
|
|
39
|
-
export declare const API_PROJECT_FLOW_ASSET_PATH_URL = "https://{url}/projects/{projectId}/flows/{
|
|
39
|
+
export declare const API_PROJECT_FLOW_ASSET_PATH_URL = "https://{url}/projects/{projectId}/flows/{flowId}/instances/{flowInstance}/assets";
|
|
40
40
|
export declare const API_PROJECT_MISSION_ASSETS_PATH_URL = "https://{url}/projects/{projectId}/missionassets";
|
|
41
41
|
export declare const API_PROJECT_MISSION_ASSET_PATH_URL = "https://{url}/projects/{projectId}/missionassets/{assetId}";
|
|
42
42
|
export declare const API_PROJECT_MAPPED_ASSETS_PATH_URL = "https://{url}/projects/{projectId}/mappedassets";
|
|
@@ -126,7 +126,7 @@ export declare const API_DD_INTEGRATION_LEVELS_URL = "https://{url}/projects/{pr
|
|
|
126
126
|
export declare const API_GRAPHS_MAPS_URL = "https://{url}/graphs/projects/{projectId}/maps";
|
|
127
127
|
export declare const API_GRAPHS_MAPS_NEW_URL = "https://{url}/graphs/projects/{projectId}/maps/new";
|
|
128
128
|
export declare const API_GRAPHS_MAPS_DEPLOYED_URL = "https://{url}/graphs/projects/{projectId}/maps/deployed?callsign={callsign}";
|
|
129
|
-
export declare const
|
|
129
|
+
export declare const API_GRAPHS_MAPS_UNION_URL = "https://{url}/graphs/projects/{projectId}/maps/union";
|
|
130
130
|
export declare const API_GRAPHS_MAP_ID_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}";
|
|
131
131
|
export declare const API_GRAPHS_MAP_CONTENT_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/content";
|
|
132
132
|
export declare const API_GRAPHS_MAP_METADATA_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/metadata";
|
|
@@ -152,6 +152,7 @@ export declare const API_GRAPHS_TARGET_UPLOAD_URL = "https://{url}/graphs/projec
|
|
|
152
152
|
export declare const API_GRAPHS_TARGETS_URL = "https://{url}/graphs/projects/{projectId}/targets";
|
|
153
153
|
export declare const API_GRAPHS_ASSETS_UPLOAD_URL = "https://{url}/graphs/projects/{projectId}/assets/upload";
|
|
154
154
|
export declare const API_GRAPHS_ASSETS_URL = "https://{url}/graphs/projects/{projectId}/assets";
|
|
155
|
+
export declare const API_GRAPHS_TARGET_MEDIA_URL = "https://{url}/graphs/projects/{projectId}/targets/{targetId}/media";
|
|
155
156
|
export declare const API_PROJECT_WORKFLOW_URL = "https://{url}/projects/{projectId}/automate/flows";
|
|
156
157
|
export declare const API_PROJECT_WORKFLOW_ID_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}";
|
|
157
158
|
export declare const API_PROJECT_WORKFLOW_ASSET_URL = "https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets";
|
package/cjs/constants/api.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.API_PROJECT_ROBOT_EVENT_URL = exports.API_PROJECT_ROBOT_REGISTER_URL = exports.API_PROJECT_ROBOT_DEFINITION_URL = exports.API_PROJECT_ROBOT_ATTRIBUTES_URL = exports.API_PROJECT_ROBOT_ID_URL = exports.API_ACCOUNT_ROBOT_URL = exports.API_PROJECT_ROBOT_URL = exports.API_PROJECT_MAPPED_ASSET_PATH_URL = exports.API_PROJECT_MAPPED_ASSETS_PATH_URL = exports.API_PROJECT_MISSION_ASSET_PATH_URL = exports.API_PROJECT_MISSION_ASSETS_PATH_URL = exports.API_PROJECT_FLOW_ASSET_PATH_URL = exports.API_PROJECT_ROBOT_ASSET_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATION_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATIONS_PATH_URL = exports.API_PROJECT_ASSET_INTEGRATION_PROVIDERS_PATH_URL = exports.API_PROJECT_ASSET_PROFILES_SYNC_DEFINITION_PATH_URL = exports.API_PROJECT_ASSET_ROBOTS_SYNC_DEFINITION_PATH_URL = exports.API_PROJECT_ASSET_PATH_URL = exports.API_PROJECT_ASSET_URL = exports.API_PROJECT_USERS_URL = exports.API_PROJECT_ID_URL = exports.API_PROJECT_URL = exports.API_ACCOUNT_EXTERNAL_PROJECTS_URL = exports.API_ACCOUNT_PROJECT_APPLICATION_ID_URL = exports.API_ACCOUNT_PROJECT_APPLICATION_URL = exports.API_ACCOUNT_PROJECT_USER_ID_URL = exports.API_ACCOUNT_PROJECT_USER_URL = exports.API_ACCOUNT_PROJECT_ID_URL = exports.API_ACCOUNT_PROJECT_URL = exports.API_SERVER_TIME_URL = exports.API_ACCOUNT_SETTINGS_URL = exports.API_AUTH_USER_ACCOUNT_USER_ID_URL = exports.API_AUTH_USER_ACCOUNT_USER_URL = exports.API_ACCOUNT_ACTIVATE_URL = exports.API_ACCOUNT_ID_URL = exports.API_ACCOUNT_URL = exports.API_USER_PAT_TOKEN_URL = exports.API_USER_PAT_URL = exports.API_USER_VERIFY_EMAIL_URL = exports.API_USER_INVITATION_CHECK_URL = exports.API_USER_INVITATION_ACCEPT_URL = exports.API_USER_INVITATION_URL = exports.API_USER_PASSWORD_FORGOT_URL = exports.API_OTP_AUTH_URL = exports.API_OTP_URL = exports.API_USER_TOKEN_URL = exports.API_USER_URL = exports.API_ADMIN_USER_INVITATION_URL = exports.API_APPLICATION_AUTH_URL = void 0;
|
|
4
4
|
exports.API_PROJECT_STREAM_URL = exports.API_PROJECT_GROUP_TYPE_OWNER_OVERRIDE_URL = exports.API_PROJECT_GROUP_TYPE_OWNER_ID_URL = exports.API_PROJECT_GROUP_TYPE_VERSION_URL = exports.API_PROJECT_GROUP_TYPE_CONFIG_URL = exports.API_PROJECT_GROUP_TYPE_PUBLISH_URL = exports.API_PROJECT_GROUP_TYPE_ID_URL = exports.API_PROJECT_GROUP_TYPE_URL = exports.API_PROJECT_ENVIRONMENT_URL = exports.API_PROJECT_DEFINITION_LIBRARY = exports.API_PROJECT_DEFINITION_IMPORT_LIBRARY = exports.API_PROJECT_DEFINITION_IMPORT = exports.API_PROJECT_DEFINITION_EXPORT = exports.API_PROJECT_DEFINITION_GAMEPAD_URL = exports.API_PROJECT_DEFINITION_TRIGGER_URL = exports.API_PROJECT_DEFINITION_BUTTON_URL = exports.API_PROJECT_DEFINITION_ACTION_URL = exports.API_PROJECT_DEFINITION_EVENT_URL = exports.API_PROJECT_DEFINITION_COMMAND2_URL = exports.API_PROJECT_DEFINITION_COMMAND_URL = exports.API_PROJECT_DEFINITION_AGENT_URL = exports.API_PROJECT_DEFINITION_SETTING_URL = exports.API_PROJECT_DEFINITION_BLOB_URL = exports.API_PROJECT_DEFINITION_DASHBOARD_URL = exports.API_PROJECT_DEFINITION_COPY_URL = exports.API_PROJECT_DEFINITION_STREAM_URL = exports.API_PROJECT_DEFINITION_ID_URL = exports.API_PROJECT_DEFINITION_URL = exports.API_PROJECT_VROBOT_DEPLOY_URL = exports.API_PROJECT_VROBOT_DETAILS_URL = exports.API_PROJECT_COLLECTION_DOCS_URL = exports.API_PROJECT_COLLECTION_ID_URL = exports.API_PROJECT_DASHBOARD_CUSTOM_WIDGET_URL = exports.API_PROJECT_DASHBOARD_WIDGET_URL = exports.API_PROJECT_DASHBOARD_ID_URL = exports.API_PROJECT_DASHBOARD_URL = exports.API_PROJECT_OPERATION_ID_URL = exports.API_PROJECT_OPERATION_URL = exports.API_PROJECT_ROBOT_CONFIGS_CONNECTION_URL = exports.API_PROJECT_ROBOT_CONFIGS_CONNECTIONS_URL = exports.API_SERVICE_CONNECTION_URL = exports.API_SERVICE_CONNECTIONS_URL = exports.API_PROJECT_ROBOT_GAMEPAD_URL = exports.API_PROJECT_ROBOT_TRIGGER_URL = exports.API_PROJECT_ROBOT_BUTTON_URL = exports.API_PROJECT_ROBOT_COMMAND2_URL = exports.API_PROJECT_ROBOT_COMMAND_URL = exports.API_PROJECT_ROBOT_AGENT_URL = exports.API_PROJECT_ROBOT_SETTING_URL = exports.API_PROJECT_ROBOT_EVENT_HISTORY_URL = void 0;
|
|
5
|
-
exports.API_GRAPHS_OBSERVATION_KEYS_URL = exports.API_GRAPHS_OBSERVATIONS_URL = exports.API_GRAPHS_PANORAMA_OBSERVATIONS_URL = exports.API_GRAPHS_PANORAMA = exports.API_GRAPHS_PANORAMAS_URL = exports.API_GRAPHS_MAPS_GEOJSON_URL = exports.API_GRAPHS_MAPS_DEPLOY_URL = exports.API_GRAPHS_MAPS_COPY_URL = exports.API_GRAPHS_MAP_PATH_APPEND_TRANSFORMABLE_URL = exports.API_GRAPHS_MAP_PATH_APPEND_URL = exports.API_GRAPHS_MAP_PATH_URL = exports.API_GRAPHS_MAP_PATHS_URL = exports.API_GRAPHS_MAP_EDGE_URL = exports.API_GRAPHS_MAP_EDGES_ADD_TRANSFORM_URL = exports.API_GRAPHS_MAP_EDGES_ADD_URL = exports.API_GRAPHS_MAP_NODE_URL = exports.API_GRAPHS_MAP_NODES_ADD_TRANSFORMABLE_URL = exports.API_GRAPHS_MAP_NODES_ADD_URL = exports.API_GRAPHS_MAP_METADATA_URL = exports.API_GRAPHS_MAP_CONTENT_URL = exports.API_GRAPHS_MAP_ID_URL = exports.
|
|
6
|
-
exports.API_PROJECT_ROBOT_TAG_URL = exports.API_PROJECT_PROFILE_TAG_URL = exports.API_PROJECT_PROFILE_TAGS_URL = exports.API_PROJECT_TAG_ROBOTS_URL = exports.API_PROJECT_ROBOT_TAGS_URL = exports.API_DEVICE_CREDENTIALS_AUTH_URL = exports.API_DEVICE_CREDENTIALS_URL = exports.API_LINKED_PROJECT_URL = exports.API_PROJECT_WORKFLOW_IMPORT_URL = exports.API_PROJECT_WORKFLOW_EXPORT_URL = exports.API_PROJECT_WORKFLOW_AFFECTED_URL = exports.API_PROJECT_ROBOT_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_PROFILE_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_ROBOT_NO_PROFILE_DEPLOYMENTS_URL = exports.API_PROJECT_PROFILE_DEPLOYMENTS_URL = exports.API_PROJECT_ROBOT_DEPLOYMENTS_URL = exports.API_PROJECT_WORKFLOW_ASSET_ID_URL = exports.API_PROJECT_WORKFLOW_ASSET_URL = exports.API_PROJECT_WORKFLOW_ID_URL = exports.API_PROJECT_WORKFLOW_URL = exports.API_GRAPHS_ASSETS_URL = exports.API_GRAPHS_ASSETS_UPLOAD_URL = exports.API_GRAPHS_TARGETS_URL = exports.API_GRAPHS_TARGET_UPLOAD_URL = void 0;
|
|
5
|
+
exports.API_GRAPHS_OBSERVATION_KEYS_URL = exports.API_GRAPHS_OBSERVATIONS_URL = exports.API_GRAPHS_PANORAMA_OBSERVATIONS_URL = exports.API_GRAPHS_PANORAMA = exports.API_GRAPHS_PANORAMAS_URL = exports.API_GRAPHS_MAPS_GEOJSON_URL = exports.API_GRAPHS_MAPS_DEPLOY_URL = exports.API_GRAPHS_MAPS_COPY_URL = exports.API_GRAPHS_MAP_PATH_APPEND_TRANSFORMABLE_URL = exports.API_GRAPHS_MAP_PATH_APPEND_URL = exports.API_GRAPHS_MAP_PATH_URL = exports.API_GRAPHS_MAP_PATHS_URL = exports.API_GRAPHS_MAP_EDGE_URL = exports.API_GRAPHS_MAP_EDGES_ADD_TRANSFORM_URL = exports.API_GRAPHS_MAP_EDGES_ADD_URL = exports.API_GRAPHS_MAP_NODE_URL = exports.API_GRAPHS_MAP_NODES_ADD_TRANSFORMABLE_URL = exports.API_GRAPHS_MAP_NODES_ADD_URL = exports.API_GRAPHS_MAP_METADATA_URL = exports.API_GRAPHS_MAP_CONTENT_URL = exports.API_GRAPHS_MAP_ID_URL = exports.API_GRAPHS_MAPS_UNION_URL = exports.API_GRAPHS_MAPS_DEPLOYED_URL = exports.API_GRAPHS_MAPS_NEW_URL = exports.API_GRAPHS_MAPS_URL = exports.API_DD_INTEGRATION_LEVELS_URL = exports.API_DD_INTEGRATION_LOCATIONS_URL = exports.API_DD_INTEGRATION_ISSUES_URL = exports.API_DD_INTEGRATION_OVERLAYS_URL = exports.API_DD_INTEGRATION_PLAN_BY_ID_URL = exports.API_DD_INTEGRATION_PLANS_URL = exports.API_SPOTTY_URL = exports.API_PROJECT_SCHEDULES_URL = exports.API_SOURCE_ID_URL = exports.API_SOURCE_URL = exports.API_SOURCE_SCHEMA_URL = exports.API_TEMPLATE_EXPORTER_URL = exports.API_TEMPLATE_PROVISION_ID_URL = exports.API_TEMPLATE_PROVISION_URL = exports.API_TEMPLATE_DEPLOY_URL = exports.API_PROJECT_PROFILE_DASHBOARD_CUSTOM_WIDGET_URL = exports.API_PROJECT_PROFILE_DASHBOARD_ID_URL = exports.API_PROJECT_PROFILE_DASHBOARD_URL = exports.API_PROJECT_CALLSIGN_STREAM_URL = exports.API_PROJECT_ROBOT_DASHBOARD_CUSTOM_WIDGET_URL = exports.API_PROJECT_ROBOT_DASHBOARD_ID_URL = exports.API_PROJECT_ROBOT_DASHBOARD_URL = exports.API_PROJECT_STREAM_CALLSIGN_URL = exports.API_PROJECT_STREAM_DATA_URL = exports.API_PROJECT_STREAM_ID_URL = void 0;
|
|
6
|
+
exports.API_PROJECT_ROBOT_TAG_URL = exports.API_PROJECT_PROFILE_TAG_URL = exports.API_PROJECT_PROFILE_TAGS_URL = exports.API_PROJECT_TAG_ROBOTS_URL = exports.API_PROJECT_ROBOT_TAGS_URL = exports.API_DEVICE_CREDENTIALS_AUTH_URL = exports.API_DEVICE_CREDENTIALS_URL = exports.API_LINKED_PROJECT_URL = exports.API_PROJECT_WORKFLOW_IMPORT_URL = exports.API_PROJECT_WORKFLOW_EXPORT_URL = exports.API_PROJECT_WORKFLOW_AFFECTED_URL = exports.API_PROJECT_ROBOT_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_PROFILE_DEPLOYED_WORKFLOW_URL = exports.API_PROJECT_ROBOT_NO_PROFILE_DEPLOYMENTS_URL = exports.API_PROJECT_PROFILE_DEPLOYMENTS_URL = exports.API_PROJECT_ROBOT_DEPLOYMENTS_URL = exports.API_PROJECT_WORKFLOW_ASSET_ID_URL = exports.API_PROJECT_WORKFLOW_ASSET_URL = exports.API_PROJECT_WORKFLOW_ID_URL = exports.API_PROJECT_WORKFLOW_URL = exports.API_GRAPHS_TARGET_MEDIA_URL = exports.API_GRAPHS_ASSETS_URL = exports.API_GRAPHS_ASSETS_UPLOAD_URL = exports.API_GRAPHS_TARGETS_URL = exports.API_GRAPHS_TARGET_UPLOAD_URL = void 0;
|
|
7
7
|
exports.API_APPLICATION_AUTH_URL = 'https://{url}/applications/auth';
|
|
8
8
|
exports.API_ADMIN_USER_INVITATION_URL = 'https://{url}/admin/users/invitations';
|
|
9
9
|
exports.API_USER_URL = 'https://{url}/users';
|
|
@@ -42,7 +42,7 @@ exports.API_PROJECT_ASSET_INTEGRATION_PROVIDERS_PATH_URL = 'https://{url}/projec
|
|
|
42
42
|
exports.API_PROJECT_ASSET_INTEGRATIONS_PATH_URL = 'https://{url}/projects/{projectId}/integrations';
|
|
43
43
|
exports.API_PROJECT_ASSET_INTEGRATION_PATH_URL = 'https://{url}/projects/{projectId}/integrations/{integrationId}';
|
|
44
44
|
exports.API_PROJECT_ROBOT_ASSET_PATH_URL = 'https://{url}/projects/{projectId}/robots/{callsign}/assets';
|
|
45
|
-
exports.API_PROJECT_FLOW_ASSET_PATH_URL = 'https://{url}/projects/{projectId}/flows/{
|
|
45
|
+
exports.API_PROJECT_FLOW_ASSET_PATH_URL = 'https://{url}/projects/{projectId}/flows/{flowId}/instances/{flowInstance}/assets';
|
|
46
46
|
exports.API_PROJECT_MISSION_ASSETS_PATH_URL = 'https://{url}/projects/{projectId}/missionassets';
|
|
47
47
|
exports.API_PROJECT_MISSION_ASSET_PATH_URL = 'https://{url}/projects/{projectId}/missionassets/{assetId}';
|
|
48
48
|
exports.API_PROJECT_MAPPED_ASSETS_PATH_URL = 'https://{url}/projects/{projectId}/mappedassets';
|
|
@@ -134,7 +134,7 @@ exports.API_DD_INTEGRATION_LEVELS_URL = 'https://{url}/projects/{projectId}/dd/l
|
|
|
134
134
|
exports.API_GRAPHS_MAPS_URL = 'https://{url}/graphs/projects/{projectId}/maps';
|
|
135
135
|
exports.API_GRAPHS_MAPS_NEW_URL = 'https://{url}/graphs/projects/{projectId}/maps/new';
|
|
136
136
|
exports.API_GRAPHS_MAPS_DEPLOYED_URL = 'https://{url}/graphs/projects/{projectId}/maps/deployed?callsign={callsign}';
|
|
137
|
-
exports.
|
|
137
|
+
exports.API_GRAPHS_MAPS_UNION_URL = 'https://{url}/graphs/projects/{projectId}/maps/union';
|
|
138
138
|
exports.API_GRAPHS_MAP_ID_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}';
|
|
139
139
|
exports.API_GRAPHS_MAP_CONTENT_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/content';
|
|
140
140
|
exports.API_GRAPHS_MAP_METADATA_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/metadata';
|
|
@@ -160,6 +160,7 @@ exports.API_GRAPHS_TARGET_UPLOAD_URL = 'https://{url}/graphs/projects/{projectId
|
|
|
160
160
|
exports.API_GRAPHS_TARGETS_URL = 'https://{url}/graphs/projects/{projectId}/targets';
|
|
161
161
|
exports.API_GRAPHS_ASSETS_UPLOAD_URL = 'https://{url}/graphs/projects/{projectId}/assets/upload';
|
|
162
162
|
exports.API_GRAPHS_ASSETS_URL = 'https://{url}/graphs/projects/{projectId}/assets';
|
|
163
|
+
exports.API_GRAPHS_TARGET_MEDIA_URL = 'https://{url}/graphs/projects/{projectId}/targets/{targetId}/media';
|
|
163
164
|
exports.API_PROJECT_WORKFLOW_URL = 'https://{url}/projects/{projectId}/automate/flows';
|
|
164
165
|
exports.API_PROJECT_WORKFLOW_ID_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}';
|
|
165
166
|
exports.API_PROJECT_WORKFLOW_ASSET_URL = 'https://{url}/projects/{projectId}/automate/flows/{workflowId}/assets';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const IDENTIFIER_NAME_TELEMETRY = "telemetry";
|
|
2
2
|
export declare const IDENTIFIER_NAME_CALLER = "caller";
|
|
3
3
|
export declare const IDENTIFIER_NAME_COMMAND = "command";
|
|
4
|
+
export declare const IDENTIFIER_NAME_WEBRTC_SIGNALLING = "webRTCSignalling";
|
|
4
5
|
export declare const IDENTIFIER_NAME_CONTROL = "control";
|
|
5
6
|
export declare const IDENTIFIER_NAME_SEARCH = "search";
|
|
6
7
|
export declare const IDENTIFIER_NAME_FILE_ACCESSOR = "fileAccessor";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IDENTIFIER_NAME_FILE_ACCESSOR = exports.IDENTIFIER_NAME_SEARCH = exports.IDENTIFIER_NAME_CONTROL = exports.IDENTIFIER_NAME_COMMAND = exports.IDENTIFIER_NAME_CALLER = exports.IDENTIFIER_NAME_TELEMETRY = void 0;
|
|
3
|
+
exports.IDENTIFIER_NAME_FILE_ACCESSOR = exports.IDENTIFIER_NAME_SEARCH = exports.IDENTIFIER_NAME_CONTROL = exports.IDENTIFIER_NAME_WEBRTC_SIGNALLING = exports.IDENTIFIER_NAME_COMMAND = exports.IDENTIFIER_NAME_CALLER = exports.IDENTIFIER_NAME_TELEMETRY = void 0;
|
|
4
4
|
exports.IDENTIFIER_NAME_TELEMETRY = 'telemetry';
|
|
5
5
|
exports.IDENTIFIER_NAME_CALLER = 'caller';
|
|
6
6
|
exports.IDENTIFIER_NAME_COMMAND = 'command';
|
|
7
|
+
exports.IDENTIFIER_NAME_WEBRTC_SIGNALLING = 'webRTCSignalling';
|
|
7
8
|
exports.IDENTIFIER_NAME_CONTROL = 'control';
|
|
8
9
|
exports.IDENTIFIER_NAME_SEARCH = 'search';
|
|
9
10
|
exports.IDENTIFIER_NAME_FILE_ACCESSOR = 'fileAccessor';
|
|
@@ -10,6 +10,7 @@ const flattenCallsignsLookup_1 = require("./flattenCallsignsLookup");
|
|
|
10
10
|
* @param scope
|
|
11
11
|
*/
|
|
12
12
|
const getUniqueId = (projectId, callsignsLookup, sources, scope) => {
|
|
13
|
-
|
|
13
|
+
// Copy before sorting: the caller keeps this array, and filters incoming messages with it.
|
|
14
|
+
return [projectId, ...(0, flattenCallsignsLookup_1.flattenCallsignsLookup)(callsignsLookup), ...[...sources].sort(), scope].join();
|
|
14
15
|
};
|
|
15
16
|
exports.getUniqueId = getUniqueId;
|
|
@@ -4,5 +4,9 @@ export declare class CallsignsLookup {
|
|
|
4
4
|
lookupValue: CallsignsQuery | string[];
|
|
5
5
|
lookupType: CallsignsLookupType;
|
|
6
6
|
constructor(lookupValue: string[] | CallsignsQuery);
|
|
7
|
+
isQuery(): boolean;
|
|
8
|
+
getCallsigns(): string[];
|
|
9
|
+
getQuery(): CallsignsQuery | undefined;
|
|
10
|
+
includesCallsign(callsign: string): boolean;
|
|
7
11
|
toID(): string[];
|
|
8
12
|
}
|
|
@@ -22,6 +22,25 @@ class CallsignsLookup {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
isQuery() {
|
|
26
|
+
return this.lookupType === CallsignsEnums_1.CallsignsLookupType.Query;
|
|
27
|
+
}
|
|
28
|
+
getCallsigns() {
|
|
29
|
+
if (this.isQuery())
|
|
30
|
+
return [];
|
|
31
|
+
return this.lookupValue;
|
|
32
|
+
}
|
|
33
|
+
getQuery() {
|
|
34
|
+
if (!this.isQuery())
|
|
35
|
+
return undefined;
|
|
36
|
+
return this.lookupValue;
|
|
37
|
+
}
|
|
38
|
+
// A query resolves its callsigns server side, so there is no local list to match against.
|
|
39
|
+
includesCallsign(callsign) {
|
|
40
|
+
if (this.isQuery())
|
|
41
|
+
return true;
|
|
42
|
+
return this.getCallsigns().includes(callsign);
|
|
43
|
+
}
|
|
25
44
|
toID() {
|
|
26
45
|
if (this.lookupType === CallsignsEnums_1.CallsignsLookupType.List) {
|
|
27
46
|
return this.lookupValue.sort();
|