Skip to content

Commit f4a93a2

Browse files
committed
chore: fix ci
1 parent 605ca03 commit f4a93a2

9 files changed

Lines changed: 148 additions & 52 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,5 +940,5 @@
940940
}
941941
],
942942
"marker": "{/* GENERATED FILE: DO NOT EDIT. Regenerate via `pnpm run docapi:sync`. */}",
943-
"sourceHash": "5f53156acd0f12a2a8ebc1bcb331079685a7e5c1a37f2e0fb6e95db7ed87757b"
943+
"sourceHash": "eef969b01d52d99044ea5eb9c17085c5e31768001ced01042c4ebd90e6f00a24"
944944
}

apps/docs/document-api/reference/header-footers/parts/create.mdx

Lines changed: 96 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Create a new independent header/footer part, optionally cloned from an existing
2222

2323
## Expected result
2424

25-
Returns a HeaderFooterPartsMutationResult with the new refId and partPath on success.
25+
Returns a HeaderFooterPartsMutationResult with the new refId/partPath on success, INVALID_TARGET failure when sourceRefId is invalid or mismatched.
2626

2727
## Input fields
2828

@@ -42,12 +42,24 @@ Returns a HeaderFooterPartsMutationResult with the new refId and partPath on suc
4242

4343
## Output fields
4444

45+
### Variant 1 (success=true)
46+
4547
| Field | Type | Required | Description |
4648
| --- | --- | --- | --- |
4749
| `partPath` | string | yes | |
4850
| `refId` | string | yes | |
4951
| `success` | `true` | yes | Constant: `true` |
5052

53+
### Variant 2 (success=false)
54+
55+
| Field | Type | Required | Description |
56+
| --- | --- | --- | --- |
57+
| `failure` | object | yes | |
58+
| `failure.code` | enum | yes | `"INVALID_TARGET"` |
59+
| `failure.details` | any | no | |
60+
| `failure.message` | string | yes | |
61+
| `success` | `false` | yes | Constant: `false` |
62+
5163
### Example response
5264

