@omirion/orbit-sdk 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -19
- package/dist/index.cjs +235 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +176 -103
- package/dist/index.d.ts +176 -103
- package/dist/index.js +235 -75
- package/dist/index.js.map +1 -1
- package/examples/device-rpc-flow/README.md +43 -0
- package/examples/device-rpc-flow/index.tsx +502 -0
- package/examples/device-rpc-flow/package.json +23 -0
- package/examples/device-rpc-flow/tsconfig.json +14 -0
- package/examples/webhook-listener/README.md +41 -0
- package/examples/webhook-listener/index.ts +110 -0
- package/examples/webhook-listener/package.json +19 -0
- package/examples/webhook-listener/tsconfig.json +13 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
# @omirion/orbit-sdk
|
|
2
2
|
|
|
3
|
-
Official TypeScript SDK for the [Omirion Orbit](https://orbit.omirion.com)
|
|
4
|
-
public API (`/api/v1`). Works in Node 18+, Deno, Bun, Cloudflare Workers, and
|
|
5
|
-
browsers. ESM + CJS, fully typed, zero runtime dependencies (the fetch client is
|
|
6
|
-
bundled).
|
|
3
|
+
Official TypeScript SDK for the [Omirion Orbit](https://orbit.omirion.com) public API (`/api/v1`). Works in Node 18+, Deno, Bun, Cloudflare Workers, and browsers. ESM + CJS, fully typed, zero runtime dependencies (the fetch client is bundled).
|
|
7
4
|
|
|
8
5
|
## Install
|
|
9
6
|
|
|
@@ -33,15 +30,18 @@ for await (const device of orbit.devices.iterate({ status: 'online' })) {
|
|
|
33
30
|
}
|
|
34
31
|
```
|
|
35
32
|
|
|
36
|
-
`OrbitClient` wraps the generated transport client with bearer auth, automatic
|
|
37
|
-
retries (429/502/503/504 + network) with backoff, response unwrapping, cursor
|
|
38
|
-
auto-pagination, and **typed errors** you can `catch`:
|
|
33
|
+
`OrbitClient` wraps the generated transport client with bearer auth, automatic retries (429/502/503/504 + network) with backoff, response unwrapping, cursor auto-pagination, and **typed errors** you can `catch`:
|
|
39
34
|
|
|
40
35
|
```ts
|
|
41
36
|
import { InsufficientScopeError, DeviceRpcError } from '@omirion/orbit-sdk'
|
|
42
37
|
|
|
43
38
|
try {
|
|
44
|
-
|
|
39
|
+
// Commands are declared per device type, a name plus typed key/value args, no shell.
|
|
40
|
+
// `orbit.commands.manifest(deviceId)` lists what this device accepts.
|
|
41
|
+
const result = await orbit.commands.exec(deviceId, { name: 'state-request', timeoutMs: 10_000 })
|
|
42
|
+
if (result.queued) {
|
|
43
|
+
// Store-and-forward device: poll orbit.commands.get(deviceId, result.invocationId)
|
|
44
|
+
}
|
|
45
45
|
} catch (err) {
|
|
46
46
|
if (err instanceof InsufficientScopeError) {/* token missing api:command:exec */}
|
|
47
47
|
else if (err instanceof DeviceRpcError) {/* device offline / transport failed */}
|
|
@@ -51,20 +51,30 @@ try {
|
|
|
51
51
|
|
|
52
52
|
### Surface
|
|
53
53
|
|
|
54
|
-
- `
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- `orbit.
|
|
58
|
-
- `orbit.
|
|
59
|
-
- `orbit.
|
|
60
|
-
- `orbit.
|
|
61
|
-
- `
|
|
62
|
-
-
|
|
63
|
-
|
|
64
|
-
|
|
54
|
+
Every collection has a cursor-paginated `list(params?)` and a lazy `iterate(params?)` async-generator twin that walks all pages.
|
|
55
|
+
|
|
56
|
+
- `orbit.me()`. Who the token authenticates as, its abilities and project scope, and the projects it reaches. Requires no ability. The cheapest way to verify a token works and to discover valid `projectId` values.
|
|
57
|
+
- `orbit.projects`. `list` / `iterate` / `get(id)`, plus `appToken.create(projectId)` / `appToken.rotate(projectId)` (the provisioning token is returned once and never again).
|
|
58
|
+
- `orbit.deviceTypes`. `list` / `iterate` / `get(projectId, slug)` / `create` / `update` / `delete`, the models a fleet identifies as, with their telemetry and command manifests.
|
|
59
|
+
- `orbit.devices`. `list` / `iterate` / `get(id)` / `delete(id)` / `resetToken(id)`.
|
|
60
|
+
- `orbit.admissions`. `list` / `iterate` / `get(id)` / `accept` / `reject` / `dismiss`, the fleet-join requests.
|
|
61
|
+
- `orbit.telemetry`. `latest(deviceId)`, `history(deviceId, { hours? })`, `manifest(deviceId)`.
|
|
62
|
+
- `orbit.firmware`. `upload({ file, projectId, kind?, version?, compatible?, description? })` (version and target are decoded from the binary where it carries them), `deleteBundle(id)`, `bundles.list` / `iterate` / `get`, `deployments.trigger` / `list` / `iterate` / `get` / `cancel` / `rollback`.
|
|
63
|
+
- `orbit.commands`. `exec(deviceId, { name, args?, timeoutMs? })`, `get(deviceId, invocationId)` (the pull path for a queued dispatch), `manifest(deviceId)`.
|
|
64
|
+
- `orbit.webhooks`. `list` / `iterate` / `create` / `get` / `update` / `delete` / `deliveries` / `iterateDeliveries`. Receiver-side helpers `verifyWebhookSignature` and `parseWebhookEvent` validate incoming deliveries (HMAC + replay window).
|
|
65
|
+
- `orbit.usb` / `orbit.terminal`. Single-use ticket minting for the USB/IP and device-shell WebSocket planes (`api:usb:attach` / `api:terminal:open`).
|
|
66
|
+
- `decodeSample(sample, manifest)` / `decodeSamples(...)`, labelled telemetry rows.
|
|
67
|
+
- Errors: `OrbitError` + `AuthenticationError`, `InsufficientScopeError`, `ResourceNotFoundError`, `BadRequestError`, `ValidationError`, `ConflictError`, `BundleExistsError`, `DeviceRpcError`, `RateLimitError`, `ServerError`, `NetworkError`
|
|
65
68
|
|
|
66
69
|
The raw generated transport client is still available under `import { raw } from '@omirion/orbit-sdk'`.
|
|
67
70
|
|
|
71
|
+
## Examples
|
|
72
|
+
|
|
73
|
+
Two runnable examples ship in this package under `examples/`. Copy a folder anywhere, `pnpm install`, and follow its README.
|
|
74
|
+
|
|
75
|
+
- `examples/device-rpc-flow`. An Ink terminal UI walking the full read-then-act loop, list devices, decode their latest telemetry via the type manifest, then drive a device through a sequence of declared commands.
|
|
76
|
+
- `examples/webhook-listener`. The smallest useful webhook receiver, verifies every delivery's signature with `parseWebhookEvent`, dedupes on the event id, and prints each event.
|
|
77
|
+
|
|
68
78
|
## License
|
|
69
79
|
|
|
70
80
|
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -1109,7 +1109,9 @@ var ValidationError = class extends OrbitError {
|
|
|
1109
1109
|
this.fieldErrors = options.fieldErrors ?? [];
|
|
1110
1110
|
}
|
|
1111
1111
|
};
|
|
1112
|
-
var
|
|
1112
|
+
var ConflictError = class extends OrbitError {
|
|
1113
|
+
};
|
|
1114
|
+
var BundleExistsError = class extends ConflictError {
|
|
1113
1115
|
};
|
|
1114
1116
|
var DeviceRpcError = class extends OrbitError {
|
|
1115
1117
|
};
|
|
@@ -1127,12 +1129,6 @@ var RateLimitError = class extends OrbitError {
|
|
|
1127
1129
|
function extractErrorFields(body) {
|
|
1128
1130
|
if (!body || typeof body !== "object") return {};
|
|
1129
1131
|
const record = body;
|
|
1130
|
-
if (typeof record.error === "string") {
|
|
1131
|
-
return {
|
|
1132
|
-
code: record.error,
|
|
1133
|
-
message: typeof record.message === "string" ? record.message : record.error
|
|
1134
|
-
};
|
|
1135
|
-
}
|
|
1136
1132
|
if (Array.isArray(record.errors) && record.errors.length > 0) {
|
|
1137
1133
|
const first = record.errors[0];
|
|
1138
1134
|
return {
|
|
@@ -1184,7 +1180,7 @@ function normalizeError(status, body, response) {
|
|
|
1184
1180
|
case 404:
|
|
1185
1181
|
return new ResourceNotFoundError(msg, base);
|
|
1186
1182
|
case 409:
|
|
1187
|
-
return new BundleExistsError(msg, base);
|
|
1183
|
+
return code === "E_BUNDLE_ALREADY_EXISTS" ? new BundleExistsError(msg, base) : new ConflictError(msg, base);
|
|
1188
1184
|
case 422:
|
|
1189
1185
|
return new ValidationError(msg, { ...base, fieldErrors: extractFieldErrors(body) });
|
|
1190
1186
|
case 429:
|
|
@@ -1299,28 +1295,53 @@ var OrbitClient = class {
|
|
|
1299
1295
|
this.#retryBaseDelayMs = options.retryBaseDelayMs ?? 500;
|
|
1300
1296
|
const client2 = this.#client;
|
|
1301
1297
|
const run = this.#run.bind(this);
|
|
1302
|
-
this.me = () => run(() => getIdentity({ client: client2, throwOnError: false }))
|
|
1298
|
+
this.me = () => run(() => getIdentity({ client: client2, throwOnError: false })).then(
|
|
1299
|
+
(result) => result.data
|
|
1300
|
+
);
|
|
1303
1301
|
this.projects = {
|
|
1304
1302
|
list: (params = {}) => run(() => listProjects({ client: client2, query: params, throwOnError: false })),
|
|
1305
1303
|
iterate: (params = {}) => paginate(async (cursor) => {
|
|
1306
1304
|
const page = await run(
|
|
1307
|
-
() => listProjects({
|
|
1305
|
+
() => listProjects({
|
|
1306
|
+
client: client2,
|
|
1307
|
+
query: { ...params, cursor },
|
|
1308
|
+
throwOnError: false
|
|
1309
|
+
})
|
|
1308
1310
|
);
|
|
1309
|
-
return {
|
|
1311
|
+
return {
|
|
1312
|
+
data: page.data,
|
|
1313
|
+
nextCursor: page.meta.nextCursor,
|
|
1314
|
+
hasMore: page.meta.hasMore
|
|
1315
|
+
};
|
|
1310
1316
|
}),
|
|
1311
|
-
get: (id) => run(() => getProject({ client: client2, path: { id }, throwOnError: false }))
|
|
1317
|
+
get: (id) => run(() => getProject({ client: client2, path: { id }, throwOnError: false })).then(
|
|
1318
|
+
(result) => result.data
|
|
1319
|
+
),
|
|
1312
1320
|
appToken: {
|
|
1313
1321
|
create: (projectId) => run(
|
|
1314
|
-
() => createProjectAppToken({
|
|
1315
|
-
|
|
1322
|
+
() => createProjectAppToken({
|
|
1323
|
+
client: client2,
|
|
1324
|
+
path: { id: projectId },
|
|
1325
|
+
throwOnError: false
|
|
1326
|
+
})
|
|
1327
|
+
).then((result) => result.data),
|
|
1316
1328
|
rotate: (projectId) => run(
|
|
1317
|
-
() => rotateProjectAppToken({
|
|
1318
|
-
|
|
1329
|
+
() => rotateProjectAppToken({
|
|
1330
|
+
client: client2,
|
|
1331
|
+
path: { id: projectId },
|
|
1332
|
+
throwOnError: false
|
|
1333
|
+
})
|
|
1334
|
+
).then((result) => result.data)
|
|
1319
1335
|
}
|
|
1320
1336
|
};
|
|
1321
1337
|
this.deviceTypes = {
|
|
1322
1338
|
list: (projectId, params = {}) => run(
|
|
1323
|
-
() => listDeviceTypes({
|
|
1339
|
+
() => listDeviceTypes({
|
|
1340
|
+
client: client2,
|
|
1341
|
+
path: { projectId },
|
|
1342
|
+
query: params,
|
|
1343
|
+
throwOnError: false
|
|
1344
|
+
})
|
|
1324
1345
|
),
|
|
1325
1346
|
iterate: (projectId, params = {}) => paginate(async (cursor) => {
|
|
1326
1347
|
const page = await run(
|
|
@@ -1331,36 +1352,70 @@ var OrbitClient = class {
|
|
|
1331
1352
|
throwOnError: false
|
|
1332
1353
|
})
|
|
1333
1354
|
);
|
|
1334
|
-
return {
|
|
1355
|
+
return {
|
|
1356
|
+
data: page.data,
|
|
1357
|
+
nextCursor: page.meta.nextCursor,
|
|
1358
|
+
hasMore: page.meta.hasMore
|
|
1359
|
+
};
|
|
1335
1360
|
}),
|
|
1336
1361
|
get: (projectId, slug) => run(
|
|
1337
|
-
() => getDeviceType({
|
|
1338
|
-
|
|
1362
|
+
() => getDeviceType({
|
|
1363
|
+
client: client2,
|
|
1364
|
+
path: { projectId, slug },
|
|
1365
|
+
throwOnError: false
|
|
1366
|
+
})
|
|
1367
|
+
).then((result) => result.data),
|
|
1339
1368
|
create: (projectId, body) => run(
|
|
1340
|
-
() => createDeviceType({
|
|
1341
|
-
|
|
1369
|
+
() => createDeviceType({
|
|
1370
|
+
client: client2,
|
|
1371
|
+
path: { projectId },
|
|
1372
|
+
body,
|
|
1373
|
+
throwOnError: false
|
|
1374
|
+
})
|
|
1375
|
+
).then((result) => result.data),
|
|
1342
1376
|
update: (projectId, slug, body) => run(
|
|
1343
|
-
() => updateDeviceType({
|
|
1344
|
-
|
|
1377
|
+
() => updateDeviceType({
|
|
1378
|
+
client: client2,
|
|
1379
|
+
path: { projectId, slug },
|
|
1380
|
+
body,
|
|
1381
|
+
throwOnError: false
|
|
1382
|
+
})
|
|
1383
|
+
).then((result) => result.data),
|
|
1345
1384
|
delete: async (projectId, slug) => {
|
|
1346
1385
|
await run(
|
|
1347
|
-
() => deleteDeviceType({
|
|
1386
|
+
() => deleteDeviceType({
|
|
1387
|
+
client: client2,
|
|
1388
|
+
path: { projectId, slug },
|
|
1389
|
+
throwOnError: false
|
|
1390
|
+
})
|
|
1348
1391
|
);
|
|
1349
1392
|
}
|
|
1350
1393
|
};
|
|
1351
1394
|
this.devices = {
|
|
1352
1395
|
list: (params = {}) => run(() => listDevices({ client: client2, query: params, throwOnError: false })),
|
|
1353
|
-
get: (id) => run(() => getDevice({ client: client2, path: { id }, throwOnError: false }))
|
|
1396
|
+
get: (id) => run(() => getDevice({ client: client2, path: { id }, throwOnError: false })).then(
|
|
1397
|
+
(result) => result.data
|
|
1398
|
+
),
|
|
1354
1399
|
iterate: (params = {}) => paginate(async (cursor) => {
|
|
1355
1400
|
const page = await run(
|
|
1356
|
-
() => listDevices({
|
|
1401
|
+
() => listDevices({
|
|
1402
|
+
client: client2,
|
|
1403
|
+
query: { ...params, cursor },
|
|
1404
|
+
throwOnError: false
|
|
1405
|
+
})
|
|
1357
1406
|
);
|
|
1358
|
-
return {
|
|
1407
|
+
return {
|
|
1408
|
+
data: page.data,
|
|
1409
|
+
nextCursor: page.meta.nextCursor,
|
|
1410
|
+
hasMore: page.meta.hasMore
|
|
1411
|
+
};
|
|
1359
1412
|
}),
|
|
1360
1413
|
delete: async (id) => {
|
|
1361
1414
|
await run(() => deleteDevice({ client: client2, path: { id }, throwOnError: false }));
|
|
1362
1415
|
},
|
|
1363
|
-
resetToken: (id) => run(
|
|
1416
|
+
resetToken: (id) => run(
|
|
1417
|
+
() => resetDeviceToken({ client: client2, path: { id }, throwOnError: false })
|
|
1418
|
+
).then((result) => result.data)
|
|
1364
1419
|
};
|
|
1365
1420
|
this.admissions = {
|
|
1366
1421
|
list: (params = {}) => run(
|
|
@@ -1368,34 +1423,68 @@ var OrbitClient = class {
|
|
|
1368
1423
|
),
|
|
1369
1424
|
iterate: (params = {}) => paginate(async (cursor) => {
|
|
1370
1425
|
const page = await run(
|
|
1371
|
-
() => listAdmissions({
|
|
1426
|
+
() => listAdmissions({
|
|
1427
|
+
client: client2,
|
|
1428
|
+
query: { ...params, cursor },
|
|
1429
|
+
throwOnError: false
|
|
1430
|
+
})
|
|
1372
1431
|
);
|
|
1373
|
-
return {
|
|
1432
|
+
return {
|
|
1433
|
+
data: page.data,
|
|
1434
|
+
nextCursor: page.meta.nextCursor,
|
|
1435
|
+
hasMore: page.meta.hasMore
|
|
1436
|
+
};
|
|
1374
1437
|
}),
|
|
1375
|
-
get: (id) => run(
|
|
1438
|
+
get: (id) => run(
|
|
1439
|
+
() => getAdmission({ client: client2, path: { id }, throwOnError: false })
|
|
1440
|
+
).then((result) => result.data),
|
|
1376
1441
|
accept: (id, params) => run(
|
|
1377
|
-
() => acceptAdmission({
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1442
|
+
() => acceptAdmission({
|
|
1443
|
+
client: client2,
|
|
1444
|
+
path: { id },
|
|
1445
|
+
body: params,
|
|
1446
|
+
throwOnError: false
|
|
1447
|
+
})
|
|
1448
|
+
).then((result) => result.data),
|
|
1449
|
+
reject: (id) => run(
|
|
1450
|
+
() => rejectAdmission({ client: client2, path: { id }, throwOnError: false })
|
|
1451
|
+
).then((result) => result.data),
|
|
1452
|
+
dismiss: (id) => run(
|
|
1453
|
+
() => dismissAdmission({ client: client2, path: { id }, throwOnError: false })
|
|
1454
|
+
).then((result) => result.data)
|
|
1381
1455
|
};
|
|
1382
1456
|
this.telemetry = {
|
|
1383
1457
|
latest: (deviceId) => run(
|
|
1384
|
-
() => getLatestTelemetry({
|
|
1385
|
-
|
|
1458
|
+
() => getLatestTelemetry({
|
|
1459
|
+
client: client2,
|
|
1460
|
+
path: { id: deviceId },
|
|
1461
|
+
throwOnError: false
|
|
1462
|
+
})
|
|
1463
|
+
).then((result) => result.data),
|
|
1386
1464
|
history: (deviceId, params = {}) => run(
|
|
1387
|
-
() => getTelemetryHistory({
|
|
1465
|
+
() => getTelemetryHistory({
|
|
1466
|
+
client: client2,
|
|
1467
|
+
path: { id: deviceId },
|
|
1468
|
+
query: params,
|
|
1469
|
+
throwOnError: false
|
|
1470
|
+
})
|
|
1388
1471
|
).then((result) => result.data),
|
|
1389
1472
|
manifest: (deviceId) => run(
|
|
1390
|
-
() => getTelemetryManifest({
|
|
1391
|
-
|
|
1473
|
+
() => getTelemetryManifest({
|
|
1474
|
+
client: client2,
|
|
1475
|
+
path: { id: deviceId },
|
|
1476
|
+
throwOnError: false
|
|
1477
|
+
})
|
|
1478
|
+
).then((result) => result.data)
|
|
1392
1479
|
};
|
|
1393
1480
|
this.firmware = {
|
|
1394
1481
|
upload: (params) => run(
|
|
1395
1482
|
() => uploadFirmware({ client: client2, body: params, throwOnError: false })
|
|
1396
|
-
).then((result) => result.
|
|
1483
|
+
).then((result) => result.data),
|
|
1397
1484
|
deleteBundle: async (id) => {
|
|
1398
|
-
await run(
|
|
1485
|
+
await run(
|
|
1486
|
+
() => deleteFirmwareBundle({ client: client2, path: { id }, throwOnError: false })
|
|
1487
|
+
);
|
|
1399
1488
|
},
|
|
1400
1489
|
bundles: {
|
|
1401
1490
|
list: (params = {}) => run(
|
|
@@ -1403,22 +1492,44 @@ var OrbitClient = class {
|
|
|
1403
1492
|
),
|
|
1404
1493
|
iterate: (params = {}) => paginate(async (cursor) => {
|
|
1405
1494
|
const page = await run(
|
|
1406
|
-
() => listFirmwareBundles({
|
|
1495
|
+
() => listFirmwareBundles({
|
|
1496
|
+
client: client2,
|
|
1497
|
+
query: { ...params, cursor },
|
|
1498
|
+
throwOnError: false
|
|
1499
|
+
})
|
|
1407
1500
|
);
|
|
1408
|
-
return {
|
|
1501
|
+
return {
|
|
1502
|
+
data: page.data,
|
|
1503
|
+
nextCursor: page.meta.nextCursor,
|
|
1504
|
+
hasMore: page.meta.hasMore
|
|
1505
|
+
};
|
|
1409
1506
|
}),
|
|
1410
|
-
get: (id) => run(
|
|
1507
|
+
get: (id) => run(
|
|
1508
|
+
() => getFirmwareBundle({ client: client2, path: { id }, throwOnError: false })
|
|
1509
|
+
).then((result) => result.data)
|
|
1411
1510
|
},
|
|
1412
1511
|
deployments: {
|
|
1413
1512
|
trigger: (params) => run(
|
|
1414
|
-
() => triggerFirmwareDeployment({
|
|
1415
|
-
|
|
1513
|
+
() => triggerFirmwareDeployment({
|
|
1514
|
+
client: client2,
|
|
1515
|
+
body: params,
|
|
1516
|
+
throwOnError: false
|
|
1517
|
+
})
|
|
1518
|
+
).then((result) => result.data),
|
|
1416
1519
|
list: (params = {}) => run(
|
|
1417
|
-
() => listFirmwareDeployments({
|
|
1520
|
+
() => listFirmwareDeployments({
|
|
1521
|
+
client: client2,
|
|
1522
|
+
query: params,
|
|
1523
|
+
throwOnError: false
|
|
1524
|
+
})
|
|
1418
1525
|
),
|
|
1419
1526
|
iterate: (params = {}) => paginate(async (cursor) => {
|
|
1420
1527
|
const page = await run(
|
|
1421
|
-
() => listFirmwareDeployments({
|
|
1528
|
+
() => listFirmwareDeployments({
|
|
1529
|
+
client: client2,
|
|
1530
|
+
query: { ...params, cursor },
|
|
1531
|
+
throwOnError: false
|
|
1532
|
+
})
|
|
1422
1533
|
);
|
|
1423
1534
|
return {
|
|
1424
1535
|
data: page.data,
|
|
@@ -1427,39 +1538,64 @@ var OrbitClient = class {
|
|
|
1427
1538
|
};
|
|
1428
1539
|
}),
|
|
1429
1540
|
get: (id) => run(
|
|
1430
|
-
() => getFirmwareDeployment({
|
|
1431
|
-
|
|
1541
|
+
() => getFirmwareDeployment({
|
|
1542
|
+
client: client2,
|
|
1543
|
+
path: { id },
|
|
1544
|
+
throwOnError: false
|
|
1545
|
+
})
|
|
1546
|
+
).then((result) => result.data),
|
|
1432
1547
|
cancel: (id, params = {}) => run(
|
|
1433
|
-
() => cancelFirmwareDeployment({
|
|
1434
|
-
|
|
1548
|
+
() => cancelFirmwareDeployment({
|
|
1549
|
+
client: client2,
|
|
1550
|
+
path: { id },
|
|
1551
|
+
body: params,
|
|
1552
|
+
throwOnError: false
|
|
1553
|
+
})
|
|
1554
|
+
).then((result) => result.data),
|
|
1435
1555
|
rollback: (id, params = {}) => run(
|
|
1436
|
-
() => rollbackFirmwareDeployment({
|
|
1437
|
-
|
|
1556
|
+
() => rollbackFirmwareDeployment({
|
|
1557
|
+
client: client2,
|
|
1558
|
+
path: { id },
|
|
1559
|
+
body: params,
|
|
1560
|
+
throwOnError: false
|
|
1561
|
+
})
|
|
1562
|
+
).then((result) => result.data)
|
|
1438
1563
|
}
|
|
1439
1564
|
};
|
|
1440
1565
|
this.commands = {
|
|
1441
1566
|
exec: (deviceId, command) => run(
|
|
1442
|
-
() => execDeviceCommand({
|
|
1443
|
-
|
|
1567
|
+
() => execDeviceCommand({
|
|
1568
|
+
client: client2,
|
|
1569
|
+
path: { id: deviceId },
|
|
1570
|
+
body: command,
|
|
1571
|
+
throwOnError: false
|
|
1572
|
+
})
|
|
1573
|
+
).then((result) => result.data),
|
|
1444
1574
|
get: (deviceId, invocationId) => run(
|
|
1445
1575
|
() => getDeviceCommandInvocation({
|
|
1446
1576
|
client: client2,
|
|
1447
1577
|
path: { id: deviceId, invocationId },
|
|
1448
1578
|
throwOnError: false
|
|
1449
1579
|
})
|
|
1450
|
-
),
|
|
1580
|
+
).then((result) => result.data),
|
|
1451
1581
|
manifest: (deviceId) => run(
|
|
1452
|
-
() => getDeviceCommands({
|
|
1453
|
-
|
|
1582
|
+
() => getDeviceCommands({
|
|
1583
|
+
client: client2,
|
|
1584
|
+
path: { id: deviceId },
|
|
1585
|
+
throwOnError: false
|
|
1586
|
+
})
|
|
1587
|
+
).then((result) => result.data)
|
|
1454
1588
|
};
|
|
1455
1589
|
this.usb = {
|
|
1456
|
-
list: (deviceId) => run(() => listExportable(client2, deviceId)).then(
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1590
|
+
list: (deviceId) => run(() => listExportable(client2, deviceId)).then((result) => result.data),
|
|
1591
|
+
ticket: (params) => run(() => createTicket(client2, params)).then(
|
|
1592
|
+
(result) => result.data
|
|
1593
|
+
)
|
|
1460
1594
|
};
|
|
1461
1595
|
this.terminal = {
|
|
1462
|
-
ticket: (params) => run(() => createTicket2(client2, params))
|
|
1596
|
+
ticket: (params) => run(() => createTicket2(client2, params)).then(
|
|
1597
|
+
(result) => result.data
|
|
1598
|
+
)
|
|
1463
1599
|
};
|
|
1464
1600
|
this.webhooks = {
|
|
1465
1601
|
list: (params = {}) => run(
|
|
@@ -1467,22 +1603,42 @@ var OrbitClient = class {
|
|
|
1467
1603
|
),
|
|
1468
1604
|
iterate: (params = {}) => paginate(async (cursor) => {
|
|
1469
1605
|
const page = await run(
|
|
1470
|
-
() => listWebhooks({
|
|
1606
|
+
() => listWebhooks({
|
|
1607
|
+
client: client2,
|
|
1608
|
+
query: { ...params, cursor },
|
|
1609
|
+
throwOnError: false
|
|
1610
|
+
})
|
|
1471
1611
|
);
|
|
1472
|
-
return {
|
|
1612
|
+
return {
|
|
1613
|
+
data: page.data,
|
|
1614
|
+
nextCursor: page.meta.nextCursor,
|
|
1615
|
+
hasMore: page.meta.hasMore
|
|
1616
|
+
};
|
|
1473
1617
|
}),
|
|
1474
1618
|
create: (params) => run(
|
|
1475
1619
|
() => createWebhook({ client: client2, body: params, throwOnError: false })
|
|
1476
|
-
),
|
|
1477
|
-
get: (id) => run(
|
|
1620
|
+
).then((result) => result.data),
|
|
1621
|
+
get: (id) => run(
|
|
1622
|
+
() => getWebhook({ client: client2, path: { id }, throwOnError: false })
|
|
1623
|
+
).then((result) => result.data),
|
|
1478
1624
|
update: (id, params) => run(
|
|
1479
|
-
() => updateWebhook({
|
|
1480
|
-
|
|
1625
|
+
() => updateWebhook({
|
|
1626
|
+
client: client2,
|
|
1627
|
+
path: { id },
|
|
1628
|
+
body: params,
|
|
1629
|
+
throwOnError: false
|
|
1630
|
+
})
|
|
1631
|
+
).then((result) => result.data),
|
|
1481
1632
|
delete: async (id) => {
|
|
1482
1633
|
await run(() => deleteWebhook({ client: client2, path: { id }, throwOnError: false }));
|
|
1483
1634
|
},
|
|
1484
1635
|
deliveries: (id, params = {}) => run(
|
|
1485
|
-
() => listWebhookDeliveries({
|
|
1636
|
+
() => listWebhookDeliveries({
|
|
1637
|
+
client: client2,
|
|
1638
|
+
path: { id },
|
|
1639
|
+
query: params,
|
|
1640
|
+
throwOnError: false
|
|
1641
|
+
})
|
|
1486
1642
|
),
|
|
1487
1643
|
iterateDeliveries: (id, params = {}) => paginate(async (cursor) => {
|
|
1488
1644
|
const page = await run(
|
|
@@ -1493,7 +1649,11 @@ var OrbitClient = class {
|
|
|
1493
1649
|
throwOnError: false
|
|
1494
1650
|
})
|
|
1495
1651
|
);
|
|
1496
|
-
return {
|
|
1652
|
+
return {
|
|
1653
|
+
data: page.data,
|
|
1654
|
+
nextCursor: page.meta.nextCursor,
|
|
1655
|
+
hasMore: page.meta.hasMore
|
|
1656
|
+
};
|
|
1497
1657
|
})
|
|
1498
1658
|
};
|
|
1499
1659
|
}
|
|
@@ -1661,6 +1821,7 @@ __export(generated_exports, {
|
|
|
1661
1821
|
exports.AuthenticationError = AuthenticationError;
|
|
1662
1822
|
exports.BadRequestError = BadRequestError;
|
|
1663
1823
|
exports.BundleExistsError = BundleExistsError;
|
|
1824
|
+
exports.ConflictError = ConflictError;
|
|
1664
1825
|
exports.DeviceRpcError = DeviceRpcError;
|
|
1665
1826
|
exports.InsufficientScopeError = InsufficientScopeError;
|
|
1666
1827
|
exports.NetworkError = NetworkError;
|