@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
@@ -6,7 +6,6 @@ import { BaseStreamService } from './BaseStreamService';
6
6
  import { CallerStream } from '../api/streams/caller/CallerStream';
7
7
  import { IDENTIFIER_NAME_CALLER } from '../constants/identifier';
8
8
  import { splitRobotTopic } from '../helpers';
9
- import { v4 } from 'uuid';
10
9
  export class CallerService extends BaseStreamService {
11
10
  constructor(config) {
12
11
  super('CallerService', config);
@@ -63,7 +62,7 @@ export class CallerService extends BaseStreamService {
63
62
  }
64
63
  getCallerParams(params, component, topic) {
65
64
  return {
66
- uid: params.options?.uid ?? v4(),
65
+ uid: params.options?.uid ?? crypto.randomUUID(),
67
66
  projectId: params.projectId,
68
67
  callsign: params.callsign,
69
68
  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
@@ -1,4 +1,4 @@
1
- import { API_GRAPHS_MAPS_COPY_URL, API_GRAPHS_MAPS_DEPLOYED_URL, API_GRAPHS_MAPS_DEPLOY_URL, API_GRAPHS_MAPS_GEOJSON_URL, API_GRAPHS_MAPS_MERGE_URL, API_GRAPHS_MAPS_URL, API_GRAPHS_MAP_ID_URL, API_GRAPHS_OBSERVATIONS_URL, API_GRAPHS_OBSERVATION_KEYS_URL, API_GRAPHS_PANORAMA, API_GRAPHS_PANORAMA_OBSERVATIONS_URL, } from '../constants/api';
1
+ import { API_GRAPHS_MAPS_COPY_URL, API_GRAPHS_MAPS_DEPLOYED_URL, API_GRAPHS_MAPS_DEPLOY_URL, API_GRAPHS_MAPS_GEOJSON_URL, API_GRAPHS_MAPS_MERGE_URL, API_GRAPHS_MAPS_NEW_URL, API_GRAPHS_MAPS_URL, API_GRAPHS_MAP_CONTENT_URL, API_GRAPHS_MAP_ID_URL, API_GRAPHS_MAP_METADATA_URL, API_GRAPHS_OBSERVATIONS_URL, API_GRAPHS_OBSERVATION_KEYS_URL, API_GRAPHS_PANORAMA, API_GRAPHS_PANORAMA_OBSERVATIONS_URL, } from '../constants/api';
2
2
  import { RocosError, errorCodes } from '../models';
3
3
  import { BaseServiceAbstract } from './BaseServiceAbstract';
4
4
  import { RocosLogger } from '../logger/RocosLogger';
@@ -86,7 +86,14 @@ export class MapService extends BaseServiceAbstract {
86
86
  }, this.config.insecure), 'Failed to get map.');
87
87
  }
88
88
  /**
89
- * Updates a maps metadata
89
+ * Updates a map's metadata.
90
+ *
91
+ * @deprecated Hits the legacy `PUT /maps/{mapId}` endpoint that only accepts
92
+ * metadata; the giraffe API is migrating that endpoint toward "PUT the full
93
+ * resource" semantics (both metadata and content together). Prefer
94
+ * {@link updateMetadata} for metadata-only changes and {@link updateContent}
95
+ * for graph-content replacement.
96
+ *
90
97
  * @param projectId Project ID
91
98
  * @param mapId Map ID
92
99
  * @param options New metadata
@@ -98,6 +105,40 @@ export class MapService extends BaseServiceAbstract {
98
105
  mapId,
99
106
  }, this.config.insecure), options, 'Failed to update map.');
100
107
  }
108
+ /**
109
+ * Updates a map's metadata via the granular `/metadata` endpoint.
110
+ *
111
+ * @param projectId Project ID
112
+ * @param mapId Map ID
113
+ * @param options New metadata fields. `description` is required by the
114
+ * backend; sending an empty value returns a 400.
115
+ */
116
+ async updateMetadata(projectId, mapId, options) {
117
+ return this.callPut(formatServiceUrl(API_GRAPHS_MAP_METADATA_URL, {
118
+ url: this.config.url,
119
+ projectId,
120
+ mapId,
121
+ }, this.config.insecure), options, 'Failed to update map metadata.');
122
+ }
123
+ /**
124
+ * Replaces the graph content of an existing cloud map with the supplied
125
+ * canonical `{ nodes, edges }` payload.
126
+ *
127
+ * Server-managed parts (SUMMARY, MAP_INFO identity fields, MAP_INFO
128
+ * timestamp, content hash) are preserved or recomputed by the backend; a
129
+ * byte-identical content payload is a no-op on the server (idempotent).
130
+ *
131
+ * @param projectId Project ID
132
+ * @param mapId Map ID
133
+ * @param content Canonical map content to write
134
+ */
135
+ async updateContent(projectId, mapId, content) {
136
+ return this.callPut(formatServiceUrl(API_GRAPHS_MAP_CONTENT_URL, {
137
+ url: this.config.url,
138
+ projectId,
139
+ mapId,
140
+ }, this.config.insecure), content, 'Failed to update map content.');
141
+ }
101
142
  /**
102
143
  * Begins uploading a map from the agent
103
144
  *
@@ -121,11 +162,34 @@ export class MapService extends BaseServiceAbstract {
121
162
  }, this.config.insecure), 'Failed to delete map.', callsign ? { callsign, hash } : {});
122
163
  }
123
164
  /**
124
- * Makes a copy of an uploaded map
165
+ * Creates a new map with the supplied canonical content.
166
+ *
167
+ * The server requires at least one node in the content; an empty `{nodes:{},
168
+ * edges:{}}` payload is rejected. Server-managed metadata (SUMMARY, MAP_INFO,
169
+ * hash, timestamp) is created automatically.
125
170
  *
126
171
  * @param projectId Project ID
127
- * @param mapId Map ID
128
- * @param options Options to create the new map
172
+ * @param mapId The mapId to create. Must be unique within the project.
173
+ * @param content Canonical map content (`{nodes, edges}`).
174
+ */
175
+ async create(projectId, mapId, content) {
176
+ return this.callPost(formatServiceUrl(API_GRAPHS_MAPS_NEW_URL, {
177
+ url: this.config.url,
178
+ projectId,
179
+ }, this.config.insecure), { mapId, map: content }, 'Failed to create map.');
180
+ }
181
+ /**
182
+ * Makes a copy of an existing cloud map under a new mapId.
183
+ *
184
+ * If `options.name` is omitted, the server picks an available
185
+ * `<sourceMapId>-copy[-N]` slot. The resolved mapId is returned so the
186
+ * caller knows where to look for the copy. The write is asynchronous on the
187
+ * server side - the copy may not be immediately readable via `get()`.
188
+ *
189
+ * @param projectId Project ID
190
+ * @param mapId Source map ID
191
+ * @param options Optional `name` (new mapId) and `description` for the copy
192
+ * @returns The mapId assigned to the new copy
129
193
  */
130
194
  async copy(projectId, mapId, options) {
131
195
  return this.callPost(formatServiceUrl(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';
@@ -161,6 +161,7 @@ export class TelemetryService extends BaseStreamService {
161
161
  port: this.config.port,
162
162
  insecure: this.config.insecure,
163
163
  transport: this.config.transport,
164
+ fetch: this.config.fetch,
164
165
  });
165
166
  if (!newStream.isNew) {
166
167
  newStream.stream.statusStream$.subscribe((msg) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dronedeploy/rocos-js-sdk",
3
- "version": "3.0.31-rc1",
3
+ "version": "3.1.1",
4
4
  "description": "Javascript SDK for rocos",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -22,19 +22,14 @@
22
22
  "license": "MIT",
23
23
  "devDependencies": {},
24
24
  "dependencies": {
25
- "@bufbuild/protobuf": "2.2.5",
26
- "@connectrpc/connect": "2.0.0",
27
- "@connectrpc/connect-web": "2.0.0",
25
+ "@bufbuild/protobuf": "2.12.0",
26
+ "@connectrpc/connect": "^2.1.1",
27
+ "@connectrpc/connect-web": "^2.1.1",
28
28
  "@grpc/grpc-js": "^1.7.1",
29
29
  "@protobuf-ts/grpcweb-transport": "^2.9.1",
30
- "@protobuf-ts/plugin": "^2.9.1",
31
30
  "@protobuf-ts/runtime": "^2.9.1",
32
- "@types/json-schema": "^7.0.14",
33
31
  "acorn": "^8.11.3",
34
- "buffer": "^6.0.3",
35
- "loglevel": "^1.7.1",
36
- "loglevel-plugin-prefix": "^0.8.4",
37
- "uuid": "^9.0.0"
32
+ "loglevel": "^1.7.1"
38
33
  },
39
34
  "peerDependencies": {
40
35
  "rxjs": "^6.6.6 || ^7.0.0"