@omirion/orbit-sdk 0.2.0 → 0.3.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.
package/dist/index.js CHANGED
@@ -1293,28 +1293,53 @@ var OrbitClient = class {
1293
1293
  this.#retryBaseDelayMs = options.retryBaseDelayMs ?? 500;
1294
1294
  const client2 = this.#client;
1295
1295
  const run = this.#run.bind(this);
1296
- this.me = () => run(() => getIdentity({ client: client2, throwOnError: false }));
1296
+ this.me = () => run(() => getIdentity({ client: client2, throwOnError: false })).then(
1297
+ (result) => result.data
1298
+ );
1297
1299
  this.projects = {
1298
1300
  list: (params = {}) => run(() => listProjects({ client: client2, query: params, throwOnError: false })),
1299
1301
  iterate: (params = {}) => paginate(async (cursor) => {
1300
1302
  const page = await run(
1301
- () => listProjects({ client: client2, query: { ...params, cursor }, throwOnError: false })
1303
+ () => listProjects({
1304
+ client: client2,
1305
+ query: { ...params, cursor },
1306
+ throwOnError: false
1307
+ })
1302
1308
  );
1303
- return { data: page.data, nextCursor: page.meta.nextCursor, hasMore: page.meta.hasMore };
1309
+ return {
1310
+ data: page.data,
1311
+ nextCursor: page.meta.nextCursor,
1312
+ hasMore: page.meta.hasMore
1313
+ };
1304
1314
  }),
1305
- get: (id) => run(() => getProject({ client: client2, path: { id }, throwOnError: false })),
1315
+ get: (id) => run(() => getProject({ client: client2, path: { id }, throwOnError: false })).then(
1316
+ (result) => result.data
1317
+ ),
1306
1318
  appToken: {
1307
1319
  create: (projectId) => run(
1308
- () => createProjectAppToken({ client: client2, path: { id: projectId }, throwOnError: false })
1309
- ),
1320
+ () => createProjectAppToken({
1321
+ client: client2,
1322
+ path: { id: projectId },
1323
+ throwOnError: false
1324
+ })
1325
+ ).then((result) => result.data),
1310
1326
  rotate: (projectId) => run(
1311
- () => rotateProjectAppToken({ client: client2, path: { id: projectId }, throwOnError: false })
1312
- )
1327
+ () => rotateProjectAppToken({
1328
+ client: client2,
1329
+ path: { id: projectId },
1330
+ throwOnError: false
1331
+ })
1332
+ ).then((result) => result.data)
1313
1333
  }
1314
1334
  };
1315
1335
  this.deviceTypes = {
1316
1336
  list: (projectId, params = {}) => run(
1317
- () => listDeviceTypes({ client: client2, path: { projectId }, query: params, throwOnError: false })
1337
+ () => listDeviceTypes({
1338
+ client: client2,
1339
+ path: { projectId },
1340
+ query: params,
1341
+ throwOnError: false
1342
+ })
1318
1343
  ),
1319
1344
  iterate: (projectId, params = {}) => paginate(async (cursor) => {
1320
1345
  const page = await run(
@@ -1325,36 +1350,70 @@ var OrbitClient = class {
1325
1350
  throwOnError: false
1326
1351
  })
1327
1352
  );
1328
- return { data: page.data, nextCursor: page.meta.nextCursor, hasMore: page.meta.hasMore };
1353
+ return {
1354
+ data: page.data,
1355
+ nextCursor: page.meta.nextCursor,
1356
+ hasMore: page.meta.hasMore
1357
+ };
1329
1358
  }),
1330
1359
  get: (projectId, slug) => run(
1331
- () => getDeviceType({ client: client2, path: { projectId, slug }, throwOnError: false })
1332
- ),
1360
+ () => getDeviceType({
1361
+ client: client2,
1362
+ path: { projectId, slug },
1363
+ throwOnError: false
1364
+ })
1365
+ ).then((result) => result.data),
1333
1366
  create: (projectId, body) => run(
1334
- () => createDeviceType({ client: client2, path: { projectId }, body, throwOnError: false })
1335
- ),
1367
+ () => createDeviceType({
1368
+ client: client2,
1369
+ path: { projectId },
1370
+ body,
1371
+ throwOnError: false
1372
+ })
1373
+ ).then((result) => result.data),
1336
1374
  update: (projectId, slug, body) => run(
1337
- () => updateDeviceType({ client: client2, path: { projectId, slug }, body, throwOnError: false })
1338
- ),
1375
+ () => updateDeviceType({
1376
+ client: client2,
1377
+ path: { projectId, slug },
1378
+ body,
1379
+ throwOnError: false
1380
+ })
1381
+ ).then((result) => result.data),
1339
1382
  delete: async (projectId, slug) => {
1340
1383
  await run(
1341
- () => deleteDeviceType({ client: client2, path: { projectId, slug }, throwOnError: false })
1384
+ () => deleteDeviceType({
1385
+ client: client2,
1386
+ path: { projectId, slug },
1387
+ throwOnError: false
1388
+ })
1342
1389
  );
1343
1390
  }
