drupal-mcp-connector 3.1.0 → 3.2.0
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.
- package/.agents/commands/drupal-draft-nested-components.md +26 -0
- package/.agents/commands/drupal-entity-update.md +3 -3
- package/.agents/commands/drupal-update-node.md +1 -1
- package/CHANGELOG.md +61 -0
- package/package.json +7 -7
- package/src/lib/backends/jsonapi.js +18 -5
- package/src/lib/canonical-draft.js +795 -0
- package/src/lib/component-draft.js +16 -0
- package/src/lib/nested-draft.js +1404 -0
- package/src/lib/operations.js +1 -1
- package/src/lib/patch-preflight.js +34 -0
- package/src/lib/write-revision.js +66 -16
- package/src/tools/bulk.js +5 -9
- package/src/tools/entities.js +5 -11
- package/src/tools/index.js +2 -1
- package/src/tools/nested.js +68 -0
- package/src/tools/nodes.js +1 -1
|
@@ -198,6 +198,22 @@ export async function writeComponentDraft(backend, input, { dryRun = false } = {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
const pinHost = working
|
|
202
|
+
? await backend.getEntity({ entityType, bundle, id, resourceVersion: `id:${working}` })
|
|
203
|
+
: await backend.getEntity({ entityType, bundle, id });
|
|
204
|
+
if (!pinHost) {
|
|
205
|
+
throw new Error("The host revision could not be read. No write was attempted, and no direct paragraph write was tried.");
|
|
206
|
+
}
|
|
207
|
+
const directIds = new Set(paragraphPinsFromEntity(pinHost).map((pin) => pin.id.toLowerCase()));
|
|
208
|
+
for (const component of components) {
|
|
209
|
+
if (!directIds.has(component.id.toLowerCase())) {
|
|
210
|
+
throw new Error(
|
|
211
|
+
`${component.id} is not a direct paragraph of this host. Nested paragraphs are not component edits. ` +
|
|
212
|
+
"Use drupal_draft_nested_components. No write was attempted, and no direct paragraph write was tried."
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
201
217
|
const data = { type: `${entityType}--${bundle}`, id, attributes };
|
|
202
218
|
if (relationships && Object.keys(relationships).length) data.relationships = relationships;
|
|
203
219
|
const request = { entityType, bundle, id, data, components, live, working, langcode: defaultLang };
|