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