Skip to content

Commit 2d10f2a

Browse files
authored
refactor(document-api): unify table locator naming on nodeId (#2456)
* refactor(document-api): unify table locator naming on nodeId * chore: fix types * fix(document-api): make row operation locators unambiguous * chore: test fixes
1 parent 1d6d4bb commit 2d10f2a

119 files changed

Lines changed: 2206 additions & 1359 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/cli/src/__tests__/conformance/scenarios.ts

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -590,31 +590,6 @@ function cellMutationScenario(
590590
};
591591
}
592592

593-
/** Table-scoped mutation in a session: uses --table-node-id instead of --node-id. */
594-
function tableScopedMutationScenario(
595-
op: string,
596-
extraArgs: string[],
597-
): (harness: ConformanceHarness) => Promise<ScenarioInvocation> {
598-
return async (harness) => {
599-
const label = `table-${op.replace(/\./g, '-')}`;
600-
const stateDir = await harness.createStateDir(`${label}-success`);
601-
const { tableNodeId, sessionId } = await harness.createTableFixture(stateDir, label);
602-
return {
603-
stateDir,
604-
args: [
605-
...commandTokens(`doc.${op}` as CliOperationId),
606-
'--session',
607-
sessionId,
608-
'--table-node-id',
609-
tableNodeId,
610-
...extraArgs,
611-
'--out',
612-
harness.createOutputPath(`${label}-out`),
613-
],
614-
};
615-
};
616-
}
617-
618593
function tocMutationScenario(
619594
op: string,
620595
extraArgs: string[],
@@ -2983,9 +2958,9 @@ export const SUCCESS_SCENARIOS = {
29832958
'doc.tables.split': tableMutationScenario('tables.split', ['--at-row-index', '1']),
29842959
'doc.tables.convertToText': tableMutationScenario('tables.convertToText', ['--delimiter', 'tab']),
29852960
'doc.tables.setLayout': tableMutationScenario('tables.setLayout', ['--alignment', 'center']),
2986-
'doc.tables.insertRow': tableScopedMutationScenario('tables.insertRow', ['--row-index', '0', '--position', 'below']),
2987-
'doc.tables.deleteRow': tableScopedMutationScenario('tables.deleteRow', ['--row-index', '0']),
2988-
'doc.tables.setRowHeight': tableScopedMutationScenario('tables.setRowHeight', [
2961+
'doc.tables.insertRow': tableMutationScenario('tables.insertRow', ['--row-index', '0', '--position', 'below']),
2962+
'doc.tables.deleteRow': tableMutationScenario('tables.deleteRow', ['--row-index', '0']),
2963+
'doc.tables.setRowHeight': tableMutationScenario('tables.setRowHeight', [
29892964
'--row-index',
29902965
'0',
29912966
'--height-pt',
@@ -2994,19 +2969,19 @@ export const SUCCESS_SCENARIOS = {
29942969
'atLeast',
29952970
]),
29962971
'doc.tables.distributeRows': tableMutationScenario('tables.distributeRows', []),
2997-
'doc.tables.setRowOptions': tableScopedMutationScenario('tables.setRowOptions', [
2972+
'doc.tables.setRowOptions': tableMutationScenario('tables.setRowOptions', [
29982973
'--row-index',
29992974
'0',
30002975
'--allow-break-across-pages',
30012976
]),
3002-
'doc.tables.insertColumn': tableScopedMutationScenario('tables.insertColumn', [
2977+
'doc.tables.insertColumn': tableMutationScenario('tables.insertColumn', [
30032978
'--column-index',
30042979
'0',
30052980
'--position',
30062981
'right',
30072982
]),
3008-
'doc.tables.deleteColumn': tableScopedMutationScenario('tables.deleteColumn', ['--column-index', '0']),
3009-
'doc.tables.setColumnWidth': tableScopedMutationScenario('tables.setColumnWidth', [
2983+
'doc.tables.deleteColumn': tableMutationScenario('tables.deleteColumn', ['--column-index', '0']),
2984+
'doc.tables.setColumnWidth': tableMutationScenario('tables.setColumnWidth', [
30102985
'--column-index',
30112986
'0',
30122987
'--width-pt',
@@ -3015,7 +2990,7 @@ export const SUCCESS_SCENARIOS = {
30152990
'doc.tables.distributeColumns': tableMutationScenario('tables.distributeColumns', []),
30162991
'doc.tables.insertCell': cellMutationScenario('tables.insertCell', ['--mode', 'shiftRight']),
30172992
'doc.tables.deleteCell': cellMutationScenario('tables.deleteCell', ['--mode', 'shiftLeft']),
3018-
'doc.tables.mergeCells': tableScopedMutationScenario('tables.mergeCells', [
2993+
'doc.tables.mergeCells': tableMutationScenario('tables.mergeCells', [
30192994
'--start-json',
30202995
JSON.stringify({ rowIndex: 0, columnIndex: 0 }),
30212996
'--end-json',

apps/docs/document-api/reference/_generated-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,5 +976,5 @@
976976
}
977977
],
978978
"marker": "{/* GENERATED FILE: DO NOT EDIT. Regenerate via `pnpm run docapi:sync`. */}",
979-
"sourceHash": "455ce1c9b3cf75b22ae1ebc76bddb66f31f70f0ab46cea0f178063c87e476dbd"
979+
"sourceHash": "3bca09dc183fa828d25a2349a4f780e5ef7bfcad2e9ddf21e552a88c97b9fa97"
980980
}

apps/docs/document-api/reference/content-controls/get-binding.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Returns the ContentControlBinding or null if no binding is set.
4747

4848
## Output fields
4949

50-
### Variant 1
50+
### Variant 1 (storeItemId, xpath)
5151

5252
| Field | Type | Required | Description |
5353
| --- | --- | --- | --- |

apps/docs/document-api/reference/create/table.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ Returns a CreateTableResult with the new table block ID and address.
5151
| Field | Type | Required | Description |
5252
| --- | --- | --- | --- |
5353
| `success` | `true` | yes | Constant: `true` |
54-
| `table` | BlockNodeAddress | yes | BlockNodeAddress |
54+
| `table` | TableAddress | yes | TableAddress |
5555
| `table.kind` | `"block"` | yes | Constant: `"block"` |
5656
| `table.nodeId` | string | yes | |
57-
| `table.nodeType` | enum | yes | `"paragraph"`, `"heading"`, `"listItem"`, `"table"`, `"tableRow"`, `"tableCell"`, `"tableOfContents"`, `"image"`, `"sdt"` |
57+
| `table.nodeType` | `"table"` | yes | Constant: `"table"` |
5858
| `trackedChangeRefs` | EntityAddress[] | no | |
5959

6060
### Variant 2 (success=false)
@@ -231,7 +231,7 @@ On success, `result.table` is the created table address. Reuse `result.table.nod
231231
"const": true
232232
},
233233
"table": {
234-
"$ref": "#/$defs/BlockNodeAddress"
234+
"$ref": "#/$defs/TableAddress"
235235
},
236236
"trackedChangeRefs": {
237237
"items": {
@@ -295,7 +295,7 @@ On success, `result.table` is the created table address. Reuse `result.table.nod
295295
"const": true
296296
},
297297
"table": {
298-
"$ref": "#/$defs/BlockNodeAddress"
298+
"$ref": "#/$defs/TableAddress"
299299
},
300300
"trackedChangeRefs": {
301301
"items": {

apps/docs/document-api/reference/delete.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Returns a TextMutationReceipt with applied status; receipt reports NO_OP if the
3636
| `target.kind` | `"selection"` | yes | Constant: `"selection"` |
3737
| `target.start` | SelectionPoint | yes | SelectionPoint |
3838

39-
### Variant 2
39+
### Variant 2 (ref)
4040

4141
| Field | Type | Required | Description |
4242
| --- | --- | --- | --- |

apps/docs/document-api/reference/format/apply.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Returns a TextMutationReceipt confirming inline styles were applied to the targe
7979
| `target.kind` | `"selection"` | yes | Constant: `"selection"` |
8080
| `target.start` | SelectionPoint | yes | SelectionPoint |
8181

82-
### Variant 2
82+
### Variant 2 (ref, inline)
8383

8484
| Field | Type | Required | Description |
8585
| --- | --- | --- | --- |

apps/docs/document-api/reference/format/b-cs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Returns a TextMutationReceipt confirming the inline run property patch was appli
3636
| `target.start` | SelectionPoint | yes | SelectionPoint |
3737
| `value` | boolean \\| null | no | One of: boolean, null |
3838

39-
### Variant 2
39+
### Variant 2 (ref)
4040

4141
| Field | Type | Required | Description |
4242
| --- | --- | --- | --- |

apps/docs/document-api/reference/format/bold.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Returns a TextMutationReceipt confirming the inline run property patch was appli
3636
| `target.start` | SelectionPoint | yes | SelectionPoint |
3737
| `value` | boolean \\| null | no | One of: boolean, null |
3838

39-
### Variant 2
39+
### Variant 2 (ref)
4040

4141
| Field | Type | Required | Description |
4242
| --- | --- | --- | --- |

apps/docs/document-api/reference/format/border.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Returns a TextMutationReceipt confirming the inline run property patch was appli
3636
| `target.start` | SelectionPoint | yes | SelectionPoint |
3737
| `value` | object \\| null | yes | One of: object, null |
3838

39-
### Variant 2
39+
### Variant 2 (ref, value)
4040

4141
| Field | Type | Required | Description |
4242
| --- | --- | --- | --- |

apps/docs/document-api/reference/format/caps.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Returns a TextMutationReceipt confirming the inline run property patch was appli
3636
| `target.start` | SelectionPoint | yes | SelectionPoint |
3737
| `value` | boolean \\| null | no | One of: boolean, null |
3838

39-
### Variant 2
39+
### Variant 2 (ref)
4040

4141
| Field | Type | Required | Description |
4242
| --- | --- | --- | --- |

0 commit comments

Comments
 (0)