@dronedeploy/rocos-js-sdk 3.0.31-rc1 → 3.1.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.
Files changed (65) hide show
  1. package/cjs/api/streams/caller/CallerStreamAbstract.js +1 -2
  2. package/cjs/api/streams/caller/CallerStreamNode.js +18 -8
  3. package/cjs/api/streams/command/CommandStreamNode.js +17 -7
  4. package/cjs/api/streams/control/ControlStreamNode.js +17 -7
  5. package/cjs/api/streams/fileAccessor/FileAccessorStreamNode.js +17 -7
  6. package/cjs/api/streams/search/SearchStreamNode.js +17 -7
  7. package/cjs/api/streams/telemetry/TelemetryStreamConnect.js +6 -0
  8. package/cjs/api/streams/telemetry/TelemetryStreamNode.js +18 -9
  9. package/cjs/constants/api.d.ts +3 -0
  10. package/cjs/constants/api.js +5 -2
  11. package/cjs/grpc/conker_pb.grpc-client.js +17 -7
  12. package/cjs/grpc/filagree_pb.grpc-client.js +17 -7
  13. package/cjs/grpc/pigeon_pb.grpc-client.js +17 -7
  14. package/cjs/grpc/rambo.v1_pb.grpc-client.js +17 -7
  15. package/cjs/grpc/serviette.v1_pb.grpc-client.js +17 -7
  16. package/cjs/grpc/slowlane_pb.grpc-client.js +17 -7
  17. package/cjs/grpc/teletubby_pb.grpc-client.js +17 -7
  18. package/cjs/helpers/callerMessageHelpers.js +2 -3
  19. package/cjs/helpers/flattenOneOf.js +2 -3
  20. package/cjs/helpers/generateUUID.js +1 -2
  21. package/cjs/helpers/getSha256Hex.d.ts +1 -1
  22. package/cjs/helpers/getSha256HexNode.d.ts +1 -1
  23. package/cjs/helpers/kscript/index.js +17 -7
  24. package/cjs/helpers/kscript/utils.js +1 -2
  25. package/cjs/helpers/splitRobotTopic.js +1 -2
  26. package/cjs/helpers/stringToUint8Array.js +1 -8
  27. package/cjs/helpers/websandbox/connection.d.ts +1 -1
  28. package/cjs/logger/RocosLogger.js +9 -30
  29. package/cjs/models/IRocosSDKConfig.d.ts +1 -0
  30. package/cjs/models/IStreamConfig.d.ts +1 -0
  31. package/cjs/models/asset-storage/SyncIntegrations.d.ts +1 -2
  32. package/cjs/models/index.d.ts +1 -0
  33. package/cjs/models/index.js +1 -0
  34. package/cjs/models/maps/MapContent.d.ts +26 -0
  35. package/cjs/models/maps/MapContent.js +2 -0
  36. package/cjs/services/CallerService.js +1 -2
  37. package/cjs/services/MapService.d.ts +58 -6
  38. package/cjs/services/MapService.js +68 -4
  39. package/cjs/services/SpotProvisioningServiceNode.d.ts +0 -1
  40. package/cjs/services/TelemetryService.js +1 -0
  41. package/esm/api/streams/caller/CallerStreamAbstract.js +1 -2
  42. package/esm/api/streams/caller/CallerStreamNode.js +1 -1
  43. package/esm/api/streams/telemetry/TelemetryStreamConnect.js +6 -0
  44. package/esm/api/streams/telemetry/TelemetryStreamNode.js +1 -2
  45. package/esm/constants/api.d.ts +3 -0
  46. package/esm/constants/api.js +3 -0
  47. package/esm/helpers/generateUUID.js +1 -2
  48. package/esm/helpers/getSha256Hex.d.ts +1 -1
  49. package/esm/helpers/getSha256HexNode.d.ts +1 -1
  50. package/esm/helpers/stringToUint8Array.js +1 -8
  51. package/esm/helpers/websandbox/connection.d.ts +1 -1
  52. package/esm/logger/RocosLogger.js +9 -7
  53. package/esm/models/IRocosSDKConfig.d.ts +1 -0
  54. package/esm/models/IStreamConfig.d.ts +1 -0
  55. package/esm/models/asset-storage/SyncIntegrations.d.ts +1 -2
  56. package/esm/models/index.d.ts +1 -0
  57. package/esm/models/index.js +1 -0
  58. package/esm/models/maps/MapContent.d.ts +26 -0
  59. package/esm/models/maps/MapContent.js +1 -0
  60. package/esm/services/CallerService.js +1 -2
  61. package/esm/services/MapService.d.ts +58 -6
  62. package/esm/services/MapService.js +69 -5
  63. package/esm/services/SpotProvisioningServiceNode.d.ts +0 -1
  64. package/esm/services/TelemetryService.js +1 -0
  65. package/package.json +5 -10
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.construct = void 0;
3
+ exports.construct = construct;
4
4
  const nodes_1 = require("./nodes");