1344
1391
  };
1345
1392
  this.devices = {
1346
1393
  list: (params = {}) => run(() => listDevices({ client: client2, query: params, throwOnError: false })),
1347
- get: (id) => run(() => getDevice({ client: client2, path: { id }, throwOnError: false })),
1394
+ get: (id) => run(() => getDevice({ client: client2, path: { id }, throwOnError: false })).then(
1395
+ (result) => result.data
1396
+ ),
1348
1397
  iterate: (params = {}) => paginate(async (cursor) => {
1349
1398
  const page = await run(
1350
- () => listDevices({ client: client2, query: { ...params, cursor }, throwOnError: false })
1399
+ () => listDevices({
1400
+ client: client2,
1401
+ query: { ...params, cursor },
1402
+ throwOnError: false
1403
+ })
1351
1404
  );
1352
- return { data: page.data, nextCursor: page.meta.nextCursor, hasMore: page.meta.hasMore };
1405
+ return {
1406
+ data: page.data,
1407
+ nextCursor: page.meta.nextCursor,
1408
+ hasMore: page.meta.hasMore
1409
+ };
1353
1410
  }),
1354
1411
  delete: async (id) => {
1355
1412
  await run(() => deleteDevice({ client: client2, path: { id }, throwOnError: false }));
1356
1413
  },
1357
- resetToken: (id) => run(() => resetDeviceToken({ client: client2, path: { id }, throwOnError: false }))
1414
+ resetToken: (id) => run(
1415
+ () => resetDeviceToken({ client: client2, path: { id }, throwOnError: false })
1416
+ ).then((result) => result.data)
1358
1417
  };
1359
1418
  this.admissions = {
1360
1419
  list: (params = {}) => run(
@@ -1362,34 +1421,68 @@ var OrbitClient = class {
1362
1421
  ),
1363
1422
  iterate: (params = {}) => paginate(async (cursor) => {
1364
1423
  const page = await run(
1365
- () => listAdmissions({ client: client2, query: { ...params, cursor }, throwOnError: false })
1424
+ () => listAdmissions({
1425
+ client: client2,
1426
+ query: { ...params, cursor },
1427
+ throwOnError: false
1428
+ })
1366
1429
  );
1367
- return { data: page.data, nextCursor: page.meta.nextCursor, hasMore: page.meta.hasMore };
1430
+ return {
1431
+ data: page.data,
1432
+ nextCursor: page.meta.nextCursor,
1433
+ hasMore: page.meta.hasMore
1434
+ };
1368
1435
  }),
1369
- get: (id) => run(() => getAdmission({ client: client2, path: { id }, throwOnError: false })),
1436
+ get: (id) => run(
1437
+ () => getAdmission({ client: client2, path: { id }, throwOnError: false })
1438
+ ).then((result) => result.data),
1370
1439
  accept: (id, params) => run(
1371
- () => acceptAdmission({ client: client2, path: { id }, body: params, throwOnError: false })
1372
- ),
1373
- reject: (id) => run(() => rejectAdmission({ client: client2, path: { id }, throwOnError: false })),
1374
- dismiss: (id) => run(() => dismissAdmission({ client: client2, path: { id }, throwOnError: false }))
1440
+ () => acceptAdmission({
1441
+ client: client2,
1442
+ path: { id },
1443
+ body: params,
1444
+ throwOnError: false
1445
+ })
1446
+ ).then((result) => result.data),
1447
+ reject: (id) => run(
1448
+ () => rejectAdmission({ client: client2, path: { id }, throwOnError: false })
1449
+ ).then((result) => result.data),
1450
+ dismiss: (id) => run(
1451
+ () => dismissAdmission({ client: client2, path: { id }, throwOnError: false })
1452
+ ).then((result) => result.data)
1375
1453
  };
1376
1454
  this.telemetry = {
1377
1455
  latest: (deviceId) => run(
1378
- () => getLatestTelemetry({ client: client2, path: { id: deviceId }, throwOnError: false })
1379
- ),
1456
+ () => getLatestTelemetry({
1457
+ client: client2,
1458
+ path: { id: deviceId },
1459
+ throwOnError: false
1460
+ })
1461
+ ).then((result) => result.data),
1380
1462
  history: (deviceId, params = {}) => run(
1381
- () => getTelemetryHistory({ client: client2, path: { id: deviceId }, query: params, throwOnError: false })
1463
+ () => getTelemetryHistory({
1464
+ client: client2,
1465
+ path: { id: deviceId },
1466
+ query: params,
1467
+ throwOnError: false
1468
+ })
1382
1469
  ).then((result) => result.data),
