Skip to content

Commit 80787cd

Browse files
committed
feat(ledger): event blocks carry the document they rest on
get_event_block and list_event_blocks select documentId, so a caller can see the bill, receipt or statement an event cites. Set it through update_event_block's document_id ("" detaches). schema.graphql refreshed. Claude-Session: https://claude.ai/code/session_01AQkGGPDmpba9eBV9PkLTfv
1 parent c3d867a commit 80787cd

7 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎robosystems_client/graphql/generated/get_ledger_event_block.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class GetLedgerEventBlockEventBlock(BaseModel):
3232
replaces_event_id: Optional[str] = Field(alias="replacesEventId")
3333
obligated_by_event_id: Optional[str] = Field(alias="obligatedByEventId")
3434
discharges_event_id: Optional[str] = Field(alias="dischargesEventId")
35+
document_id: Optional[str] = Field(alias="documentId")
3536
created_at: str = Field(alias="createdAt")
3637
created_by: str = Field(alias="createdBy")
3738

‎robosystems_client/graphql/generated/list_ledger_event_blocks.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class ListLedgerEventBlocksEventBlocks(BaseModel):
3232
replaces_event_id: Optional[str] = Field(alias="replacesEventId")
3333
obligated_by_event_id: Optional[str] = Field(alias="obligatedByEventId")
3434
discharges_event_id: Optional[str] = Field(alias="dischargesEventId")
35+
document_id: Optional[str] = Field(alias="documentId")
3536
created_at: str = Field(alias="createdAt")
3637
created_by: str = Field(alias="createdBy")
3738

‎robosystems_client/graphql/generated/operations.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,7 @@
630630
replacesEventId
631631
obligatedByEventId
632632
dischargesEventId
633+
documentId
633634
createdAt
634635
createdBy
635636
}
@@ -1554,6 +1555,7 @@
15541555
replacesEventId
15551556
obligatedByEventId
15561557
dischargesEventId
1558+
documentId
15571559
createdAt
15581560
createdBy
15591561
}

‎robosystems_client/graphql/operations/ledger/GetLedgerEventBlock.graphql‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ query GetLedgerEventBlock($id: String!) {
33
id eventType eventCategory eventClass status occurredAt effectiveAt
44
source externalId externalUrl amount currency description metadata
55
dimensionIds agentId resourceType resourceElementId
6-
replacedByEventId replacesEventId obligatedByEventId dischargesEventId
6+
replacedByEventId replacesEventId obligatedByEventId dischargesEventId documentId
77
createdAt createdBy
88
}
99
}

‎robosystems_client/graphql/operations/ledger/ListLedgerEventBlocks.graphql‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ query ListLedgerEventBlocks(
2323
id eventType eventCategory eventClass status occurredAt effectiveAt
2424
source externalId externalUrl amount currency description metadata
2525
dimensionIds agentId resourceType resourceElementId
26-
replacedByEventId replacesEventId obligatedByEventId dischargesEventId
26+
replacedByEventId replacesEventId obligatedByEventId dischargesEventId documentId
2727
createdAt createdBy
2828
}
2929
}

‎robosystems_client/graphql/schema.graphql‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,6 +1613,7 @@ type EventBlock {
16131613
replacesEventId: String
16141614
obligatedByEventId: String
16151615
dischargesEventId: String
1616+
documentId: String
16161617
createdAt: DateTime!
16171618
createdBy: String!
16181619
}

‎tests/test_ledger_client.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,7 @@ def test_list_event_blocks(self, mock_execute, mock_config, graph_id):
11811181
"replacesEventId": None,
11821182
"obligatedByEventId": None,
11831183
"dischargesEventId": None,
1184+
"documentId": None,
11841185
"createdAt": "2026-03-15T12:00:00Z",
11851186
"createdBy": "user_1",
11861187
}
@@ -1236,6 +1237,7 @@ def test_get_event_block(self, mock_execute, mock_config, graph_id):
12361237
"replacesEventId": None,
12371238
"obligatedByEventId": None,
12381239
"dischargesEventId": None,
1240+
"documentId": "doc_inv_9",
12391241
"createdAt": "2026-03-15T12:00:00Z",
12401242
"createdBy": "user_1",
12411243
}
@@ -1244,6 +1246,7 @@ def test_get_event_block(self, mock_execute, mock_config, graph_id):
12441246
result = client.get_event_block(graph_id, "evt_1")
12451247
assert result is not None
12461248
assert result.id == "evt_1"
1249+
assert result.document_id == "doc_inv_9"
12471250
variables = mock_execute.call_args[0][2]
12481251
assert variables["id"] == "evt_1"
12491252

0 commit comments

Comments
 (0)