5
5
  function construct(node, context) {
6
6
  if (!context.isNodeAllowed(node.type)) {
@@ -12,4 +12,3 @@ function construct(node, context) {
12
12
  }
13
13
  return Reflect.construct(nodeClass, [node, context]);
14
14
  }
15
- exports.construct = construct;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.splitRobotTopic = void 0;
3
+ exports.splitRobotTopic = splitRobotTopic;
4
4
  /** Splits a robot path string into component and topic.
5
5
  *
6
6
  * @example splitRobotTopic('/component/topic/a') => { component: 'component', topic: 'topic/a' }
@@ -13,4 +13,3 @@ function splitRobotTopic(path) {
13
13
  topic,
14
14
  };
15
15
  }
16
- exports.splitRobotTopic = splitRobotTopic;
@@ -1,14 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stringToUint8Array = void 0;
4
- const buffer_1 = require("buffer");
5
4
  const stringToUint8Array = (input) => {
6
- input = input ? input : '';
7
- const buf = new buffer_1.Buffer(input);
8
- const result = new Uint8Array(buf.length);
9
- for (let i = 0; i < buf.length; i++) {
10
- result[i] = buf[i];
11
- }
12
- return result;
5
+ return new TextEncoder().encode(input ? input : '');
13
6
  };
14
7
  exports.stringToUint8Array = stringToUint8Array;
@@ -38,7 +38,7 @@ export default class Connection<Local extends APIDeclaration<Local>, Remote exte
38
38
  * @param name - name of remote method to call
39
39
  * @param args - arguments to pass to remote method
40
40
  */
41
- callRemoteMethod<Method extends keyof Remote>(name: Method, ...args: Parameters<Remote[Method]>): Promise<ReturnType<Remote[Method]>>;
41
+ callRemoteMethod<Method extends keyof Remote>(name: Method, ...args: Remote[Method] extends (...args: infer A) => unknown ? A : never): Promise<Remote[Method] extends (...args: never) => infer R ? R : never>;
42
42
  /** Log a message if debug mode is enabled */
43
43
  log(...args: unknown[]): void;
44
44
  private onMessageListener;
@@ -1,41 +1,20 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.RocosLogger = void 0;
30
- const prefix = __importStar(require("loglevel-plugin-prefix"));
31
7
  const loglevel_1 = __importDefault(require("loglevel"));
8
+ const originalFactory = loglevel_1.default.methodFactory;
9
+ loglevel_1.default.methodFactory = (methodName, level, loggerName) => {
10
+ const rawMethod = originalFactory(methodName, level, loggerName);
11
+ const name = typeof loggerName === 'symbol' ? loggerName.toString() : loggerName;
12
+ return (...args) => {
13
+ rawMethod(`[${new Date()}] ${methodName.toUpperCase()} ${name}:`, ...args);
14
+ };
15
+ };
16
+ // setDefaultLevel applies the methodFactory above by rebuilding the logging methods
32
17
  loglevel_1.default.setDefaultLevel('silent');
33
- prefix.reg(loglevel_1.default);
34
- prefix.apply(loglevel_1.default, {
35
- format(level, name, timestamp) {
36
- return `[${timestamp}] ${level.toUpperCase()} ${name}:`;
37
- },
38
- });
39
18
  class RocosLogger {
40
19
  static getInstance(name) {
41
20
  if (name) {
@@ -12,6 +12,7 @@ interface ConfigBase {
12
12
  port?: number;
13
13
  insecure?: boolean;
14
14
  transport?: TelemetryTransport;
15
+ fetch?: typeof globalThis.fetch;
15
16
  hooks?: {
16
17
  http?: {
17
18
  onResponse?: (res: Response) => void;
@@ -9,4 +9,5 @@ export interface IStreamConfig {
9
9
  insecure?: boolean;
10
10
  transport?: TelemetryTransport;
11
11
  grpcWebFormat?: 'text' | 'binary';
12
+ fetch?: typeof globalThis.fetch;
12
13
  }
@@ -1,4 +1,3 @@
1
- import { JSONSchema7 } from 'json-schema';
2
1
  export interface AssetSyncDefinitionModel {
3
2
  path: string;
4
3
  enabled: boolean;
@@ -20,7 +19,7 @@ export interface AssetSyncDefinitionsModel<I extends AssetSyncDefinitionModel =
20
19
  export interface AssetSyncIntegrationProviderModel {
21
20
  provider: string;
22
21
  name: string;
23
- schema: JSONSchema7;
22
+ schema: Record<string, unknown>;
24
23
  }
25
24
  export interface AssetSyncIntegrationModel extends CreateAssetSyncIntegrationModel {
26
25
  id: string;
@@ -48,6 +48,7 @@ export * from './IToken';
48
48
  export * from './IWidget';
49
49
  export * from './IWidgetLineGroup';
50
50
  export * from './maps/Map';
51
+ export * from './maps/MapContent';
51
52
  export * from './maps/Panorama';
52
53
  export * from './message';
53
54
  export * from './params/ICallerParams';
@@ -64,6 +64,7 @@ __exportStar(require("./IToken"), exports);
64
64
  __exportStar(require("./IWidget"), exports);
65
65
  __exportStar(require("./IWidgetLineGroup"), exports);
66
66
  __exportStar(require("./maps/Map"), exports);
67
+ __exportStar(require("./maps/MapContent"), exports);
67
68
  __exportStar(require("./maps/Panorama"), exports);
68
69
  __exportStar(require("./message"), exports);
69
70
  __exportStar(require("./params/ICallerParams"), exports);
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Canonical JSON representation of a robot map's graph content.
3
+ *
4
+ * This is the body shape returned by `GET /graphs/projects/{projectId}/maps/{mapId}`
5
+ * and accepted by `PUT /graphs/projects/{projectId}/maps/{mapId}/content`. Distinct
6
+ * from {@link Map} (the listing/metadata model returned by `list()`).
7
+ */
8
+ export interface MapContent {
9
+ nodes: Record<string, MapContentNode>;
10
+ edges: Record<string, MapContentEdge>;
11
+ }
12
+ export interface MapContentNode {
13
+ id: string;
14
+ type: string;
15
+ edges: Record<string, unknown>;
16
+ data: Record<string, unknown>;
17
+ externalData?: Record<string, unknown>;
18
+ }
19
+ export interface MapContentEdge {
20
+ id: string;
21
+ from: string;
22
+ to: string;
23
+ type: string;
24
+ data: Record<string, unknown>;
25
+ externalData?: Record<string, unknown>;
26
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -9,7 +9,6 @@ const BaseStreamService_1 = require("./BaseStreamService");
9
9
  const CallerStream_1 = require("../api/streams/caller/CallerStream");
10
10
  const identifier_1 = require("../constants/identifier");
11
11
  const helpers_1 = require("../helpers");
12
- const uuid_1 = require("uuid");
13
12
  class CallerService extends BaseStreamService_1.BaseStreamService {
14
13
  constructor(config) {
15
14
  super('CallerService', config);
@@ -66,7 +65,7 @@ class CallerService extends BaseStreamService_1.BaseStreamService {
66
65
  }
67
66
  getCallerParams(params, component, topic) {
68
67
  return {
69
- uid: params.options?.uid ?? (0, uuid_1.v4)(),
68
+ uid: params.options?.uid ?? crypto.randomUUID(),
70
69
  projectId: params.projectId,
71
70
  callsign: params.callsign,
72
71
  subSystem: '',
@@ -1,4 +1,4 @@
1
- import { Asset, IBaseService, IRocosSDKConfig, Map, RocosError } from '../models';
1
+ import { Asset, IBaseService, IRocosSDKConfig, Map, MapContent, RocosError } from '../models';
2
2
  import { CreateObservation, Observation } from '../models/maps/Panorama';
3
3
  import { BaseServiceAbstract } from './BaseServiceAbstract';
4
4
  /**
@@ -50,7 +50,14 @@ export declare class MapService extends BaseServiceAbstract implements IBaseServ
50
50
  */
51
51
  get(projectId: string, mapId: string): Promise<Map>;
52
52
  /**
53
- * Updates a maps metadata
53
+ * Updates a map's metadata.
54
+ *
55
+ * @deprecated Hits the legacy `PUT /maps/{mapId}` endpoint that only accepts
56
+ * metadata; the giraffe API is migrating that endpoint toward "PUT the full
57
+ * resource" semantics (both metadata and content together). Prefer
58
+ * {@link updateMetadata} for metadata-only changes and {@link updateContent}
59
+ * for graph-content replacement.
60
+ *
54
61
  * @param projectId Project ID
55
62
  * @param mapId Map ID
56
63
  * @param options New metadata
@@ -59,6 +66,30 @@ export declare class MapService extends BaseServiceAbstract implements IBaseServ
59
66
  description?: string;
60
67
  callsign?: string;
61
68
  }): Promise<void>;
69
+ /**
70
+ * Updates a map's metadata via the granular `/metadata` endpoint.
71
+ *
72
+ * @param projectId Project ID
73
+ * @param mapId Map ID
74
+ * @param options New metadata fields. `description` is required by the
75
+ * backend; sending an empty value returns a 400.
76
+ */
77
+ updateMetadata(projectId: string, mapId: string, options: {
78
+ description: string;
79
+ }): Promise<void>;
80
+ /**
81
+ * Replaces the graph content of an existing cloud map with the supplied
82
+ * canonical `{ nodes, edges }` payload.
83
+ *
84
+ * Server-managed parts (SUMMARY, MAP_INFO identity fields, MAP_INFO
85
+ * timestamp, content hash) are preserved or recomputed by the backend; a
86
+ * byte-identical content payload is a no-op on the server (idempotent).
87
+ *
88
+ * @param projectId Project ID
89
+ * @param mapId Map ID
90
+ * @param content Canonical map content to write
91
+ */
92
+ updateContent(projectId: string, mapId: string, content: MapContent): Promise<void>;
62
93
  /**
63
94
  * Begins uploading a map from the agent
64
95
  *
@@ -86,15 +117,36 @@ export declare class MapService extends BaseServiceAbstract implements IBaseServ
86
117
  */
87
118
  delete(projectId: string, mapId: string, callsign: string, hash: string): Promise<void>;
88
119
  /**
89
- * Makes a copy of an uploaded map
120
+ * Creates a new map with the supplied canonical content.
121
+ *
122
+ * The server requires at least one node in the content; an empty `{nodes:{},
123
+ * edges:{}}` payload is rejected. Server-managed metadata (SUMMARY, MAP_INFO,
124
+ * hash, timestamp) is created automatically.
90
125
  *
91
126
  * @param projectId Project ID
92
- * @param mapId Map ID
93
- * @param options Options to create the new map
127
+ * @param mapId The mapId to create. Must be unique within the project.
128
+ * @param content Canonical map content (`{nodes, edges}`).
129
+ */
130
+ create(projectId: string, mapId: string, content: MapContent): Promise<void>;
131
+ /**
132
+ * Makes a copy of an existing cloud map under a new mapId.
133
+ *
134
+ * If `options.name` is omitted, the server picks an available
135
+ * `<sourceMapId>-copy[-N]` slot. The resolved mapId is returned so the
136
+ * caller knows where to look for the copy. The write is asynchronous on the
137
+ * server side - the copy may not be immediately readable via `get()`.
138
+ *
139
+ * @param projectId Project ID
140
+ * @param mapId Source map ID
141
+ * @param options Optional `name` (new mapId) and `description` for the copy
142
+ * @returns The mapId assigned to the new copy
94
143
  */
95
144
  copy(projectId: string, mapId: string, options: {
145
+ name?: string;
96
146
  description?: string;
97
- }): Promise<void>;
147
+ }): Promise<{
148
+ mapId: string;
149
+ }>;
98
150
  /** Deploy a map from the cloud to a robot
99
151
  *
100
152
  * @param projectId Project ID
@@ -89,7 +89,14 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
89
89
  }, this.config.insecure), 'Failed to get map.');
90
90
  }
91
91
  /**
92
- * Updates a maps metadata
92
+ * Updates a map's metadata.
93
+ *
94
+ * @deprecated Hits the legacy `PUT /maps/{mapId}` endpoint that only accepts
95
+ * metadata; the giraffe API is migrating that endpoint toward "PUT the full
96
+ * resource" semantics (both metadata and content together). Prefer
97
+ * {@link updateMetadata} for metadata-only changes and {@link updateContent}
98
+ * for graph-content replacement.
99
+ *
93
100
  * @param projectId Project ID
94
101
  * @param mapId Map ID
95
102
  * @param options New metadata
@@ -101,6 +108,40 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
101
108
  mapId,
102
109
  }, this.config.insecure), options, 'Failed to update map.');
103
110
  }
111
+ /**
112
+ * Updates a map's metadata via the granular `/metadata` endpoint.
113
+ *
114
+ * @param projectId Project ID
115
+ * @param mapId Map ID
116
+ * @param options New metadata fields. `description` is required by the
117
+ * backend; sending an empty value returns a 400.
118
+ */
119
+ async updateMetadata(projectId, mapId, options) {
120
+ return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAP_METADATA_URL, {
121
+ url: this.config.url,
122
+ projectId,
123
+ mapId,
124
+ }, this.config.insecure), options, 'Failed to update map metadata.');
125
+ }
126
+ /**
127
+ * Replaces the graph content of an existing cloud map with the supplied
128
+ * canonical `{ nodes, edges }` payload.
129
+ *
130
+ * Server-managed parts (SUMMARY, MAP_INFO identity fields, MAP_INFO
131
+ * timestamp, content hash) are preserved or recomputed by the backend; a
132
+ * byte-identical content payload is a no-op on the server (idempotent).
133
+ *
134
+ * @param projectId Project ID
135
+ * @param mapId Map ID
136
+ * @param content Canonical map content to write
137
+ */
138
+ async updateContent(projectId, mapId, content) {
139
+ return this.callPut((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAP_CONTENT_URL, {
140
+ url: this.config.url,
141
+ projectId,
142
+ mapId,
143
+ }, this.config.insecure), content, 'Failed to update map content.');
144
+ }
104
145
  /**
105
146
  * Begins uploading a map from the agent
106
147
  *
@@ -124,11 +165,34 @@ class MapService extends BaseServiceAbstract_1.BaseServiceAbstract {
124
165
  }, this.config.insecure), 'Failed to delete map.', callsign ? { callsign, hash } : {});
125
166
  }
126
167
  /**
127
- * Makes a copy of an uploaded map
168
+ * Creates a new map with the supplied canonical content.
169
+ *
170
+ * The server requires at least one node in the content; an empty `{nodes:{},
171
+ * edges:{}}` payload is rejected. Server-managed metadata (SUMMARY, MAP_INFO,
172
+ * hash, timestamp) is created automatically.
128
173
  *
129
174
  * @param projectId Project ID
130
- * @param mapId Map ID
131
- * @param options Options to create the new map
175
+ * @param mapId The mapId to create. Must be unique within the project.
176
+ * @param content Canonical map content (`{nodes, edges}`).
177
+ */
178
+ async create(projectId, mapId, content) {
179
+ return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAPS_NEW_URL, {
180
+ url: this.config.url,
181
+ projectId,
182
+ }, this.config.insecure), { mapId, map: content }, 'Failed to create map.');
183
+ }
184
+ /**
185
+ * Makes a copy of an existing cloud map under a new mapId.
186
+ *
187
+ * If `options.name` is omitted, the server picks an available
188
+ * `<sourceMapId>-copy[-N]` slot. The resolved mapId is returned so the
189
+ * caller knows where to look for the copy. The write is asynchronous on the
190
+ * server side - the copy may not be immediately readable via `get()`.
191
+ *
192
+ * @param projectId Project ID
193
+ * @param mapId Source map ID
194
+ * @param options Optional `name` (new mapId) and `description` for the copy
195
+ * @returns The mapId assigned to the new copy
132
196
  */
133
197
  async copy(projectId, mapId, options) {
134
198
  return this.callPost((0, formatServiceUrl_1.formatServiceUrl)(api_1.API_GRAPHS_MAPS_COPY_URL, {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { IBaseService, IRocosSDKConfig, RocosError } from '../models';
3
2
  import { BaseServiceAbstract } from './BaseServiceAbstract';
4
3
  import { Timezone } from '../constants/timezones';
@@ -164,6 +164,7 @@ class TelemetryService extends BaseStreamService_1.BaseStreamService {
164
164
  port: this.config.port,
165
165
  insecure: this.config.insecure,
166
166
  transport: this.config.transport,
167
+ fetch: this.config.fetch,
167
168
  });
168
169
  if (!newStream.isNew) {
169
170
  newStream.stream.statusStream$.subscribe((msg) => {
@@ -6,7 +6,6 @@ import { IDENTIFIER_NAME_CALLER } from '../../../constants/identifier';
6
6
  import { RocosStore } from '../../../store/RocosStore';
7
7
  import { StreamRegister } from '../../StreamRegister';
8
8
  import { filter } from 'rxjs/operators';
9
- import { v4 as uuidv4 } from 'uuid';
10
9
  export class CallerStreamAbstract {
11
10
  constructor(config) {
12
11
  this.subscriberStatus = SubscriberStatusEnum.STOPPED;
@@ -78,7 +77,7 @@ export class CallerStreamAbstract {
78
77
  version: UIDVersion.HEADER_HASH_RAND,
79
78
  content: {
80
79
  oneofKind: 'hash',
81
- hash: uid ?? uuidv4(),
80
+ hash: uid ?? crypto.randomUUID(),
82
81
  },
83
82
  },
84
83
  payload: this.getPayload(payload),
@@ -102,7 +102,7 @@ export class CallerStreamNode extends CallerStreamAbstract {
102
102
  });
103
103
  }
104
104
  getPayload(payload) {
105
- return Buffer.from(payload);
105
+ return new TextEncoder().encode(payload);
106
106
  }
107
107
  getMetadata(projectId, callsign, subsystem) {
108
108
  const meta = new grpc.Metadata();
@@ -27,6 +27,12 @@ export class TelemetryStreamConnect extends TelemetryStreamAbstract {
27
27
  // payloads containing control characters (verified against a live robot on dev) and is
28
28
  // less efficient. Binary is required for correctness here.
29
29
  useBinaryFormat: true,
30
+ // Optional caller-supplied fetch. Pass a reference captured before page-level instrumentation
31
+ // (e.g. Datadog RUM) monkey-patches `window.fetch`: RUM clones and reads every fetch response
32
+ // to measure timing, and on this long-lived server-stream that clone-read stalls connect-web's
33
+ // read (stream connects 200 but yields no frames). When omitted, connect-web uses the global
34
+ // fetch. See docs/connect-rpc-investigation.md.
35
+ ...(config.fetch ? { fetch: config.fetch } : {}),
30
36
  });
31
37
  this.client = createClient(TelemetryGateway, transport);
32
38
  }
@@ -4,7 +4,6 @@ import { ReceiverStreamMessage, } from '../../../grpc/teletubby_pb';
4
4
  import { RocosLogger } from '../../../logger/RocosLogger';
5
5
  import { TelemetryReceiverClient } from '../../../grpc/teletubby_pb.grpc-client';
6
6
  import { TelemetryStreamAbstract } from './TelemetryStreamAbstract';
7
- import { v4 as uuid4 } from 'uuid';
8
7
  export class TelemetryStreamNode extends TelemetryStreamAbstract {
9
8
  constructor(config) {
10
9
  super(config);
@@ -104,7 +103,7 @@ export class TelemetryStreamNode extends TelemetryStreamAbstract {
104
103
  getMetaData() {
105
104
  const meta = new grpc.Metadata();
106
105
  meta.add('r-p', this.projectId);
107
- meta.add('r-tid', uuid4());
106
+ meta.add('r-tid', crypto.randomUUID());
108
107
  meta.add('r-cs', 'rocos-js-sdk-agent');
109
108
  if (this.token)
110
109
  meta.add('authorization', this.token);
@@ -122,9 +122,12 @@ export declare const API_DD_INTEGRATION_ISSUES_URL = "https://{url}/projects/{pr
122
122
  export declare const API_DD_INTEGRATION_LOCATIONS_URL = "https://{url}/projects/{projectId}/dd/locations";
123
123
  export declare const API_DD_INTEGRATION_LEVELS_URL = "https://{url}/projects/{projectId}/dd/levels";
124
124
  export declare const API_GRAPHS_MAPS_URL = "https://{url}/graphs/projects/{projectId}/maps";
125
+ export declare const API_GRAPHS_MAPS_NEW_URL = "https://{url}/graphs/projects/{projectId}/maps/new";
125
126
  export declare const API_GRAPHS_MAPS_DEPLOYED_URL = "https://{url}/graphs/projects/{projectId}/maps/deployed?callsign={callsign}";
126
127
  export declare const API_GRAPHS_MAPS_MERGE_URL = "https://{url}/graphs/projects/{projectId}/maps/merge";
127
128
  export declare const API_GRAPHS_MAP_ID_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}";
129
+ export declare const API_GRAPHS_MAP_CONTENT_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/content";
130
+ export declare const API_GRAPHS_MAP_METADATA_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/metadata";
128
131
  export declare const API_GRAPHS_MAPS_COPY_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/copy";
129
132
  export declare const API_GRAPHS_MAPS_DEPLOY_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/deploy";
130
133
  export declare const API_GRAPHS_MAPS_GEOJSON_URL = "https://{url}/graphs/projects/{projectId}/maps/{mapId}/geojson";
@@ -122,9 +122,12 @@ export const API_DD_INTEGRATION_ISSUES_URL = 'https://{url}/projects/{projectId}
122
122
  export const API_DD_INTEGRATION_LOCATIONS_URL = 'https://{url}/projects/{projectId}/dd/locations';
123
123
  export const API_DD_INTEGRATION_LEVELS_URL = 'https://{url}/projects/{projectId}/dd/levels';
124
124
  export const API_GRAPHS_MAPS_URL = 'https://{url}/graphs/projects/{projectId}/maps';
125
+ export const API_GRAPHS_MAPS_NEW_URL = 'https://{url}/graphs/projects/{projectId}/maps/new';
125
126
  export const API_GRAPHS_MAPS_DEPLOYED_URL = 'https://{url}/graphs/projects/{projectId}/maps/deployed?callsign={callsign}';
126
127
  export const API_GRAPHS_MAPS_MERGE_URL = 'https://{url}/graphs/projects/{projectId}/maps/merge';
127
128
  export const API_GRAPHS_MAP_ID_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}';
129
+ export const API_GRAPHS_MAP_CONTENT_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/content';
130
+ export const API_GRAPHS_MAP_METADATA_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/metadata';
128
131
  export const API_GRAPHS_MAPS_COPY_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/copy';
129
132
  export const API_GRAPHS_MAPS_DEPLOY_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/deploy';
130
133
  export const API_GRAPHS_MAPS_GEOJSON_URL = 'https://{url}/graphs/projects/{projectId}/maps/{mapId}/geojson';
@@ -1,4 +1,3 @@
1
- import { v4 as uuidv4 } from 'uuid';
2
1
  export const generateUUID = () => {
3
- return uuidv4();
2
+ return crypto.randomUUID();
4
3
  };
@@ -1 +1 @@
1
- export declare const getSha256Hex: (arrayBuffer: ArrayBuffer) => Promise<string>;
1
+ export declare const getSha256Hex: (arrayBuffer: BufferSource) => Promise<string>;
@@ -1 +1 @@
1
- export declare const getSha256HexNode: (arrayBuffer: ArrayBuffer) => Promise<string>;
1
+ export declare const getSha256HexNode: (arrayBuffer: BufferSource) => Promise<string>;
@@ -1,10 +1,3 @@
1
- import { Buffer } from 'buffer';
2
1
  export const stringToUint8Array = (input) => {
3
- input = input ? input : '';
4
- const buf = new Buffer(input);
5
- const result = new Uint8Array(buf.length);
6
- for (let i = 0; i < buf.length; i++) {
7
- result[i] = buf[i];
8
- }
9
- return result;
2
+ return new TextEncoder().encode(input ? input : '');
10
3
  };
@@ -38,7 +38,7 @@ export default class Connection<Local extends APIDeclaration<Local>, Remote exte
38
38
  * @param name - name of remote method to call
39
39
  * @param args - arguments to pass to remote method
40
40
  */
41
- callRemoteMethod<Method extends keyof Remote>(name: Method, ...args: Parameters<Remote[Method]>): Promise<ReturnType<Remote[Method]>>;
41
+ callRemoteMethod<Method extends keyof Remote>(name: Method, ...args: Remote[Method] extends (...args: infer A) => unknown ? A : never): Promise<Remote[Method] extends (...args: never) => infer R ? R : never>;
42
42
  /** Log a message if debug mode is enabled */
43
43
  log(...args: unknown[]): void;
44
44
  private onMessageListener;
@@ -1,12 +1,14 @@
1
- import * as prefix from 'loglevel-plugin-prefix';
2
1
  import log from 'loglevel';
2
+ const originalFactory = log.methodFactory;
3
+ log.methodFactory = (methodName, level, loggerName) => {
4
+ const rawMethod = originalFactory(methodName, level, loggerName);
5
+ const name = typeof loggerName === 'symbol' ? loggerName.toString() : loggerName;
6
+ return (...args) => {
7
+ rawMethod(`[${new Date()}] ${methodName.toUpperCase()} ${name}:`, ...args);
8
+ };
9
+ };
10
+ // setDefaultLevel applies the methodFactory above by rebuilding the logging methods
3
11
  log.setDefaultLevel('silent');
4
- prefix.reg(log);
5
- prefix.apply(log, {
6
- format(level, name, timestamp) {
7
- return `[${timestamp}] ${level.toUpperCase()} ${name}:`;
8
- },
9
- });
10
12
  export class RocosLogger {
11
13
  static getInstance(name) {
12
14
  if (name) {
@@ -12,6 +12,7 @@ interface ConfigBase {
12
12
  port?: number;
13
13
  insecure?: boolean;
14
14
  transport?: TelemetryTransport;
15
+ fetch?: typeof globalThis.fetch;
15
16
  hooks?: {
16
17
  http?: {
17
18
  onResponse?: (res: Response) => void;
@@ -9,4 +9,5 @@ export interface IStreamConfig {
9
9
  insecure?: boolean;
10
10
  transport?: TelemetryTransport;
11
11
  grpcWebFormat?: 'text' | 'binary';
12
+ fetch?: typeof globalThis.fetch;
12
13
  }
@@ -1,4 +1,3 @@
1
- import { JSONSchema7 } from 'json-schema';
2
1
  export interface AssetSyncDefinitionModel {
3
2
  path: string;
4
3
  enabled: boolean;
@@ -20,7 +19,7 @@ export interface AssetSyncDefinitionsModel<I extends AssetSyncDefinitionModel =
20
19
  export interface AssetSyncIntegrationProviderModel {
21
20
  provider: string;
22
21
  name: string;
23
- schema: JSONSchema7;
22
+ schema: Record<string, unknown>;
24
23
  }
25
24
  export interface AssetSyncIntegrationModel extends CreateAssetSyncIntegrationModel {
26
25
  id: string;
@@ -48,6 +48,7 @@ export * from './IToken';
48
48
  export * from './IWidget';
49
49
  export * from './IWidgetLineGroup';
50
50
  export * from './maps/Map';
51
+ export * from './maps/MapContent';
51
52
  export * from './maps/Panorama';
52
53
  export * from './message';
53
54
  export * from './params/ICallerParams';
@@ -48,6 +48,7 @@ export * from './IToken';
48
48
  export * from './IWidget';
49
49
  export * from './IWidgetLineGroup';
50
50
  export * from './maps/Map';
51
+ export * from './maps/MapContent';
51
52
  export * from './maps/Panorama';
52
53
  export * from './message';
53
54
  export * from './params/ICallerParams';
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Canonical JSON representation of a robot map's graph content.
3
+ *
4
+ * This is the body shape returned by `GET /graphs/projects/{projectId}/maps/{mapId}`
5
+ * and accepted by `PUT /graphs/projects/{projectId}/maps/{mapId}/content`. Distinct
6
+ * from {@link Map} (the listing/metadata model returned by `list()`).
7
+ */
8
+ export interface MapContent {
9
+ nodes: Record<string, MapContentNode>;
10
+ edges: Record<string, MapContentEdge>;
11
+ }
12
+ export interface MapContentNode {
13
+ id: string;
14
+ type: string;
15
+ edges: Record<string, unknown>;
16
+ data: Record<string, unknown>;
17
+ externalData?: Record<string, unknown>;
18
+ }
19
+ export interface MapContentEdge {
20
+ id: string;
21
+ from: string;
22
+ to: string;
23
+ type: string;
24
+ data: Record<string, unknown>;
25
+ externalData?: Record<string, unknown>;
26
+ }
@@ -0,0 +1 @@
1
+ export {};