From 77ccdade8ceb4d5b081f6f9917e23d7b836bf220 Mon Sep 17 00:00:00 2001 From: codegen-bot Date: Fri, 14 Mar 2025 14:16:32 +0000 Subject: [PATCH 1/2] CG-12125: Fix TSCodeBlock missing end_byte_for_condition_block attribute --- fix-tscodeblock-attribute.patch | 17 +++++++++++++++++ .../typescript/detached_symbols/code_block.py | 6 ++++++ 2 files changed, 23 insertions(+) create mode 100644 fix-tscodeblock-attribute.patch diff --git a/fix-tscodeblock-attribute.patch b/fix-tscodeblock-attribute.patch new file mode 100644 index 000000000..c941ad94e --- /dev/null +++ b/fix-tscodeblock-attribute.patch @@ -0,0 +1,17 @@ +diff --git a/src/codegen/sdk/typescript/detached_symbols/code_block.py b/src/codegen/sdk/typescript/detached_symbols/code_block.py +index 0000000..0000000 100644 +--- a/src/codegen/sdk/typescript/detached_symbols/code_block.py ++++ b/src/codegen/sdk/typescript/detached_symbols/code_block.py +@@ -77,4 +77,10 @@ class TSCodeBlock(CodeBlock[Parent, "TSAssignment"], Generic[Parent]): + self.remove_byte_range(self.ts_node.end_byte - 1, next_sibling.start_byte) + else: + # If there is no next sibling, remove up to the closing brace of the last line +- self.remove_byte_range(self._get_line_ends()[-1].end_byte, self.ts_node.end_byte) +\ No newline at end of file ++ self.remove_byte_range(self._get_line_ends()[-1].end_byte, self.ts_node.end_byte) ++ ++ @property ++ @noapidoc ++ def end_byte_for_condition_block(self) -> int: ++ """Returns the end byte for the specific condition block""" ++ return self.end_byte \ No newline at end of file diff --git a/src/codegen/sdk/typescript/detached_symbols/code_block.py b/src/codegen/sdk/typescript/detached_symbols/code_block.py index c6871100e..946134f11 100644 --- a/src/codegen/sdk/typescript/detached_symbols/code_block.py +++ b/src/codegen/sdk/typescript/detached_symbols/code_block.py @@ -78,3 +78,9 @@ def unwrap(self) -> None: else: # If there is no next sibling, remove up to the closing brace of the last line self.remove_byte_range(self._get_line_ends()[-1].end_byte, self.ts_node.end_byte) + + @property + @noapidoc + def end_byte_for_condition_block(self) -> int: + """Returns the end byte for the specific condition block""" + return self.end_byte \ No newline at end of file From 1ecd2e079fcd648ba8577acd7a314dab88c3db44 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 14:17:29 +0000 Subject: [PATCH 2/2] Automated pre-commit update --- fix-tscodeblock-attribute.patch | 2 +- src/codegen/sdk/typescript/detached_symbols/code_block.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fix-tscodeblock-attribute.patch b/fix-tscodeblock-attribute.patch index c941ad94e..dd6a70b24 100644 --- a/fix-tscodeblock-attribute.patch +++ b/fix-tscodeblock-attribute.patch @@ -14,4 +14,4 @@ index 0000000..0000000 100644 + @noapidoc + def end_byte_for_condition_block(self) -> int: + """Returns the end byte for the specific condition block""" -+ return self.end_byte \ No newline at end of file ++ return self.end_byte diff --git a/src/codegen/sdk/typescript/detached_symbols/code_block.py b/src/codegen/sdk/typescript/detached_symbols/code_block.py index 946134f11..06968762f 100644 --- a/src/codegen/sdk/typescript/detached_symbols/code_block.py +++ b/src/codegen/sdk/typescript/detached_symbols/code_block.py @@ -78,9 +78,9 @@ def unwrap(self) -> None: else: # If there is no next sibling, remove up to the closing brace of the last line self.remove_byte_range(self._get_line_ends()[-1].end_byte, self.ts_node.end_byte) - + @property @noapidoc def end_byte_for_condition_block(self) -> int: """Returns the end byte for the specific condition block""" - return self.end_byte \ No newline at end of file + return self.end_byte