5365
```json
@@ -67,7 +79,7 @@ Returns a HeaderFooterPartsMutationResult with the new refId and partPath on suc
6779

6880
## Non-applied failure codes
6981

70-
- None
82+
- `INVALID_TARGET`
7183

7284
## Raw schemas
7385

@@ -97,6 +109,67 @@ Returns a HeaderFooterPartsMutationResult with the new refId and partPath on suc
97109

98110
<Accordion title="Raw output schema">
99111
```json
112+
{
113+
"oneOf": [
114+
{
115+
"additionalProperties": false,
116+
"properties": {
117+
"partPath": {
118+
"type": "string"
119+
},
120+
"refId": {
121+
"type": "string"
122+
},
123+
"success": {
124+
"const": true
125+
}
126+
},
127+
"required": [
128+
"success",
129+
"refId",
130+
"partPath"
131+
],
132+
"type": "object"
133+
},
134+
{
135+
"additionalProperties": false,
136+
"properties": {
137+
"failure": {
138+
"additionalProperties": false,
139+
"properties": {
140+
"code": {
141+
"enum": [
142+
"INVALID_TARGET"
143+
]
144+
},
145+
"details": {},
146+
"message": {
147+
"type": "string"
148+
}
149+
},
150+
"required": [
151+
"code",
152+
"message"
153+
],
154+
"type": "object"
155+
},
156+
"success": {
157+
"const": false
158+
}
159+
},
160+
"required": [
161+
"success",
162+
"failure"
163+
],
164+
"type": "object"
165+
}
166+
]
167+
}
168+
```
169+
</Accordion>
170+
171+
<Accordion title="Raw success schema">
172+
```json
100173
{
101174
"additionalProperties": false,
102175
"properties": {
@@ -120,25 +193,37 @@ Returns a HeaderFooterPartsMutationResult with the new refId and partPath on suc
120193
```
121194
</Accordion>
122195

123-
<Accordion title="Raw success schema">
196+
<Accordion title="Raw failure schema">
124197
```json
125198
{
126199
"additionalProperties": false,
127200
"properties": {
128-
"partPath": {
129-
"type": "string"
130-
},
131-
"refId": {
132-
"type": "string"
201+
"failure": {
202+
"additionalProperties": false,
203+
"properties": {
204+
"code": {
205+
"enum": [
206+
"INVALID_TARGET"
207+
]
208+
},
209+
"details": {},
210+
"message": {
211+
"type": "string"
212+
}
213+
},
214+
"required": [
215+
"code",
216+
"message"
217+
],
218+
"type": "object"
133219
},
134220
"success": {
135-
"const": true
221+
"const": false
136222
}
137223
},
138224
"required": [
139225
"success",
140-
"refId",
141-
"partPath"
226+
"failure"
142227
],
143228
"type": "object"
144229
}

apps/docs/document-engine/sdks.mdx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,15 @@ The SDKs expose all operations from the [Document API](/document-api/overview) p
390390
| `doc.hyperlinks.insert` | `hyperlinks insert` | Insert new linked text at a target position. |
391391
| `doc.hyperlinks.patch` | `hyperlinks patch` | Update hyperlink metadata (destination, tooltip, target, rel) without changing display text. |
392392
| `doc.hyperlinks.remove` | `hyperlinks remove` | Remove a hyperlink. Mode 'unwrap' preserves display text; 'deleteText' removes the linked content entirely. |
393+
| `doc.headerFooters.list` | `header-footers list` | List header/footer slot entries across sections. |
394+
| `doc.headerFooters.get` | `header-footers get` | Get a single header/footer slot entry by address. |
395+
| `doc.headerFooters.resolve` | `header-footers resolve` | Resolve the effective header/footer reference for a slot, walking the section inheritance chain. |
396+
| `doc.headerFooters.refs.set` | `header-footers refs set` | Set an explicit header/footer reference on a section slot. |
397+
| `doc.headerFooters.refs.clear` | `header-footers refs clear` | Clear an explicit header/footer reference from a section slot. |
398+
| `doc.headerFooters.refs.setLinkedToPrevious` | `header-footers refs set-linked-to-previous` | Link or unlink a header/footer slot to/from the previous section. |
399+
| `doc.headerFooters.parts.list` | `header-footers parts list` | List unique header/footer part records from document relationships. |
400+
| `doc.headerFooters.parts.create` | `header-footers parts create` | Create a new independent header/footer part, optionally cloned from an existing part. |
401+
| `doc.headerFooters.parts.delete` | `header-footers parts delete` | Delete a header/footer part and its associated relationship when no section slots reference it. |
393402
| `doc.create.contentControl` | `create content-control` | Create a new content control (SDT) in the document. |
394403
| `doc.contentControls.list` | `content-controls list` | List all content controls in the document with optional type/tag filtering. |
395404
| `doc.contentControls.get` | `content-controls get` | Retrieve a single content control by target. |
@@ -509,15 +518,6 @@ The SDKs expose all operations from the [Document API](/document-api/overview) p
509518
| `doc.authorities.entries.insert` | `authorities entries insert` | Insert a new TA authority entry field at a target location. |
510519
| `doc.authorities.entries.update` | `authorities entries update` | Update the properties of an existing TA authority entry. |
511520
| `doc.authorities.entries.remove` | `authorities entries remove` | Remove a TA authority entry field from the document. |
512-
| `doc.headerFooters.list` | `header-footers list` | List header/footer slot entries across sections. |
513-
| `doc.headerFooters.get` | `header-footers get` | Get a single header/footer slot entry by address. |
514-
| `doc.headerFooters.resolve` | `header-footers resolve` | Resolve the effective header/footer reference for a slot, walking the section inheritance chain. |
515-
| `doc.headerFooters.refs.set` | `header-footers refs set` | Set an explicit header/footer reference on a section slot. |
516-
| `doc.headerFooters.refs.clear` | `header-footers refs clear` | Clear an explicit header/footer reference from a section slot. |
517-
| `doc.headerFooters.refs.setLinkedToPrevious` | `header-footers refs set-linked-to-previous` | Link or unlink a header/footer slot to/from the previous section. |
518-
| `doc.headerFooters.parts.list` | `header-footers parts list` | List unique header/footer part records from document relationships. |
519-
| `doc.headerFooters.parts.create` | `header-footers parts create` | Create a new independent header/footer part, optionally cloned from an existing part. |
520-
| `doc.headerFooters.parts.delete` | `header-footers parts delete` | Delete a header/footer part and its associated relationship when no section slots reference it. |
521521
522522
#### Format
523523
@@ -822,6 +822,15 @@ The SDKs expose all operations from the [Document API](/document-api/overview) p
822822
| `doc.hyperlinks.insert` | `hyperlinks insert` | Insert new linked text at a target position. |
823823
| `doc.hyperlinks.patch` | `hyperlinks patch` | Update hyperlink metadata (destination, tooltip, target, rel) without changing display text. |
824824
| `doc.hyperlinks.remove` | `hyperlinks remove` | Remove a hyperlink. Mode 'unwrap' preserves display text; 'deleteText' removes the linked content entirely. |
825+
| `doc.header_footers.list` | `header-footers list` | List header/footer slot entries across sections. |
826+
| `doc.header_footers.get` | `header-footers get` | Get a single header/footer slot entry by address. |
827+
| `doc.header_footers.resolve` | `header-footers resolve` | Resolve the effective header/footer reference for a slot, walking the section inheritance chain. |
828+
| `doc.header_footers.refs.set` | `header-footers refs set` | Set an explicit header/footer reference on a section slot. |
829+
| `doc.header_footers.refs.clear` | `header-footers refs clear` | Clear an explicit header/footer reference from a section slot. |
830+
| `doc.header_footers.refs.set_linked_to_previous` | `header-footers refs set-linked-to-previous` | Link or unlink a header/footer slot to/from the previous section. |
831+
| `doc.header_footers.parts.list` | `header-footers parts list` | List unique header/footer part records from document relationships. |
832+
| `doc.header_footers.parts.create` | `header-footers parts create` | Create a new independent header/footer part, optionally cloned from an existing part. |
833+
| `doc.header_footers.parts.delete` | `header-footers parts delete` | Delete a header/footer part and its associated relationship when no section slots reference it. |
825834
| `doc.create.content_control` | `create content-control` | Create a new content control (SDT) in the document. |
826835
| `doc.content_controls.list` | `content-controls list` | List all content controls in the document with optional type/tag filtering. |
827836
| `doc.content_controls.get` | `content-controls get` | Retrieve a single content control by target. |
@@ -941,15 +950,6 @@ The SDKs expose all operations from the [Document API](/document-api/overview) p
941950
| `doc.authorities.entries.insert` | `authorities entries insert` | Insert a new TA authority entry field at a target location. |
942951
| `doc.authorities.entries.update` | `authorities entries update` | Update the properties of an existing TA authority entry. |
943952
| `doc.authorities.entries.remove` | `authorities entries remove` | Remove a TA authority entry field from the document. |
944-
| `doc.header_footers.list` | `header-footers list` | List header/footer slot entries across sections. |
945-
| `doc.header_footers.get` | `header-footers get` | Get a single header/footer slot entry by address. |
946-
| `doc.header_footers.resolve` | `header-footers resolve` | Resolve the effective header/footer reference for a slot, walking the section inheritance chain. |
947-
| `doc.header_footers.refs.set` | `header-footers refs set` | Set an explicit header/footer reference on a section slot. |
948-
| `doc.header_footers.refs.clear` | `header-footers refs clear` | Clear an explicit header/footer reference from a section slot. |
949-
| `doc.header_footers.refs.set_linked_to_previous` | `header-footers refs set-linked-to-previous` | Link or unlink a header/footer slot to/from the previous section. |
950-
| `doc.header_footers.parts.list` | `header-footers parts list` | List unique header/footer part records from document relationships. |
951-
| `doc.header_footers.parts.create` | `header-footers parts create` | Create a new independent header/footer part, optionally cloned from an existing part. |
952-
| `doc.header_footers.parts.delete` | `header-footers parts delete` | Delete a header/footer part and its associated relationship when no section slots reference it. |
953953
954954
#### Format
955955

packages/document-api/src/contract/operation-definitions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3334,13 +3334,14 @@ export const OPERATION_DEFINITIONS = {
33343334
'headerFooters.parts.create': {
33353335
memberPath: 'headerFooters.parts.create',
33363336
description: 'Create a new independent header/footer part, optionally cloned from an existing part.',
3337-
expectedResult: 'Returns a HeaderFooterPartsMutationResult with the new refId and partPath on success.',
3337+
expectedResult:
3338+
'Returns a HeaderFooterPartsMutationResult with the new refId/partPath on success, INVALID_TARGET failure when sourceRefId is invalid or mismatched.',
33383339
requiresDocumentContext: true,
33393340
metadata: mutationOperation({
33403341
idempotency: 'non-idempotent',
33413342
supportsDryRun: true,
33423343
supportsTrackedMode: false,
3343-
possibleFailureCodes: [],
3344+
possibleFailureCodes: ['INVALID_TARGET'],
33443345
throws: ['INVALID_TARGET', 'INVALID_INPUT', 'CAPABILITY_UNAVAILABLE', 'INTERNAL_ERROR'],
33453346
historyUnsafe: true,
33463347
}),

packages/document-api/src/contract/operation-registry.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ import type {
392392
HeaderFootersPartsCreateInput,
393393
HeaderFootersPartsDeleteInput,
394394
HeaderFooterPartsMutationResult,
395-
HeaderFooterPartsMutationSuccessResult,
396395
} from '../header-footers/header-footers.types.js';
397396
import type {
398397
ContentControlInfo,
@@ -961,7 +960,7 @@ export interface OperationRegistry extends FormatInlineAliasOperationRegistry {
961960
'headerFooters.parts.create': {
962961
input: HeaderFootersPartsCreateInput;
963962
options: MutationOptions;
964-
output: HeaderFooterPartsMutationSuccessResult;
963+
output: HeaderFooterPartsMutationResult;
965964
};
966965
'headerFooters.parts.delete': {
967966
input: HeaderFootersPartsDeleteInput;

packages/document-api/src/contract/schemas.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5524,17 +5524,34 @@ const operationSchemas: Record<OperationId, OperationSchemaSet> = {
55245524
},
55255525
['kind'],
55265526
),
5527-
output: objectSchema({ success: { const: true }, refId: { type: 'string' }, partPath: { type: 'string' } }, [
5528-
'success',
5529-
'refId',
5530-
'partPath',
5531-
]),
5527+
output: {
5528+
oneOf: [
5529+
objectSchema({ success: { const: true }, refId: { type: 'string' }, partPath: { type: 'string' } }, [
5530+
'success',
5531+
'refId',
5532+
'partPath',
5533+
]),
5534+
objectSchema(
5535+
{
5536+
success: { const: false },
5537+
failure: receiptFailureSchemaFor('headerFooters.parts.create'),
5538+
},
5539+
['success', 'failure'],
5540+
),
5541+
],
5542+
},
55325543
success: objectSchema({ success: { const: true }, refId: { type: 'string' }, partPath: { type: 'string' } }, [
55335544
'success',
55345545
'refId',
55355546
'partPath',
55365547
]),
5537-
failure: undefined,
5548+
failure: objectSchema(
5549+
{
5550+
success: { const: false },
5551+
failure: receiptFailureSchemaFor('headerFooters.parts.create'),
5552+
},
5553+
['success', 'failure'],
5554+
),
55385555
},
55395556
'headerFooters.parts.delete': {
55405557
input: objectSchema(

packages/document-api/src/header-footers/header-footers.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import type {
2222
HeaderFootersPartsCreateInput,
2323
HeaderFootersPartsDeleteInput,
2424
HeaderFooterPartsMutationResult,
25-
HeaderFooterPartsMutationSuccessResult,
2625
} from './header-footers.types.js';
2726

2827
export type {
@@ -77,7 +76,7 @@ export interface HeaderFootersAdapter {
7776
};
7877
parts: {
7978
list(query?: HeaderFootersPartsListQuery): HeaderFootersPartsListResult;
80-
create(input: HeaderFootersPartsCreateInput, options?: MutationOptions): HeaderFooterPartsMutationSuccessResult;
79+
create(input: HeaderFootersPartsCreateInput, options?: MutationOptions): HeaderFooterPartsMutationResult;
8180
delete(input: HeaderFootersPartsDeleteInput, options?: MutationOptions): HeaderFooterPartsMutationResult;
8281
};
8382
}
@@ -265,7 +264,7 @@ export function executeHeaderFootersPartsCreate(
265264
adapter: HeaderFootersAdapter,
266265
input: HeaderFootersPartsCreateInput,
267266
options?: MutationOptions,
268-
): HeaderFooterPartsMutationSuccessResult {
267+
): HeaderFooterPartsMutationResult {
269268
assertOneOf(input?.kind, 'headerFooters.parts.create.kind', HEADER_FOOTER_KINDS);
270269
if (input.sourceRefId !== undefined) {
271270
assertNonEmptyString(input.sourceRefId, 'headerFooters.parts.create.sourceRefId');

packages/document-api/src/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ import type {
325325
HeaderFootersPartsCreateInput,
326326
HeaderFootersPartsDeleteInput,
327327
HeaderFooterPartsMutationResult,
328-
HeaderFooterPartsMutationSuccessResult,
329328
} from './header-footers/header-footers.js';
330329
import {
331330
executeHeaderFootersList,
@@ -2423,10 +2422,7 @@ export function createDocumentApi(adapters: DocumentApiAdapters): DocumentApi {
24232422
list(query?: HeaderFootersPartsListQuery): HeaderFootersPartsListResult {
24242423
return executeHeaderFootersPartsList(adapters.headerFooters, query);
24252424
},
2426-
create(
2427-
input: HeaderFootersPartsCreateInput,
2428-
options?: MutationOptions,
2429-
): HeaderFooterPartsMutationSuccessResult {
2425+
create(input: HeaderFootersPartsCreateInput, options?: MutationOptions): HeaderFooterPartsMutationResult {
24302426
return executeHeaderFootersPartsCreate(adapters.headerFooters, input, options);
24312427
},
24322428
delete(input: HeaderFootersPartsDeleteInput, options?: MutationOptions): HeaderFooterPartsMutationResult {

packages/super-editor/src/document-api-adapters/header-footers-adapter.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import type {
1616
HeaderFootersPartsCreateInput,
1717
HeaderFootersPartsDeleteInput,
1818
HeaderFooterPartsMutationResult,
19-
HeaderFooterPartsMutationSuccessResult,
2019
SectionAddress,
2120
SectionMutationResult,
2221
MutationOptions,
@@ -416,7 +415,7 @@ export function headerFootersPartsCreateAdapter(
416415
editor: Editor,
417416
input: HeaderFootersPartsCreateInput,
418417
options?: MutationOptions,
419-
): HeaderFooterPartsMutationSuccessResult {
418+
): HeaderFooterPartsMutationResult {
420419
rejectTrackedMode('headerFooters.parts.create', options);
421420
checkRevision(editor, options?.expectedRevision);
422421

@@ -427,15 +426,15 @@ export function headerFootersPartsCreateAdapter(
427426
const relationships = readRelationshipElements(converter);
428427
const sourceRel = relationships.find((rel) => String(rel.attributes?.Id ?? '') === input.sourceRefId);
429428
if (!sourceRel) {
430-
throw new DocumentApiAdapterError(
429+
return toPartsMutationFailure(
431430
'INVALID_TARGET',
432431
`sourceRefId '${input.sourceRefId}' does not reference an existing header/footer relationship`,
433432
);
434433
}
435434
const sourceType = String(sourceRel.attributes?.Type ?? '');
436435
const sourceKind = kindFromRelationshipType(sourceType);
437436
if (sourceKind !== input.kind) {
438-
throw new DocumentApiAdapterError(
437+
return toPartsMutationFailure(
439438
'INVALID_TARGET',
440439
`sourceRefId '${input.sourceRefId}' is a ${sourceKind ?? 'unknown'}, not a ${input.kind}`,
441440
);

0 commit comments

Comments
 (0)