1383
1470
  manifest: (deviceId) => run(
1384
- () => getTelemetryManifest({ client: client2, path: { id: deviceId }, throwOnError: false })
1385
- )
1471
+ () => getTelemetryManifest({
1472
+ client: client2,
1473
+ path: { id: deviceId },
1474
+ throwOnError: false
1475
+ })
1476
+ ).then((result) => result.data)
1386
1477
  };
1387
1478
  this.firmware = {
1388
1479
  upload: (params) => run(
1389
1480
  () => uploadFirmware({ client: client2, body: params, throwOnError: false })
1390
- ).then((result) => result.bundle),
1481
+ ).then((result) => result.data),
1391
1482
  deleteBundle: async (id) => {
1392
- await run(() => deleteFirmwareBundle({ client: client2, path: { id }, throwOnError: false }));
1483
+ await run(
1484
+ () => deleteFirmwareBundle({ client: client2, path: { id }, throwOnError: false })
1485
+ );
1393
1486
  },
1394
1487
  bundles: {
1395
1488
  list: (params = {}) => run(
@@ -1397,22 +1490,44 @@ var OrbitClient = class {
1397
1490
  ),
1398
1491
  iterate: (params = {}) => paginate(async (cursor) => {
1399
1492
  const page = await run(
1400
- () => listFirmwareBundles({ client: client2, query: { ...params, cursor }, throwOnError: false })
1493
+ () => listFirmwareBundles({
1494
+ client: client2,
1495
+ query: { ...params, cursor },
1496
+ throwOnError: false
1497
+ })
1401
1498
  );
1402
- return { data: page.data, nextCursor: page.meta.nextCursor, hasMore: page.meta.hasMore };
1499
+ return {
1500
+ data: page.data,
1501
+ nextCursor: page.meta.nextCursor,
1502
+ hasMore: page.meta.hasMore
1503
+ };
1403
1504
  }),
1404
- get: (id) => run(() => getFirmwareBundle({ client: client2, path: { id }, throwOnError: false }))
1505
+ get: (id) => run(
1506
+ () => getFirmwareBundle({ client: client2, path: { id }, throwOnError: false })
1507
+ ).then((result) => result.data)
1405
1508
  },
1406
1509
  deployments: {
1407
1510
  trigger: (params) => run(
1408
- () => triggerFirmwareDeployment({ client: client2, body: params, throwOnError: false })
1409
- ).then((result) => result.deployments),
1511
+ () => triggerFirmwareDeployment({
1512
+ client: client2,
1513
+ body: params,
1514
+ throwOnError: false
1515
+ })
1516
+ ).then((result) => result.data),
1410
1517
  list: (params = {}) => run(
1411
- () => listFirmwareDeployments({ client: client2, query: params, throwOnError: false })
1518
+ () => listFirmwareDeployments({
1519
+ client: client2,
1520
+ query: params,
1521
+ throwOnError: false
1522
+ })
1412
1523
  ),
1413
1524
  iterate: (params = {}) => paginate(async (cursor) => {
1414
1525
  const page = await run(
1415
- () => listFirmwareDeployments({ client: client2, query: { ...params, cursor }, throwOnError: false })
1526
+ () => listFirmwareDeployments({
1527
+ client: client2,
1528
+ query: { ...params, cursor },
1529
+ throwOnError: false
1530
+ })
1416
1531
  );
1417
1532
  return {
1418
1533
  data: page.data,
@@ -1421,39 +1536,64 @@ var OrbitClient = class {
1421
1536
  };
1422
1537
  }),
1423
1538
  get: (id) => run(
1424
- () => getFirmwareDeployment({ client: client2, path: { id }, throwOnError: false })
1425
- ),
1539
+ () => getFirmwareDeployment({
1540
+ client: client2,
1541
+ path: { id },
1542
+ throwOnError: false
1543
+ })
1544
+ ).then((result) => result.data),
1426
1545
  cancel: (id, params = {}) => run(
1427
- () => cancelFirmwareDeployment({ client: client2, path: { id }, body: params, throwOnError: false })
1428
- ),
1546
+ () => cancelFirmwareDeployment({
1547
+ client: client2,
1548
+ path: { id },
1549
+ body: params,
1550
+ throwOnError: false
1551
+ })
1552
+ ).then((result) => result.data),
1429
1553
  rollback: (id, params = {}) => run(
1430
- () => rollbackFirmwareDeployment({ client: client2, path: { id }, body: params, throwOnError: false })
1431
- )
1554
+ () => rollbackFirmwareDeployment({
1555
+ client: client2,
1556
+ path: { id },
1557
+ body: params,
1558
+ throwOnError: false
1559
+ })
1560
+ ).then((result) => result.data)
1432
1561
  }
1433
1562
  };
