@robosystems/client 0.3.19 → 0.3.20

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.
@@ -67,6 +67,7 @@ import {
67
67
  } from '../sdk.gen'
68
68
  import type {
69
69
  AddPublishListMembersOperation,
70
+ AssociationResponse,
70
71
  AutoMapElementsOperation,
71
72
  ClosePeriodOperation,
72
73
  CreateAgentRequest,
@@ -79,18 +80,34 @@ import type {
79
80
  CreateTaxonomyBlockRequest,
80
81
  CreateViewRequest,
81
82
  DeleteInformationBlockRequest,
83
+ DeleteInformationBlockResponse,
82
84
  DeleteJournalEntryRequest,
83
85
  DeleteMappingAssociationOperation,
86
+ DeleteResult,
84
87
  DeleteTaxonomyBlockRequest,
88
+ DeleteTaxonomyBlockResponse,
89
+ EntityTaxonomyResponse,
85
90
  EvaluateRulesRequest,
91
+ EvaluateRulesResponse,
92
+ EventBlockEnvelope,
93
+ EventHandlerResponse,
86
94
  FileReportRequest,
87
95
  FinancialStatementAnalysisRequest,
96
+ InformationBlockEnvelope,
88
97
  InitializeLedgerRequest,
98
+ JournalEntryResponse,
99
+ LedgerAgentResponse,
89
100
  LinkEntityTaxonomyRequest,
90
101
  LiveFinancialStatementRequest,
91
102
  OperationEnvelope,
103
+ PreviewEventBlockResponse,
104
+ PublishListMemberResponse,
105
+ PublishListResponse,
92
106
  ReopenPeriodOperation,
107
+ ReportResponse,
93
108
  SetCloseTargetOperation,
109
+ ShareReportResponse,
110
+ TaxonomyBlockEnvelope,
94
111
  TransitionFilingStatusRequest,
95
112
  UpdateAgentRequest,
96
113
  UpdateEntityRequest,
@@ -277,10 +294,17 @@ export interface CreateReportOptions {
277
294
  periods?: PeriodSpecInput[]
278
295
  }
279
296
 
280
- export interface ReportOperationAck {
297
+ /**
298
+ * Wrapper returned by report write methods — pairs the audit-side
299
+ * envelope fields (`operationId`, `status`) with the typed result
300
+ * payload. Generic on ``T`` so each method advertises its specific
301
+ * result type (e.g. ``ReportResponse`` for creates, ``DeleteResult``
302
+ * for deletes).
303
+ */
304
+ export interface ReportOperationAck<T = unknown> {
281
305
  operationId: string
282
306
  status: OperationEnvelope['status']
283
- result: Record<string, unknown> | null
307
+ result: T | null
284
308
  }
285
309
 
286
310
  // ── Write result shapes (envelope.result payloads) ─────────────────────
@@ -756,12 +780,12 @@ export class LedgerClient {
756
780
  async linkEntityTaxonomy(
757
781
  graphId: string,
758
782
  body: LinkEntityTaxonomyRequest
759
- ): Promise<Record<string, unknown>> {
783
+ ): Promise<EntityTaxonomyResponse> {
760
784
  const envelope = await this.callOperation(
761
785
  'Link entity taxonomy',
762
786
  opLinkEntityTaxonomy({ path: { graph_id: graphId }, body })
763
787
  )
764
- return (envelope.result ?? {}) as Record<string, unknown>
788
+ return this.requireResult('Link entity taxonomy', envelope.result)
765
789
  }
766
790
 
767
791
  /**
@@ -772,37 +796,37 @@ export class LedgerClient {
772
796
  graphId: string,
773
797
  body: CreateTaxonomyBlockRequest,
774
798
  idempotencyKey?: string
775
- ): Promise<Record<string, unknown>> {
799
+ ): Promise<TaxonomyBlockEnvelope> {
776
800
  const headers = idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : undefined
777
801
  const envelope = await this.callOperation(
778
802
  'Create taxonomy block',
779
803
  opCreateTaxonomyBlock({ path: { graph_id: graphId }, body, headers })
780
804
  )
781
- return (envelope.result ?? {}) as Record<string, unknown>
805
+ return this.requireResult('Create taxonomy block', envelope.result)
782
806
  }
783
807
 
784
808
  /** Update a taxonomy block — add/update/remove elements, structures, associations, or rules. */
785
809
  async updateTaxonomyBlock(
786
810
  graphId: string,
787
811
  body: UpdateTaxonomyBlockRequest
788
- ): Promise<Record<string, unknown>> {
812
+ ): Promise<TaxonomyBlockEnvelope> {
789
813
  const envelope = await this.callOperation(
790
814
  'Update taxonomy block',
791
815
  opUpdateTaxonomyBlock({ path: { graph_id: graphId }, body })
792
816
  )
793
- return (envelope.result ?? {}) as Record<string, unknown>
817
+ return this.requireResult('Update taxonomy block', envelope.result)
794
818
  }
795
819
 
796
820
  /** Delete a taxonomy block. Cascades through elements, structures, and associations. */
797
821
  async deleteTaxonomyBlock(
798
822
  graphId: string,
799
823
  body: DeleteTaxonomyBlockRequest
800
- ): Promise<{ deleted: boolean }> {
824
+ ): Promise<DeleteTaxonomyBlockResponse> {
801
825
  const envelope = await this.callOperation(
802
826
  'Delete taxonomy block',
803
827
  opDeleteTaxonomyBlock({ path: { graph_id: graphId }, body })
804
828
  )
805
- return (envelope.result ?? { deleted: true }) as { deleted: boolean }
829
+ return (envelope.result ?? { deleted: true }) as DeleteTaxonomyBlockResponse
806
830
  }
807
831
 
808
832
  /** List elements (CoA accounts, GAAP concepts, etc.) with filters. */
@@ -910,24 +934,24 @@ export class LedgerClient {
910
934
  async createMappingAssociation(
911
935
  graphId: string,
912
936
  body: CreateMappingAssociationOperation
913
- ): Promise<Record<string, unknown>> {
937
+ ): Promise<AssociationResponse> {
914
938
  const envelope = await this.callOperation(
915
939
  'Create mapping association',
916
940
  opCreateMappingAssociation({ path: { graph_id: graphId }, body })
917
941
  )
918
- return (envelope.result ?? {}) as Record<string, unknown>
942
+ return this.requireResult('Create mapping association', envelope.result)
919
943
  }
920
944
 
921
945
  /** Delete a mapping association. */
922
946
  async deleteMappingAssociation(
923
947
  graphId: string,
924
948
  body: DeleteMappingAssociationOperation
925
- ): Promise<{ deleted: boolean }> {
949
+ ): Promise<DeleteResult> {
926
950
  const envelope = await this.callOperation(
927
951
  'Delete mapping association',
928
952
  opDeleteMappingAssociation({ path: { graph_id: graphId }, body })
929
953
  )
930
- return (envelope.result ?? { deleted: true }) as { deleted: boolean }
954
+ return (envelope.result ?? { deleted: true }) as DeleteResult
931
955
  }
932
956
 
933
957
  /**
@@ -1042,7 +1066,7 @@ export class LedgerClient {
1042
1066
  graphId: string,
1043
1067
  structureId: string,
1044
1068
  options: { name?: string }
1045
- ): Promise<Record<string, unknown>> {
1069
+ ): Promise<InformationBlockEnvelope> {
1046
1070
  const body: UpdateInformationBlockRequest = {
1047
1071
  block_type: 'schedule',
1048
1072
  payload: { structure_id: structureId, ...options },
@@ -1051,11 +1075,14 @@ export class LedgerClient {
1051
1075
  'Update schedule',
1052
1076
  opUpdateInformationBlock({ path: { graph_id: graphId }, body })
1053
1077
  )
1054
- return (envelope.result ?? {}) as Record<string, unknown>
1078
+ return this.requireResult('Update schedule', envelope.result)
1055
1079
  }
1056
1080
 
1057
1081
  /** Permanently delete a schedule (cascades through facts + associations). */
1058
- async deleteSchedule(graphId: string, structureId: string): Promise<{ deleted: boolean }> {
1082
+ async deleteSchedule(
1083
+ graphId: string,
1084
+ structureId: string
1085
+ ): Promise<DeleteInformationBlockResponse> {
1059
1086
  const body: DeleteInformationBlockRequest = {
1060
1087
  block_type: 'schedule',
1061
1088
  payload: { structure_id: structureId },
@@ -1064,7 +1091,7 @@ export class LedgerClient {
1064
1091
  'Delete schedule',
1065
1092
  opDeleteInformationBlock({ path: { graph_id: graphId }, body })
1066
1093
  )
1067
- return (envelope.result ?? { deleted: true }) as { deleted: boolean }
1094
+ return (envelope.result ?? { deleted: true }) as DeleteInformationBlockResponse
1068
1095
  }
1069
1096
 
1070
1097
  /**
@@ -1085,7 +1112,7 @@ export class LedgerClient {
1085
1112
  memo?: string | null
1086
1113
  reason?: string
1087
1114
  }
1088
- ): Promise<Record<string, unknown>> {
1115
+ ): Promise<EventBlockEnvelope> {
1089
1116
  const body: CreateEventBlockRequest = {
1090
1117
  event_type: 'asset_disposed',
1091
1118
  event_category: 'adjustment',
@@ -1105,19 +1132,16 @@ export class LedgerClient {
1105
1132
  'Dispose schedule',
1106
1133
  opCreateEventBlock({ path: { graph_id: graphId }, body })
1107
1134
  )
1108
- return (envelope.result ?? {}) as Record<string, unknown>
1135
+ return this.requireResult('Dispose schedule', envelope.result)
1109
1136
  }
1110
1137
 
1111
1138
  /** Evaluate taxonomy rules against facts in a structure. */
1112
- async evaluateRules(
1113
- graphId: string,
1114
- body: EvaluateRulesRequest
1115
- ): Promise<Record<string, unknown>> {
1139
+ async evaluateRules(graphId: string, body: EvaluateRulesRequest): Promise<EvaluateRulesResponse> {
1116
1140
  const envelope = await this.callOperation(
1117
1141
  'Evaluate rules',
1118
1142
  opEvaluateRules({ path: { graph_id: graphId }, body })
1119
1143
  )
1120
- return (envelope.result ?? {}) as Record<string, unknown>
1144
+ return this.requireResult('Evaluate rules', envelope.result)
1121
1145
  }
1122
1146
 
1123
1147
  // ── Period close ────────────────────────────────────────────────────
@@ -1164,7 +1188,7 @@ export class LedgerClient {
1164
1188
  periodStart: string,
1165
1189
  periodEnd: string,
1166
1190
  memo?: string
1167
- ): Promise<Record<string, unknown>> {
1191
+ ): Promise<EventBlockEnvelope> {
1168
1192
  const body: CreateEventBlockRequest = {
1169
1193
  event_type: 'schedule_entry_due',
1170
1194
  event_category: 'recognition',
@@ -1183,7 +1207,7 @@ export class LedgerClient {
1183
1207
  'Create closing entry',
1184
1208
  opCreateEventBlock({ path: { graph_id: graphId }, body })
1185
1209
  )
1186
- return (envelope.result ?? {}) as Record<string, unknown>
1210
+ return this.requireResult('Create closing entry', envelope.result)
1187
1211
  }
1188
1212
 
1189
1213
  // ── Closing book ───────────────────────────────────────────────────
@@ -1313,7 +1337,7 @@ export class LedgerClient {
1313
1337
  async createJournalEntry(
1314
1338
  graphId: string,
1315
1339
  options: CreateJournalEntryOptions
1316
- ): Promise<Record<string, unknown>> {
1340
+ ): Promise<EventBlockEnvelope> {
1317
1341
  const body: CreateEventBlockRequest = {
1318
1342
  event_type: 'journal_entry_recorded',
1319
1343
  event_category: 'adjustment',
@@ -1341,29 +1365,29 @@ export class LedgerClient {
1341
1365
  'Create journal entry',
1342
1366
  opCreateEventBlock({ path: { graph_id: graphId }, body, headers })
1343
1367
  )
1344
- return (envelope.result ?? {}) as Record<string, unknown>
1368
+ return this.requireResult('Create journal entry', envelope.result)
1345
1369
  }
1346
1370
 
1347
1371
  /** Update a draft journal entry. Posted entries are immutable. */
1348
1372
  async updateJournalEntry(
1349
1373
  graphId: string,
1350
1374
  body: UpdateJournalEntryRequest
1351
- ): Promise<Record<string, unknown>> {
1375
+ ): Promise<JournalEntryResponse> {
1352
1376
  const envelope = await this.callOperation(
1353
1377
  'Update journal entry',
1354
1378
  opUpdateJournalEntry({ path: { graph_id: graphId }, body })
1355
1379
  )
1356
- return (envelope.result ?? {}) as Record<string, unknown>
1380
+ return this.requireResult('Update journal entry', envelope.result)
1357
1381
  }
1358
1382
 
1359
1383
  /** Hard-delete a draft journal entry. Posted entries must be reversed. */
1360
- async deleteJournalEntry(graphId: string, entryId: string): Promise<{ deleted: boolean }> {
1384
+ async deleteJournalEntry(graphId: string, entryId: string): Promise<DeleteResult> {
1361
1385
  const body: DeleteJournalEntryRequest = { entry_id: entryId }
1362
1386
  const envelope = await this.callOperation(
1363
1387
  'Delete journal entry',
1364
1388
  opDeleteJournalEntry({ path: { graph_id: graphId }, body })
1365
1389
  )
1366
- return (envelope.result ?? { deleted: true }) as { deleted: boolean }
1390
+ return (envelope.result ?? { deleted: true }) as DeleteResult
1367
1391
  }
1368
1392
 
1369
1393
  /**
@@ -1381,7 +1405,7 @@ export class LedgerClient {
1381
1405
  memo?: string | null
1382
1406
  reason?: string | null
1383
1407
  }
1384
- ): Promise<Record<string, unknown>> {
1408
+ ): Promise<EventBlockEnvelope> {
1385
1409
  const occurredDate = options?.postingDate ?? new Date().toISOString().slice(0, 10)
1386
1410
  const body: CreateEventBlockRequest = {
1387
1411
  event_type: 'journal_entry_reversed',
@@ -1400,7 +1424,7 @@ export class LedgerClient {
1400
1424
  'Reverse journal entry',
1401
1425
  opCreateEventBlock({ path: { graph_id: graphId }, body })
1402
1426
  )
1403
- return (envelope.result ?? {}) as Record<string, unknown>
1427
+ return this.requireResult('Reverse journal entry', envelope.result)
1404
1428
  }
1405
1429
 
1406
1430
  // ── Event blocks (generic preview + status transitions) ──────────────
@@ -1416,12 +1440,12 @@ export class LedgerClient {
1416
1440
  async previewEventBlock(
1417
1441
  graphId: string,
1418
1442
  body: CreateEventBlockRequest
1419
- ): Promise<Record<string, unknown>> {
1443
+ ): Promise<PreviewEventBlockResponse> {
1420
1444
  const envelope = await this.callOperation(
1421
1445
  'Preview event block',
1422
1446
  opPreviewEventBlock({ path: { graph_id: graphId }, body })
1423
1447
  )
1424
- return (envelope.result ?? {}) as Record<string, unknown>
1448
+ return this.requireResult('Preview event block', envelope.result)
1425
1449
  }
1426
1450
 
1427
1451
  /**
@@ -1433,12 +1457,12 @@ export class LedgerClient {
1433
1457
  async updateEventBlock(
1434
1458
  graphId: string,
1435
1459
  body: UpdateEventBlockRequest
1436
- ): Promise<Record<string, unknown>> {
1460
+ ): Promise<EventBlockEnvelope> {
1437
1461
  const envelope = await this.callOperation(
1438
1462
  'Update event block',
1439
1463
  opUpdateEventBlock({ path: { graph_id: graphId }, body })
1440
1464
  )
1441
- return (envelope.result ?? {}) as Record<string, unknown>
1465
+ return this.requireResult('Update event block', envelope.result)
1442
1466
  }
1443
1467
 
1444
1468
  // ── Agents (REA counterparties) ───────────────────────────────────────
@@ -1453,25 +1477,25 @@ export class LedgerClient {
1453
1477
  graphId: string,
1454
1478
  body: CreateAgentRequest,
1455
1479
  idempotencyKey?: string
1456
- ): Promise<Record<string, unknown>> {
1480
+ ): Promise<LedgerAgentResponse> {
1457
1481
  const headers = idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : undefined
1458
1482
  const envelope = await this.callOperation(
1459
1483
  'Create agent',
1460
1484
  opCreateAgent({ path: { graph_id: graphId }, body, headers })
1461
1485
  )
1462
- return (envelope.result ?? {}) as Record<string, unknown>
1486
+ return this.requireResult('Create agent', envelope.result)
1463
1487
  }
1464
1488
 
1465
1489
  /**
1466
1490
  * Update an agent. `metadata_patch` is a partial merge into the existing
1467
1491
  * metadata object; all other fields replace.
1468
1492
  */
1469
- async updateAgent(graphId: string, body: UpdateAgentRequest): Promise<Record<string, unknown>> {
1493
+ async updateAgent(graphId: string, body: UpdateAgentRequest): Promise<LedgerAgentResponse> {
1470
1494
  const envelope = await this.callOperation(
1471
1495
  'Update agent',
1472
1496
  opUpdateAgent({ path: { graph_id: graphId }, body })
1473
1497
  )
1474
- return (envelope.result ?? {}) as Record<string, unknown>
1498
+ return this.requireResult('Update agent', envelope.result)
1475
1499
  }
1476
1500
 
1477
1501
  // ── Event handlers (DSL handler registry) ────────────────────────────
@@ -1485,12 +1509,12 @@ export class LedgerClient {
1485
1509
  async createEventHandler(
1486
1510
  graphId: string,
1487
1511
  body: CreateEventHandlerRequest
1488
- ): Promise<Record<string, unknown>> {
1512
+ ): Promise<EventHandlerResponse> {
1489
1513
  const envelope = await this.callOperation(
1490
1514
  'Create event handler',
1491
1515
  opCreateEventHandler({ path: { graph_id: graphId }, body })
1492
1516
  )
1493
- return (envelope.result ?? {}) as Record<string, unknown>
1517
+ return this.requireResult('Create event handler', envelope.result)
1494
1518
  }
1495
1519
 
1496
1520
  /**
@@ -1500,12 +1524,12 @@ export class LedgerClient {
1500
1524
  async updateEventHandler(
1501
1525
  graphId: string,
1502
1526
  body: UpdateEventHandlerRequest
1503
- ): Promise<Record<string, unknown>> {
1527
+ ): Promise<EventHandlerResponse> {
1504
1528
  const envelope = await this.callOperation(
1505
1529
  'Update event handler',
1506
1530
  opUpdateEventHandler({ path: { graph_id: graphId }, body })
1507
1531
  )
1508
- return (envelope.result ?? {}) as Record<string, unknown>
1532
+ return this.requireResult('Update event handler', envelope.result)
1509
1533
  }
1510
1534
 
1511
1535
  // ── Financial statements (graph-backed) ──────────────────────────────
@@ -1599,7 +1623,10 @@ export class LedgerClient {
1599
1623
  * Kick off report creation (async). Use the returned `operationId` to
1600
1624
  * subscribe to progress via SSE, then call `getReport()` once finished.
1601
1625
  */
1602
- async createReport(graphId: string, options: CreateReportOptions): Promise<ReportOperationAck> {
1626
+ async createReport(
1627
+ graphId: string,
1628
+ options: CreateReportOptions
1629
+ ): Promise<ReportOperationAck<ReportResponse>> {
1603
1630
  const body: CreateReportRequest = {
1604
1631
  name: options.name,
1605
1632
  mapping_id: options.mappingId,
@@ -1619,7 +1646,7 @@ export class LedgerClient {
1619
1646
  return {
1620
1647
  operationId: envelope.operationId,
1621
1648
  status: envelope.status,
1622
- result: (envelope.result as Record<string, unknown> | null) ?? null,
1649
+ result: envelope.result ?? null,
1623
1650
  }
1624
1651
  }
1625
1652
 
@@ -1690,7 +1717,7 @@ export class LedgerClient {
1690
1717
  reportId: string,
1691
1718
  periodStart?: string,
1692
1719
  periodEnd?: string
1693
- ): Promise<ReportOperationAck> {
1720
+ ): Promise<ReportOperationAck<ReportResponse>> {
1694
1721
  const envelope = await this.callOperation(
1695
1722
  'Regenerate report',
1696
1723
  opRegenerateReport({
@@ -1705,30 +1732,31 @@ export class LedgerClient {
1705
1732
  return {
1706
1733
  operationId: envelope.operationId,
1707
1734
  status: envelope.status,
1708
- result: (envelope.result as Record<string, unknown> | null) ?? null,
1735
+ result: envelope.result ?? null,
1709
1736
  }
1710
1737
  }
1711
1738
 
1712
1739
  /** Delete a report and its generated facts. */
1713
- async deleteReport(graphId: string, reportId: string): Promise<void> {
1714
- await this.callOperation(
1740
+ async deleteReport(graphId: string, reportId: string): Promise<DeleteResult> {
1741
+ const envelope = await this.callOperation(
1715
1742
  'Delete report',
1716
1743
  opDeleteReport({
1717
1744
  path: { graph_id: graphId },
1718
1745
  body: { report_id: reportId },
1719
1746
  })
1720
1747
  )
1748
+ return (envelope.result ?? { deleted: true }) as DeleteResult
1721
1749
  }
1722
1750
 
1723
1751
  /**
1724
- * Share a published report to every member of a publish list (async).
1725
- * Each target graph receives a snapshot copy of the report's facts.
1752
+ * Share a published report to every member of a publish list. Each
1753
+ * target graph receives a snapshot copy of the report's facts.
1726
1754
  */
1727
1755
  async shareReport(
1728
1756
  graphId: string,
1729
1757
  reportId: string,
1730
1758
  publishListId: string
1731
- ): Promise<ReportOperationAck> {
1759
+ ): Promise<ReportOperationAck<ShareReportResponse>> {
1732
1760
  const envelope = await this.callOperation(
1733
1761
  'Share report',
1734
1762
  opShareReport({
@@ -1742,7 +1770,7 @@ export class LedgerClient {
1742
1770
  return {
1743
1771
  operationId: envelope.operationId,
1744
1772
  status: envelope.status,
1745
- result: (envelope.result as Record<string, unknown> | null) ?? null,
1773
+ result: envelope.result ?? null,
1746
1774
  }
1747
1775
  }
1748
1776
 
@@ -1751,7 +1779,7 @@ export class LedgerClient {
1751
1779
  * Allowed from 'draft' or 'under_review'. Stamps filed_at + filed_by
1752
1780
  * from the auth context + server clock.
1753
1781
  */
1754
- async fileReport(graphId: string, reportId: string): Promise<ReportOperationAck> {
1782
+ async fileReport(graphId: string, reportId: string): Promise<ReportOperationAck<ReportResponse>> {
1755
1783
  const body: FileReportRequest = { report_id: reportId }
1756
1784
  const envelope = await this.callOperation(
1757
1785
  'File report',
@@ -1760,7 +1788,7 @@ export class LedgerClient {
1760
1788
  return {
1761
1789
  operationId: envelope.operationId,
1762
1790
  status: envelope.status,
1763
- result: (envelope.result as Record<string, unknown> | null) ?? null,
1791
+ result: envelope.result ?? null,
1764
1792
  }
1765
1793
  }
1766
1794
 
@@ -1773,7 +1801,7 @@ export class LedgerClient {
1773
1801
  graphId: string,
1774
1802
  reportId: string,
1775
1803
  targetStatus: string
1776
- ): Promise<ReportOperationAck> {
1804
+ ): Promise<ReportOperationAck<ReportResponse>> {
1777
1805
  const body: TransitionFilingStatusRequest = {
1778
1806
  report_id: reportId,
1779
1807
  target_status: targetStatus,
@@ -1785,7 +1813,7 @@ export class LedgerClient {
1785
1813
  return {
1786
1814
  operationId: envelope.operationId,
1787
1815
  status: envelope.status,
1788
- result: (envelope.result as Record<string, unknown> | null) ?? null,
1816
+ result: envelope.result ?? null,
1789
1817
  }
1790
1818
  }
1791
1819
 
@@ -1819,7 +1847,7 @@ export class LedgerClient {
1819
1847
  graphId: string,
1820
1848
  name: string,
1821
1849
  description?: string
1822
- ): Promise<Record<string, unknown>> {
1850
+ ): Promise<PublishListResponse> {
1823
1851
  const body: CreatePublishListRequest = {
1824
1852
  name,
1825
1853
  description: description ?? null,
@@ -1828,7 +1856,7 @@ export class LedgerClient {
1828
1856
  'Create publish list',
1829
1857
  opCreatePublishList({ path: { graph_id: graphId }, body })
1830
1858
  )
1831
- return (envelope.result ?? {}) as Record<string, unknown>
1859
+ return this.requireResult('Create publish list', envelope.result)
1832
1860
  }
1833
1861
 
1834
1862
  /** Get a single publish list with its full member list. */
@@ -1847,7 +1875,7 @@ export class LedgerClient {
1847
1875
  graphId: string,
1848
1876
  listId: string,
1849
1877
  updates: { name?: string; description?: string | null }
1850
- ): Promise<Record<string, unknown>> {
1878
+ ): Promise<PublishListResponse> {
1851
1879
  const envelope = await this.callOperation(
1852
1880
  'Update publish list',
1853
1881
  opUpdatePublishList({
@@ -1859,18 +1887,19 @@ export class LedgerClient {
1859
1887
  } as UpdatePublishListOperation,
1860
1888
  })
1861
1889
  )
1862
- return (envelope.result ?? {}) as Record<string, unknown>
1890
+ return this.requireResult('Update publish list', envelope.result)
1863
1891
  }
1864
1892
 
1865
1893
  /** Delete a publish list. */
1866
- async deletePublishList(graphId: string, listId: string): Promise<void> {
1867
- await this.callOperation(
1894
+ async deletePublishList(graphId: string, listId: string): Promise<DeleteResult> {
1895
+ const envelope = await this.callOperation(
1868
1896
  'Delete publish list',
1869
1897
  opDeletePublishList({
1870
1898
  path: { graph_id: graphId },
1871
1899
  body: { list_id: listId },
1872
1900
  })
1873
1901
  )
1902
+ return (envelope.result ?? { deleted: true }) as DeleteResult
1874
1903
  }
1875
1904
 
1876
1905
  /** Add target graphs as members of a publish list. */
@@ -1878,7 +1907,7 @@ export class LedgerClient {
1878
1907
  graphId: string,
1879
1908
  listId: string,
1880
1909
  targetGraphIds: string[]
1881
- ): Promise<Record<string, unknown>> {
1910
+ ): Promise<PublishListMemberResponse[]> {
1882
1911
  const envelope = await this.callOperation(
1883
1912
  'Add publish list members',
1884
1913
  opAddPublishListMembers({
@@ -1889,7 +1918,7 @@ export class LedgerClient {
1889
1918
  } as AddPublishListMembersOperation,
1890
1919
  })
1891
1920
  )
1892
- return (envelope.result ?? {}) as Record<string, unknown>
1921
+ return this.requireResult('Add publish list members', envelope.result)
1893
1922
  }
1894
1923
 
1895
1924
  /** Remove a single member from a publish list. */
@@ -1897,7 +1926,7 @@ export class LedgerClient {
1897
1926
  graphId: string,
1898
1927
  listId: string,
1899
1928
  memberId: string
1900
- ): Promise<{ deleted: boolean }> {
1929
+ ): Promise<DeleteResult> {
1901
1930
  const envelope = await this.callOperation(
1902
1931
  'Remove publish list member',
1903
1932
  opRemovePublishListMember({
@@ -1905,19 +1934,25 @@ export class LedgerClient {
1905
1934
  body: { list_id: listId, member_id: memberId },
1906
1935
  })
1907
1936
  )
1908
- return (envelope.result ?? { deleted: true }) as { deleted: boolean }
1937
+ return (envelope.result ?? { deleted: true }) as DeleteResult
1909
1938
  }
1910
1939
 
1911
1940
  // ── Internal helpers ────────────────────────────────────────────────
1912
1941
 
1913
1942
  /**
1914
1943
  * Await an SDK-generated `opXxx(...)` call, throw a readable error on
1915
- * non-2xx, and return the `OperationEnvelope` on success.
1944
+ * non-2xx, and return the parsed envelope on success.
1945
+ *
1946
+ * Generic over the SDK call's response shape so typed ops (e.g.
1947
+ * `opCreateEventBlock`, which returns
1948
+ * `OperationEnvelopeEventBlockEnvelope`) flow through with a typed
1949
+ * `envelope.result` instead of being widened to `unknown`. Untyped
1950
+ * ops continue to land as `OperationEnvelope` automatically.
1916
1951
  */
1917
- private async callOperation(
1952
+ private async callOperation<T>(
1918
1953
  label: string,
1919
- call: Promise<{ data?: OperationEnvelope; error?: unknown }>
1920
- ): Promise<OperationEnvelope> {
1954
+ call: Promise<{ data?: T; error?: unknown }>
1955
+ ): Promise<T> {
1921
1956
  const response = await call
1922
1957
  if (response.error !== undefined) {
1923
1958
  throw new Error(`${label} failed: ${JSON.stringify(response.error)}`)
@@ -1927,6 +1962,18 @@ export class LedgerClient {
1927
1962
  }
1928
1963
  return response.data
1929
1964
  }
1965
+
1966
+ /**
1967
+ * Unwrap the typed result from an OperationEnvelope. Throws when the
1968
+ * server returned an envelope with no `result` field — generally a
1969
+ * sign that a synchronous operation failed silently.
1970
+ */
1971
+ private requireResult<T>(label: string, result: T | null | undefined): T {
1972
+ if (result === null || result === undefined) {
1973
+ throw new Error(`${label}: operation envelope had no result`)
1974
+ }
1975
+ return result
1976
+ }
1930
1977
  }
1931
1978
 
1932
1979
  // ── Module-private conversion helpers ─────────────────────────────────