@atlasnpm/atlas-api-helper 0.2.5 → 0.2.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/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # Atlas Command HTTP Client (TypeScript)
2
2
 
3
- `@atlasnpm/atlas-api-helper` has been updated to version 0.2.4 with a comprehensive HTTP client for the Atlas Command REST API. This version now includes full API parity with the Python `atlas_asset_ws_client` package.
4
-
5
3
  ## Installation
6
4
 
7
5
  ```bash
@@ -22,12 +20,12 @@ const client = new AtlasHttpClient({
22
20
  const entities = await client.listEntities();
23
21
  console.log("Entities", entities);
24
22
 
25
- await client.createEntity("asset-1", "asset", "Surveyor One", {
23
+ await client.createEntity("asset-1", "asset", "Surveyor One", "drone", {
26
24
  telemetry: { latitude: 40.7, longitude: -74.0 },
27
25
  });
28
26
  await client.createTask("survey-1", { parameters: { latitude: 40.7, longitude: -74.0 } });
29
27
 
30
- // New API methods (version 0.2.1)
28
+ // Entity telemetry updates
31
29
  const entity = await client.getEntityByAlias("drone-1");
32
30
  await client.updateEntityTelemetry("drone-1", {
33
31
  latitude: 40.7128,
@@ -46,7 +44,7 @@ await client.failTask("task-2", "Calibration failed", { code: "CAL-01" });
46
44
  const stored = await client.createObject(videoBlob, "mission-video", "mission_video", [
47
45
  { entity_id: "asset-1" },
48
46
  ]);
49
- await client.addObjectReference(stored.object_id, undefined, "task-1");
47
+ await client.addObjectReference(stored["object_id"] as string, undefined, "task-1");
50
48
  await client.updateObject("mission-video", ["mission_video"], [
51
49
  { task_id: "task-1" },
52
50
  ]);
@@ -67,7 +65,7 @@ The client now exposes comprehensive helpers for every HTTP endpoint, matching t
67
65
  - `listEntities(limit?, offset?)` - List all entities with pagination
68
66
  - `getEntity(entityId)` - Get a specific entity by ID
69
67
  - `getEntityByAlias(alias)` - Get entity by alias (NEW in 0.2.1)
70
- - `createEntity(entityId, entityType, alias, components?)` - Create a new entity
68
+ - `createEntity(entityId, entityType, alias, subtype, components?)` - Create a new entity
71
69
  - `updateEntity(entityId, components)` - Update an existing entity (components payload required)
72
70
  - `deleteEntity(entityId)` - Delete an entity
73
71
  - `updateEntityTelemetry(entityId, telemetry)` - Update entity telemetry with specific parameters (NEW in 0.2.1)
@@ -139,18 +137,6 @@ npm run test
139
137
 
140
138
  The build produces both ESM and CJS bundles plus `.d.ts` type definitions via `tsup`.
141
139
 
142
- ## Version 0.2.1 Changes
143
-
144
- This update brings the TypeScript client to full feature parity with the Python `atlas_asset_ws_client` package:
145
-
146
- - ✅ Added `getEntityByAlias` method
147
- - ✅ Added `updateEntityTelemetry` with specific telemetry parameters
148
- - ✅ Added task lifecycle methods: `startTask`, `completeTask`, `failTask`
149
- - ✅ Added query methods: `getChangedSince`, `getFullDataset`
150
- - ✅ Enhanced type system with comprehensive interfaces
151
- - ✅ Updated to match Python API signatures and behavior
152
- - ✅ Version bump to 0.2.1 to match Python package
153
-
154
140
  ## Publishing
155
141
 
156
- Publishing is handled by `.github/workflows/publish-controller-websocket-client.yml`. The artifact now contains the comprehensive HTTP client described above. Ensure the `@atlasnpm` scope and automation token are set up as documented in the workflow README before triggering a release.
142
+ Publishing is handled by `.github/workflows/publish-atlas-api-helper.yml`. The artifact now contains the comprehensive HTTP client described above. Ensure the `@atlasnpm` scope and automation token are set up as documented in the workflow README before triggering a release.
package/dist/index.cjs CHANGED
@@ -99,20 +99,24 @@ var AtlasHttpClient = class {
99
99
  getEntityByAlias(alias) {
100
100
  return this.request("GET", `/entities/alias/${alias}`);
101
101
  }
102
- createEntity(entityId, entityType, alias, components) {
102
+ createEntity(entityId, entityType, alias, subtype, components) {
103
103
  const payload = {
104
104
  entity_id: entityId,
105
105
  entity_type: entityType,
106
- alias
106
+ alias,
107
+ subtype
107
108
  };
108
109
  if (components !== void 0) payload.components = components;
109
110
  return this.request("POST", "/entities", payload);
110
111
  }
111
- updateEntity(entityId, components) {
112
- if (components === void 0) {
113
- throw new Error("AtlasHttpClient.updateEntity requires a components payload.");
112
+ updateEntity(entityId, components, options) {
113
+ if (components === void 0 && options?.subtype === void 0) {
114
+ throw new Error("AtlasHttpClient.updateEntity requires a components payload or subtype.");
114
115
  }
115
- return this.request("PATCH", `/entities/${entityId}`, { components });
116
+ const payload = {};
117
+ if (components !== void 0) payload.components = components;
118
+ if (options?.subtype !== void 0) payload.subtype = options.subtype;
119
+ return this.request("PATCH", `/entities/${entityId}`, payload);
116
120
  }
117
121
  deleteEntity(entityId) {
118
122
  return this.request("DELETE", `/entities/${entityId}`);
@@ -133,19 +137,28 @@ var AtlasHttpClient = class {
133
137
  getTask(taskId) {
134
138
  return this.request("GET", `/tasks/${taskId}`);
135
139
  }
136
- createTask(taskId, components) {
140
+ createTask(taskId, components, options) {
137
141
  const payload = {
138
142
  task_id: taskId,
139
- status: "pending"
143
+ status: options?.status || "pending"
140
144
  };
145
+ if (options?.entity_id !== void 0) payload.entity_id = options.entity_id;
141
146
  if (components !== void 0) payload.components = components;
147
+ if (options?.extra !== void 0) payload.extra = options.extra;
142
148
  return this.request("POST", "/tasks", payload);
143
149
  }
144
- updateTask(taskId, components) {
145
- if (components === void 0) {
146
- throw new Error("AtlasHttpClient.updateTask requires a components payload.");
150
+ updateTask(taskId, components, options) {
151
+ if (components === void 0 && options === void 0) {
152
+ throw new Error(
153
+ "AtlasHttpClient.updateTask requires a components payload or options."
154
+ );
147
155
  }
148
- return this.request("PATCH", `/tasks/${taskId}`, { components });
156
+ const payload = {};
157
+ if (components !== void 0) payload.components = components;
158
+ if (options?.status !== void 0) payload.status = options.status;
159
+ if (options?.entity_id !== void 0) payload.entity_id = options.entity_id;
160
+ if (options?.extra !== void 0) payload.extra = options.extra;
161
+ return this.request("PATCH", `/tasks/${taskId}`, payload);
149
162
  }
150
163
  deleteTask(taskId) {
151
164
  return this.request("DELETE", `/tasks/${taskId}`);
@@ -166,8 +179,8 @@ var AtlasHttpClient = class {
166
179
  return this.request("POST", `/tasks/${taskId}/fail`, payload);
167
180
  }
168
181
  // Objects -------------------------------------------------------------------
169
- listObjects(limit = 100, offset = 0, contentType) {
170
- return this.request("GET", "/objects", null, { limit, offset, content_type: contentType });
182
+ listObjects(limit = 100, offset = 0, contentType, type) {
183
+ return this.request("GET", "/objects", null, { limit, offset, content_type: contentType, type });
171
184
  }
172
185
  getObject(objectId) {
173
186
  return this.request("GET", `/objects/${objectId}`);
package/dist/index.d.cts CHANGED
@@ -19,8 +19,10 @@ declare class AtlasHttpClient {
19
19
  listEntities(limit?: number, offset?: number): Promise<unknown>;
20
20
  getEntity(entityId: string): Promise<unknown>;
21
21
  getEntityByAlias(alias: string): Promise<unknown>;
22
- createEntity(entityId: string, entityType: string, alias: string, components?: JsonRecord): Promise<unknown>;
23
- updateEntity(entityId: string, components?: JsonRecord): Promise<unknown>;
22
+ createEntity(entityId: string, entityType: string, alias: string, subtype: string, components?: JsonRecord): Promise<unknown>;
23
+ updateEntity(entityId: string, components?: JsonRecord, options?: {
24
+ subtype?: string;
25
+ }): Promise<unknown>;
24
26
  deleteEntity(entityId: string): Promise<unknown>;
25
27
  updateEntityTelemetry(entityId: string, options: {
26
28
  latitude?: number;
@@ -31,14 +33,22 @@ declare class AtlasHttpClient {
31
33
  }): Promise<unknown>;
32
34
  listTasks(limit?: number, status?: string): Promise<unknown>;
33
35
  getTask(taskId: string): Promise<unknown>;
34
- createTask(taskId: string, components?: JsonRecord): Promise<unknown>;
35
- updateTask(taskId: string, components?: JsonRecord): Promise<unknown>;
36
+ createTask(taskId: string, components?: JsonRecord, options?: {
37
+ status?: string;
38
+ entity_id?: string;
39
+ extra?: JsonRecord;
40
+ }): Promise<unknown>;
41
+ updateTask(taskId: string, components?: JsonRecord, options?: {
42
+ status?: string;
43
+ entity_id?: string;
44
+ extra?: JsonRecord;
45
+ }): Promise<unknown>;
36
46
  deleteTask(taskId: string): Promise<unknown>;
37
47
  getTasksByEntity(entityId: string, limit?: number, status?: string): Promise<unknown>;
38
48
  startTask(taskId: string): Promise<unknown>;
39
49
  completeTask(taskId: string): Promise<unknown>;
40
50
  failTask(taskId: string, errorMessage?: string, errorDetails?: JsonRecord): Promise<unknown>;
41
- listObjects(limit?: number, offset?: number, contentType?: string): Promise<unknown>;
51
+ listObjects(limit?: number, offset?: number, contentType?: string, type?: string): Promise<unknown>;
42
52
  getObject(objectId: string): Promise<unknown>;
43
53
  createObject(file: Blob | File, objectId: string, usageHint?: string, referencedBy?: Array<{
44
54
  entity_id?: string;
@@ -67,9 +77,10 @@ declare class AtlasHttpClient {
67
77
 
68
78
  interface Entity {
69
79
  entity_id: string;
80
+ type: string;
81
+ subtype?: string;
82
+ alias?: string;
70
83
  json: {
71
- type: "asset" | "track" | "geofeature" | string;
72
- alias?: string;
73
84
  components?: Record<string, unknown>;
74
85
  [key: string]: unknown;
75
86
  };
@@ -78,8 +89,9 @@ interface Entity {
78
89
  }
79
90
  interface Task {
80
91
  task_id: string;
92
+ status: string;
93
+ entity_id?: string;
81
94
  json: {
82
- status: string;
83
95
  components?: Record<string, unknown>;
84
96
  [key: string]: unknown;
85
97
  };
@@ -88,6 +100,9 @@ interface Task {
88
100
  }
89
101
  interface StoredObject {
90
102
  object_id: string;
103
+ path?: string;
104
+ content_type?: string;
105
+ type?: string;
91
106
  json: Record<string, unknown>;
92
107
  created_at?: string;
93
108
  updated_at?: string;
@@ -177,6 +192,7 @@ interface ObjectCreate {
177
192
  bucket?: string;
178
193
  size_bytes?: number;
179
194
  content_type?: string;
195
+ type?: string;
180
196
  usage_hints?: string[];
181
197
  referenced_by?: ObjectReference[];
182
198
  extra?: Record<string, unknown>;
@@ -186,6 +202,7 @@ interface ObjectUpdate {
186
202
  bucket?: string;
187
203
  size_bytes?: number;
188
204
  content_type?: string;
205
+ type?: string;
189
206
  usage_hints?: string[];
190
207
  referenced_by?: ObjectReference[];
191
208
  extra?: Record<string, unknown>;
package/dist/index.d.ts CHANGED
@@ -19,8 +19,10 @@ declare class AtlasHttpClient {
19
19
  listEntities(limit?: number, offset?: number): Promise<unknown>;
20
20
  getEntity(entityId: string): Promise<unknown>;
21
21
  getEntityByAlias(alias: string): Promise<unknown>;
22
- createEntity(entityId: string, entityType: string, alias: string, components?: JsonRecord): Promise<unknown>;
23
- updateEntity(entityId: string, components?: JsonRecord): Promise<unknown>;
22
+ createEntity(entityId: string, entityType: string, alias: string, subtype: string, components?: JsonRecord): Promise<unknown>;
23
+ updateEntity(entityId: string, components?: JsonRecord, options?: {
24
+ subtype?: string;
25
+ }): Promise<unknown>;
24
26
  deleteEntity(entityId: string): Promise<unknown>;
25
27
  updateEntityTelemetry(entityId: string, options: {
26
28
  latitude?: number;
@@ -31,14 +33,22 @@ declare class AtlasHttpClient {
31
33
  }): Promise<unknown>;
32
34
  listTasks(limit?: number, status?: string): Promise<unknown>;
33
35
  getTask(taskId: string): Promise<unknown>;
34
- createTask(taskId: string, components?: JsonRecord): Promise<unknown>;
35
- updateTask(taskId: string, components?: JsonRecord): Promise<unknown>;
36
+ createTask(taskId: string, components?: JsonRecord, options?: {
37
+ status?: string;
38
+ entity_id?: string;
39
+ extra?: JsonRecord;
40
+ }): Promise<unknown>;
41
+ updateTask(taskId: string, components?: JsonRecord, options?: {
42
+ status?: string;
43
+ entity_id?: string;
44
+ extra?: JsonRecord;
45
+ }): Promise<unknown>;
36
46
  deleteTask(taskId: string): Promise<unknown>;
37
47
  getTasksByEntity(entityId: string, limit?: number, status?: string): Promise<unknown>;
38
48
  startTask(taskId: string): Promise<unknown>;
39
49
  completeTask(taskId: string): Promise<unknown>;
40
50
  failTask(taskId: string, errorMessage?: string, errorDetails?: JsonRecord): Promise<unknown>;
41
- listObjects(limit?: number, offset?: number, contentType?: string): Promise<unknown>;
51
+ listObjects(limit?: number, offset?: number, contentType?: string, type?: string): Promise<unknown>;
42
52
  getObject(objectId: string): Promise<unknown>;
43
53
  createObject(file: Blob | File, objectId: string, usageHint?: string, referencedBy?: Array<{
44
54
  entity_id?: string;
@@ -67,9 +77,10 @@ declare class AtlasHttpClient {
67
77
 
68
78
  interface Entity {
69
79
  entity_id: string;
80
+ type: string;
81
+ subtype?: string;
82
+ alias?: string;
70
83
  json: {
71
- type: "asset" | "track" | "geofeature" | string;
72
- alias?: string;
73
84
  components?: Record<string, unknown>;
74
85
  [key: string]: unknown;
75
86
  };
@@ -78,8 +89,9 @@ interface Entity {
78
89
  }
79
90
  interface Task {
80
91
  task_id: string;
92
+ status: string;
93
+ entity_id?: string;
81
94
  json: {
82
- status: string;
83
95
  components?: Record<string, unknown>;
84
96
  [key: string]: unknown;
85
97
  };
@@ -88,6 +100,9 @@ interface Task {
88
100
  }
89
101
  interface StoredObject {
90
102
  object_id: string;
103
+ path?: string;
104
+ content_type?: string;
105
+ type?: string;
91
106
  json: Record<string, unknown>;
92
107
  created_at?: string;
93
108
  updated_at?: string;
@@ -177,6 +192,7 @@ interface ObjectCreate {
177
192
  bucket?: string;
178
193
  size_bytes?: number;
179
194
  content_type?: string;
195
+ type?: string;
180
196
  usage_hints?: string[];
181
197
  referenced_by?: ObjectReference[];
182
198
  extra?: Record<string, unknown>;
@@ -186,6 +202,7 @@ interface ObjectUpdate {
186
202
  bucket?: string;
187
203
  size_bytes?: number;
188
204
  content_type?: string;
205
+ type?: string;
189
206
  usage_hints?: string[];
190
207
  referenced_by?: ObjectReference[];
191
208
  extra?: Record<string, unknown>;
package/dist/index.js CHANGED
@@ -73,20 +73,24 @@ var AtlasHttpClient = class {
73
73
  getEntityByAlias(alias) {
74
74
  return this.request("GET", `/entities/alias/${alias}`);
75
75
  }
76
- createEntity(entityId, entityType, alias, components) {
76
+ createEntity(entityId, entityType, alias, subtype, components) {
77
77
  const payload = {
78
78
  entity_id: entityId,
79
79
  entity_type: entityType,
80
- alias
80
+ alias,
81
+ subtype
81
82
  };
82
83
  if (components !== void 0) payload.components = components;
83
84
  return this.request("POST", "/entities", payload);
84
85
  }
85
- updateEntity(entityId, components) {
86
- if (components === void 0) {
87
- throw new Error("AtlasHttpClient.updateEntity requires a components payload.");
86
+ updateEntity(entityId, components, options) {
87
+ if (components === void 0 && options?.subtype === void 0) {
88
+ throw new Error("AtlasHttpClient.updateEntity requires a components payload or subtype.");
88
89
  }
89
- return this.request("PATCH", `/entities/${entityId}`, { components });
90
+ const payload = {};
91
+ if (components !== void 0) payload.components = components;
92
+ if (options?.subtype !== void 0) payload.subtype = options.subtype;
93
+ return this.request("PATCH", `/entities/${entityId}`, payload);
90
94
  }
91
95
  deleteEntity(entityId) {
92
96
  return this.request("DELETE", `/entities/${entityId}`);
@@ -107,19 +111,28 @@ var AtlasHttpClient = class {
107
111
  getTask(taskId) {
108
112
  return this.request("GET", `/tasks/${taskId}`);
109
113
  }
110
- createTask(taskId, components) {
114
+ createTask(taskId, components, options) {
111
115
  const payload = {
112
116
  task_id: taskId,
113
- status: "pending"
117
+ status: options?.status || "pending"
114
118
  };
119
+ if (options?.entity_id !== void 0) payload.entity_id = options.entity_id;
115
120
  if (components !== void 0) payload.components = components;
121
+ if (options?.extra !== void 0) payload.extra = options.extra;
116
122
  return this.request("POST", "/tasks", payload);
117
123
  }
118
- updateTask(taskId, components) {
119
- if (components === void 0) {
120
- throw new Error("AtlasHttpClient.updateTask requires a components payload.");
124
+ updateTask(taskId, components, options) {
125
+ if (components === void 0 && options === void 0) {
126
+ throw new Error(
127
+ "AtlasHttpClient.updateTask requires a components payload or options."
128
+ );
121
129
  }
122
- return this.request("PATCH", `/tasks/${taskId}`, { components });
130
+ const payload = {};
131
+ if (components !== void 0) payload.components = components;
132
+ if (options?.status !== void 0) payload.status = options.status;
133
+ if (options?.entity_id !== void 0) payload.entity_id = options.entity_id;
134
+ if (options?.extra !== void 0) payload.extra = options.extra;
135
+ return this.request("PATCH", `/tasks/${taskId}`, payload);
123
136
  }
124
137
  deleteTask(taskId) {
125
138
  return this.request("DELETE", `/tasks/${taskId}`);
@@ -140,8 +153,8 @@ var AtlasHttpClient = class {
140
153
  return this.request("POST", `/tasks/${taskId}/fail`, payload);
141
154
  }
142
155
  // Objects -------------------------------------------------------------------
143
- listObjects(limit = 100, offset = 0, contentType) {
144
- return this.request("GET", "/objects", null, { limit, offset, content_type: contentType });
156
+ listObjects(limit = 100, offset = 0, contentType, type) {
157
+ return this.request("GET", "/objects", null, { limit, offset, content_type: contentType, type });
145
158
  }
146
159
  getObject(objectId) {
147
160
  return this.request("GET", `/objects/${objectId}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlasnpm/atlas-api-helper",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "type": "module",
5
5
  "description": "HTTP client for the Atlas Command REST API.",
6
6
  "license": "MIT",