1434
1563
  this.commands = {
1435
1564
  exec: (deviceId, command) => run(
1436
- () => execDeviceCommand({ client: client2, path: { id: deviceId }, body: command, throwOnError: false })
1437
- ),
1565
+ () => execDeviceCommand({
1566
+ client: client2,
1567
+ path: { id: deviceId },
1568
+ body: command,
1569
+ throwOnError: false
1570
+ })
1571
+ ).then((result) => result.data),
1438
1572
  get: (deviceId, invocationId) => run(
1439
1573
  () => getDeviceCommandInvocation({
1440
1574
  client: client2,
1441
1575
  path: { id: deviceId, invocationId },
1442
1576
  throwOnError: false
1443
1577
  })
1444
- ),
1578
+ ).then((result) => result.data),
1445
1579
  manifest: (deviceId) => run(
1446
- () => getDeviceCommands({ client: client2, path: { id: deviceId }, throwOnError: false })
1447
- )
1580
+ () => getDeviceCommands({
1581
+ client: client2,
1582
+ path: { id: deviceId },
1583
+ throwOnError: false
1584
+ })
1585
+ ).then((result) => result.data)
1448
1586
  };
1449
1587
  this.usb = {
1450
- list: (deviceId) => run(() => listExportable(client2, deviceId)).then(
1451
- (result) => result.exports
1452
- ),
1453
- ticket: (params) => run(() => createTicket(client2, params))
1588
+ list: (deviceId) => run(() => listExportable(client2, deviceId)).then((result) => result.data),
1589
+ ticket: (params) => run(() => createTicket(client2, params)).then(
1590
+ (result) => result.data
1591
+ )
1454
1592
  };
1455
1593
  this.terminal = {
1456
- ticket: (params) => run(() => createTicket2(client2, params))
1594
+ ticket: (params) => run(() => createTicket2(client2, params)).then(
1595
+ (result) => result.data
1596
+ )
1457
1597
  };
1458
1598
  this.webhooks = {
1459
1599
  list: (params = {}) => run(
@@ -1461,22 +1601,42 @@ var OrbitClient = class {
1461
1601
  ),
1462
1602
  iterate: (params = {}) => paginate(async (cursor) => {
1463
1603
  const page = await run(
1464
- () => listWebhooks({ client: client2, query: { ...params, cursor }, throwOnError: false })
1604
+ () => listWebhooks({
1605
+ client: client2,
1606
+ query: { ...params, cursor },
1607
+ throwOnError: false
1608
+ })
1465
1609
  );
1466
- return { data: page.data, nextCursor: page.meta.nextCursor, hasMore: page.meta.hasMore };
1610
+ return {
1611
+ data: page.data,
1612
+ nextCursor: page.meta.nextCursor,
1613
+ hasMore: page.meta.hasMore
1614
+ };
1467
1615
  }),
1468
1616
  create: (params) => run(
1469
1617
  () => createWebhook({ client: client2, body: params, throwOnError: false })
1470
- ),
1471
- get: (id) => run(() => getWebhook({ client: client2, path: { id }, throwOnError: false })),
1618
+ ).then((result) => result.data),
1619
+ get: (id) => run(
1620
+ () => getWebhook({ client: client2, path: { id }, throwOnError: false })
1621
+ ).then((result) => result.data),
1472
1622
  update: (id, params) => run(
1473
- () => updateWebhook({ client: client2, path: { id }, body: params, throwOnError: false })
1474
- ),
1623
+ () => updateWebhook({
1624
+ client: client2,
1625
+ path: { id },
1626
+ body: params,
1627
+ throwOnError: false
1628
+ })
1629
+ ).then((result) => result.data),
1475
1630
  delete: async (id) => {
1476
1631
  await run(() => deleteWebhook({ client: client2, path: { id }, throwOnError: false }));
1477
1632
  },
1478
1633
  deliveries: (id, params = {}) => run(
1479
- () => listWebhookDeliveries({ client: client2, path: { id }, query: params, throwOnError: false })
1634
+ () => listWebhookDeliveries({
1635
+ client: client2,
1636
+ path: { id },
1637
+ query: params,
1638
+ throwOnError: false
1639
+ })
1480
1640
  ),
1481
1641
  iterateDeliveries: (id, params = {}) => paginate(async (cursor) => {
1482
1642
  const page = await run(
@@ -1487,7 +1647,11 @@ var OrbitClient = class {
1487
1647
  throwOnError: false
1488
1648
  })
1489
1649
  );
1490
- return { data: page.data, nextCursor: page.meta.nextCursor, hasMore: page.meta.hasMore };
1650
+ return {
1651
+ data: page.data,
1652
+ nextCursor: page.meta.nextCursor,
1653
+ hasMore: page.meta.hasMore
1654
+ };
1491
1655
  })
1492
1656
  };
1493
1657
  }