@umbraco-cms/mcp-dev 18.1.7 → 18.1.9
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/README.md +2 -0
- package/dist/{chunk-66TKBJQ7.js → chunk-OF7HVRKR.js} +1997 -1306
- package/dist/chunk-OF7HVRKR.js.map +1 -0
- package/dist/{chunk-BVWOXDOS.cjs → chunk-R2HBS7YH.cjs} +754 -63
- package/dist/chunk-R2HBS7YH.cjs.map +1 -0
- package/dist/collections.cjs +2 -2
- package/dist/collections.js +1 -1
- package/dist/index.cjs +351 -252
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +153 -54
- package/dist/index.js.map +1 -1
- package/dist/tool-types.d.ts +155 -6
- package/package.json +4 -4
- package/dist/chunk-66TKBJQ7.js.map +0 -1
- package/dist/chunk-BVWOXDOS.cjs.map +0 -1
|
@@ -17665,6 +17665,8 @@ function discoverAllBlockArrays(value, path3 = "root") {
|
|
|
17665
17665
|
results.push({
|
|
17666
17666
|
contentData: value.contentData,
|
|
17667
17667
|
settingsData: value.settingsData,
|
|
17668
|
+
layout: value.layout && typeof value.layout === "object" ? value.layout : void 0,
|
|
17669
|
+
expose: Array.isArray(value.expose) ? value.expose : void 0,
|
|
17668
17670
|
path: path3
|
|
17669
17671
|
});
|
|
17670
17672
|
value.contentData.forEach((block, index) => {
|
|
@@ -17932,6 +17934,714 @@ var UpdateBlockPropertyTool = {
|
|
|
17932
17934
|
};
|
|
17933
17935
|
var update_block_property_default = _mcpserversdk.withStandardDecorators.call(void 0, UpdateBlockPropertyTool);
|
|
17934
17936
|
|
|
17937
|
+
// src/umbraco-api/tools/document/put/create-document-block.ts
|
|
17938
|
+
|
|
17939
|
+
|
|
17940
|
+
|
|
17941
|
+
// src/umbraco-api/tools/document/put/helpers/block-builder.ts
|
|
17942
|
+
|
|
17943
|
+
var BLOCK_EDITOR_ALIASES = {
|
|
17944
|
+
BlockList: "Umbraco.BlockList",
|
|
17945
|
+
BlockGrid: "Umbraco.BlockGrid",
|
|
17946
|
+
RichText: "Umbraco.RichText"
|
|
17947
|
+
};
|
|
17948
|
+
var DEFAULT_GRID_COLUMN_SPAN = 12;
|
|
17949
|
+
var DEFAULT_GRID_ROW_SPAN = 1;
|
|
17950
|
+
function getBlockEditorKind(editorAlias) {
|
|
17951
|
+
switch (editorAlias) {
|
|
17952
|
+
case BLOCK_EDITOR_ALIASES.BlockList:
|
|
17953
|
+
return "BlockList";
|
|
17954
|
+
case BLOCK_EDITOR_ALIASES.BlockGrid:
|
|
17955
|
+
return "BlockGrid";
|
|
17956
|
+
case BLOCK_EDITOR_ALIASES.RichText:
|
|
17957
|
+
return "RichText";
|
|
17958
|
+
default:
|
|
17959
|
+
return null;
|
|
17960
|
+
}
|
|
17961
|
+
}
|
|
17962
|
+
function isBlockListOrGridValue(value) {
|
|
17963
|
+
return isBlockStructure(value) && !isRichTextValue(value);
|
|
17964
|
+
}
|
|
17965
|
+
function isRteWithBlocks(value) {
|
|
17966
|
+
return isRichTextValue(value);
|
|
17967
|
+
}
|
|
17968
|
+
function createEmptyBlockValue(kind) {
|
|
17969
|
+
const blocks = {
|
|
17970
|
+
layout: { [BLOCK_EDITOR_ALIASES[kind]]: [] },
|
|
17971
|
+
contentData: [],
|
|
17972
|
+
settingsData: [],
|
|
17973
|
+
expose: []
|
|
17974
|
+
};
|
|
17975
|
+
return kind === "RichText" ? { markup: "", blocks } : blocks;
|
|
17976
|
+
}
|
|
17977
|
+
function isPlainObject(value) {
|
|
17978
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17979
|
+
}
|
|
17980
|
+
function malformedBlockStructureError(field, expected) {
|
|
17981
|
+
return new (0, _mcpserversdk.ToolValidationError)({
|
|
17982
|
+
title: "Malformed block structure",
|
|
17983
|
+
detail: `Property has a malformed block structure and cannot be safely modified: '${field}' is present but is not ${expected}`
|
|
17984
|
+
});
|
|
17985
|
+
}
|
|
17986
|
+
function ensureField(target, key, expected, isValid, createDefault, fieldLabel = key) {
|
|
17987
|
+
const current = target[key];
|
|
17988
|
+
if (current === void 0 || current === null) {
|
|
17989
|
+
target[key] = createDefault();
|
|
17990
|
+
} else if (!isValid(current)) {
|
|
17991
|
+
throw malformedBlockStructureError(fieldLabel, expected);
|
|
17992
|
+
}
|
|
17993
|
+
}
|
|
17994
|
+
function normaliseRichTextBlockValue(rte) {
|
|
17995
|
+
ensureField(rte, "markup", "a string", (v) => typeof v === "string", () => "");
|
|
17996
|
+
ensureField(rte, "blocks", "an object", isPlainObject, () => createEmptyBlockValue("RichText").blocks);
|
|
17997
|
+
ensureField(rte.blocks, "contentData", "an array", Array.isArray, () => [], "blocks.contentData");
|
|
17998
|
+
ensureField(rte.blocks, "settingsData", "an array", Array.isArray, () => [], "blocks.settingsData");
|
|
17999
|
+
}
|
|
18000
|
+
function getTopLevelBlockContainer(value, kind) {
|
|
18001
|
+
const matches = kind === "RichText" ? isRteWithBlocks(value) : isBlockListOrGridValue(value);
|
|
18002
|
+
if (!matches) {
|
|
18003
|
+
return null;
|
|
18004
|
+
}
|
|
18005
|
+
const raw = kind === "RichText" ? value.blocks : value;
|
|
18006
|
+
const layoutAlias = BLOCK_EDITOR_ALIASES[kind];
|
|
18007
|
+
ensureField(raw, "layout", "an object", isPlainObject, () => ({}));
|
|
18008
|
+
ensureField(raw.layout, layoutAlias, "an array", Array.isArray, () => [], `layout['${layoutAlias}']`);
|
|
18009
|
+
ensureField(raw, "expose", "an array", Array.isArray, () => []);
|
|
18010
|
+
const [topLevel] = discoverAllBlockArrays(value, "root");
|
|
18011
|
+
return {
|
|
18012
|
+
...topLevel,
|
|
18013
|
+
layout: raw.layout,
|
|
18014
|
+
expose: raw.expose,
|
|
18015
|
+
layoutItems: raw.layout[layoutAlias]
|
|
18016
|
+
};
|
|
18017
|
+
}
|
|
18018
|
+
function buildBlockEntry(key, contentTypeKey, properties) {
|
|
18019
|
+
return {
|
|
18020
|
+
key,
|
|
18021
|
+
contentTypeKey,
|
|
18022
|
+
values: properties.map((p) => ({
|
|
18023
|
+
alias: p.alias,
|
|
18024
|
+
culture: _nullishCoalesce(p.culture, () => ( null)),
|
|
18025
|
+
segment: _nullishCoalesce(p.segment, () => ( null)),
|
|
18026
|
+
value: p.value
|
|
18027
|
+
}))
|
|
18028
|
+
};
|
|
18029
|
+
}
|
|
18030
|
+
function buildLayoutEntry(kind, options) {
|
|
18031
|
+
const entry = { contentKey: options.contentKey };
|
|
18032
|
+
if (options.settingsKey) {
|
|
18033
|
+
entry.settingsKey = options.settingsKey;
|
|
18034
|
+
}
|
|
18035
|
+
if (kind === "BlockGrid") {
|
|
18036
|
+
entry.columnSpan = _nullishCoalesce(options.columnSpan, () => ( DEFAULT_GRID_COLUMN_SPAN));
|
|
18037
|
+
entry.rowSpan = _nullishCoalesce(options.rowSpan, () => ( DEFAULT_GRID_ROW_SPAN));
|
|
18038
|
+
entry.areas = (_nullishCoalesce(options.areaKeys, () => ( []))).map((key) => ({ key, items: [] }));
|
|
18039
|
+
}
|
|
18040
|
+
return entry;
|
|
18041
|
+
}
|
|
18042
|
+
function buildExposeEntries(contentKey, cultures, segment = null) {
|
|
18043
|
+
const unique = Array.from(new Set(cultures.length > 0 ? cultures : [null]));
|
|
18044
|
+
return unique.map((culture) => ({ contentKey, culture, segment }));
|
|
18045
|
+
}
|
|
18046
|
+
function insertAtPosition(items, item, placement, keyOf) {
|
|
18047
|
+
switch (placement.position) {
|
|
18048
|
+
case "prepend":
|
|
18049
|
+
items.unshift(item);
|
|
18050
|
+
return true;
|
|
18051
|
+
case "append":
|
|
18052
|
+
items.push(item);
|
|
18053
|
+
return true;
|
|
18054
|
+
case "before":
|
|
18055
|
+
case "after": {
|
|
18056
|
+
const index = items.findIndex((i) => keyOf(i) === placement.contentKey);
|
|
18057
|
+
if (index === -1) {
|
|
18058
|
+
return false;
|
|
18059
|
+
}
|
|
18060
|
+
items.splice(placement.position === "before" ? index : index + 1, 0, item);
|
|
18061
|
+
return true;
|
|
18062
|
+
}
|
|
18063
|
+
}
|
|
18064
|
+
}
|
|
18065
|
+
function findLayoutLocation(items, contentKey, parent, areaKey) {
|
|
18066
|
+
for (let index = 0; index < items.length; index++) {
|
|
18067
|
+
const entry = items[index];
|
|
18068
|
+
if (entry.contentKey === contentKey) {
|
|
18069
|
+
return { items, index, entry, parent, areaKey };
|
|
18070
|
+
}
|
|
18071
|
+
for (const area of _nullishCoalesce(entry.areas, () => ( []))) {
|
|
18072
|
+
const found = findLayoutLocation(_nullishCoalesce(area.items, () => ( [])), contentKey, entry, area.key);
|
|
18073
|
+
if (found) {
|
|
18074
|
+
return found;
|
|
18075
|
+
}
|
|
18076
|
+
}
|
|
18077
|
+
}
|
|
18078
|
+
return null;
|
|
18079
|
+
}
|
|
18080
|
+
function collectNestedAreaContentKeys(entry) {
|
|
18081
|
+
const keys = [];
|
|
18082
|
+
for (const area of _nullishCoalesce(entry.areas, () => ( []))) {
|
|
18083
|
+
for (const child of _nullishCoalesce(area.items, () => ( []))) {
|
|
18084
|
+
keys.push(child.contentKey, ...collectNestedAreaContentKeys(child));
|
|
18085
|
+
}
|
|
18086
|
+
}
|
|
18087
|
+
return keys;
|
|
18088
|
+
}
|
|
18089
|
+
function removeBlockFromContainer(container, location) {
|
|
18090
|
+
const contentKey = location.entry.contentKey;
|
|
18091
|
+
const contentIndex = container.contentData.findIndex((b) => b.key === contentKey);
|
|
18092
|
+
if (contentIndex === -1) {
|
|
18093
|
+
return null;
|
|
18094
|
+
}
|
|
18095
|
+
const settingsKey = _nullishCoalesce(location.entry.settingsKey, () => ( null));
|
|
18096
|
+
location.items.splice(location.index, 1);
|
|
18097
|
+
container.contentData.splice(contentIndex, 1);
|
|
18098
|
+
if (settingsKey) {
|
|
18099
|
+
const settingsIndex = container.settingsData.findIndex((b) => b.key === settingsKey);
|
|
18100
|
+
if (settingsIndex !== -1) {
|
|
18101
|
+
container.settingsData.splice(settingsIndex, 1);
|
|
18102
|
+
}
|
|
18103
|
+
}
|
|
18104
|
+
for (let i = container.expose.length - 1; i >= 0; i--) {
|
|
18105
|
+
if (container.expose[i].contentKey === contentKey) {
|
|
18106
|
+
container.expose.splice(i, 1);
|
|
18107
|
+
}
|
|
18108
|
+
}
|
|
18109
|
+
return { layoutEntry: location.entry, settingsKey };
|
|
18110
|
+
}
|
|
18111
|
+
function escapeRegExp(value) {
|
|
18112
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
18113
|
+
}
|
|
18114
|
+
function rteBlockElementPattern(contentKey) {
|
|
18115
|
+
const key = escapeRegExp(contentKey);
|
|
18116
|
+
return new RegExp(
|
|
18117
|
+
`<(umb-rte-block(?:-inline)?)\\b[^>]*\\bdata-content-key=["']${key}["'][^>]*?(?:/>|>[\\s\\S]*?</\\1>)`,
|
|
18118
|
+
"i"
|
|
18119
|
+
);
|
|
18120
|
+
}
|
|
18121
|
+
function buildRteBlockElement(contentKey, inline = false) {
|
|
18122
|
+
const tag = inline ? "umb-rte-block-inline" : "umb-rte-block";
|
|
18123
|
+
return `<${tag} data-content-key="${contentKey}"><!--Umbraco-Block--></${tag}>`;
|
|
18124
|
+
}
|
|
18125
|
+
function findRteBlockElement(markup, contentKey) {
|
|
18126
|
+
const match = rteBlockElementPattern(contentKey).exec(_nullishCoalesce(markup, () => ( "")));
|
|
18127
|
+
if (!match) {
|
|
18128
|
+
return null;
|
|
18129
|
+
}
|
|
18130
|
+
return { start: match.index, end: match.index + match[0].length };
|
|
18131
|
+
}
|
|
18132
|
+
function insertRteBlockElement(markup, element, placement, inline = false) {
|
|
18133
|
+
const current = _nullishCoalesce(markup, () => ( ""));
|
|
18134
|
+
const standalone = inline ? `<p>${element}</p>` : element;
|
|
18135
|
+
switch (placement.position) {
|
|
18136
|
+
case "prepend":
|
|
18137
|
+
return standalone + current;
|
|
18138
|
+
case "append":
|
|
18139
|
+
return current + standalone;
|
|
18140
|
+
case "before":
|
|
18141
|
+
case "after": {
|
|
18142
|
+
const sibling = findRteBlockElement(current, placement.contentKey);
|
|
18143
|
+
if (!sibling) {
|
|
18144
|
+
return null;
|
|
18145
|
+
}
|
|
18146
|
+
const at = placement.position === "before" ? sibling.start : sibling.end;
|
|
18147
|
+
return current.slice(0, at) + element + current.slice(at);
|
|
18148
|
+
}
|
|
18149
|
+
}
|
|
18150
|
+
}
|
|
18151
|
+
function removeRteBlockElement(markup, contentKey) {
|
|
18152
|
+
const found = findRteBlockElement(markup, contentKey);
|
|
18153
|
+
if (!found) {
|
|
18154
|
+
return null;
|
|
18155
|
+
}
|
|
18156
|
+
let { start, end } = found;
|
|
18157
|
+
const openingParagraph = /<p\b[^>]*>\s*$/i.exec(markup.slice(0, start));
|
|
18158
|
+
const closingParagraph = /^\s*<\/p>/i.exec(markup.slice(end));
|
|
18159
|
+
if (openingParagraph && closingParagraph) {
|
|
18160
|
+
start -= openingParagraph[0].length;
|
|
18161
|
+
end += closingParagraph[0].length;
|
|
18162
|
+
}
|
|
18163
|
+
return markup.slice(0, start) + markup.slice(end);
|
|
18164
|
+
}
|
|
18165
|
+
function getBlockTypeConfigurations(dataTypeValues) {
|
|
18166
|
+
const blocks = _optionalChain([dataTypeValues, 'optionalAccess', _25 => _25.find, 'call', _26 => _26((v) => v.alias === "blocks"), 'optionalAccess', _27 => _27.value]);
|
|
18167
|
+
return Array.isArray(blocks) ? blocks : [];
|
|
18168
|
+
}
|
|
18169
|
+
function findBlockTypeConfiguration(configs, contentElementTypeKey) {
|
|
18170
|
+
return configs.find((c) => c.contentElementTypeKey === contentElementTypeKey);
|
|
18171
|
+
}
|
|
18172
|
+
function findAreaConfiguration(configs, parentContentTypeKey, areaKey) {
|
|
18173
|
+
return _optionalChain([findBlockTypeConfiguration, 'call', _28 => _28(configs, parentContentTypeKey), 'optionalAccess', _29 => _29.areas, 'optionalAccess', _30 => _30.find, 'call', _31 => _31((a) => a.key === areaKey)]);
|
|
18174
|
+
}
|
|
18175
|
+
function checkAllowedInArea(blockConfig, area) {
|
|
18176
|
+
if (blockConfig.allowInAreas === false) {
|
|
18177
|
+
return `Element type '${blockConfig.contentElementTypeKey}' is not allowed in areas`;
|
|
18178
|
+
}
|
|
18179
|
+
const allowance = _nullishCoalesce(area.specifiedAllowance, () => ( []));
|
|
18180
|
+
if (allowance.length === 0) {
|
|
18181
|
+
return null;
|
|
18182
|
+
}
|
|
18183
|
+
const allowed = allowance.some(
|
|
18184
|
+
(a) => a.elementTypeKey && a.elementTypeKey === blockConfig.contentElementTypeKey || a.groupKey && blockConfig.groupKey && a.groupKey === blockConfig.groupKey
|
|
18185
|
+
);
|
|
18186
|
+
return allowed ? null : `Element type '${blockConfig.contentElementTypeKey}' is not allowed in area '${_nullishCoalesce(area.alias, () => ( area.key))}'`;
|
|
18187
|
+
}
|
|
18188
|
+
|
|
18189
|
+
// src/umbraco-api/tools/document/put/helpers/document-block-context.ts
|
|
18190
|
+
|
|
18191
|
+
async function loadDocumentBlockContext(model) {
|
|
18192
|
+
const client = UmbracoManagementClient3.getClient();
|
|
18193
|
+
const document = await client.getDocumentById(model.documentId);
|
|
18194
|
+
const documentTypeProperties = await getAllDocumentTypeProperties(document.documentType.id);
|
|
18195
|
+
const propertyDefinition = documentTypeProperties.find((p) => p.alias === model.propertyAlias);
|
|
18196
|
+
if (!propertyDefinition) {
|
|
18197
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18198
|
+
title: "Property not found",
|
|
18199
|
+
detail: `Property '${model.propertyAlias}' does not exist on this document's type`,
|
|
18200
|
+
extensions: {
|
|
18201
|
+
availableProperties: documentTypeProperties.map((p) => p.alias)
|
|
18202
|
+
}
|
|
18203
|
+
});
|
|
18204
|
+
}
|
|
18205
|
+
const varianceError = validateCultureSegment(
|
|
18206
|
+
{ alias: model.propertyAlias, culture: model.culture, segment: model.segment },
|
|
18207
|
+
propertyDefinition
|
|
18208
|
+
);
|
|
18209
|
+
if (varianceError) {
|
|
18210
|
+
throw new (0, _mcpserversdk.ToolValidationError)({ title: "Invalid culture/segment", detail: varianceError });
|
|
18211
|
+
}
|
|
18212
|
+
const dataType = await client.getDataTypeById(propertyDefinition.dataTypeId);
|
|
18213
|
+
const kind = getBlockEditorKind(dataType.editorAlias);
|
|
18214
|
+
if (!kind) {
|
|
18215
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18216
|
+
title: "Not a block property",
|
|
18217
|
+
detail: `Property '${model.propertyAlias}' uses editor '${dataType.editorAlias}', not a BlockList, BlockGrid, or RichText editor`
|
|
18218
|
+
});
|
|
18219
|
+
}
|
|
18220
|
+
let valueEntry = document.values.find(
|
|
18221
|
+
(v) => matchesProperty(v, model.propertyAlias, model.culture, model.segment)
|
|
18222
|
+
);
|
|
18223
|
+
if (!valueEntry) {
|
|
18224
|
+
valueEntry = {
|
|
18225
|
+
alias: model.propertyAlias,
|
|
18226
|
+
culture: _nullishCoalesce(model.culture, () => ( null)),
|
|
18227
|
+
segment: _nullishCoalesce(model.segment, () => ( null)),
|
|
18228
|
+
editorAlias: dataType.editorAlias,
|
|
18229
|
+
value: null
|
|
18230
|
+
};
|
|
18231
|
+
document.values.push(valueEntry);
|
|
18232
|
+
}
|
|
18233
|
+
if (valueEntry.value === null || valueEntry.value === void 0 || valueEntry.value === "") {
|
|
18234
|
+
valueEntry.value = createEmptyBlockValue(kind);
|
|
18235
|
+
} else if (kind === "RichText" && typeof valueEntry.value === "object") {
|
|
18236
|
+
normaliseRichTextBlockValue(valueEntry.value);
|
|
18237
|
+
}
|
|
18238
|
+
const propertyValue = valueEntry.value;
|
|
18239
|
+
const container = getTopLevelBlockContainer(propertyValue, kind);
|
|
18240
|
+
if (!container) {
|
|
18241
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18242
|
+
title: "No block structure found",
|
|
18243
|
+
detail: `Property '${getPropertyKey(model.propertyAlias, model.culture, model.segment)}' does not contain a ${kind} block structure`,
|
|
18244
|
+
extensions: { propertyValue }
|
|
18245
|
+
});
|
|
18246
|
+
}
|
|
18247
|
+
return {
|
|
18248
|
+
document,
|
|
18249
|
+
propertyDefinition,
|
|
18250
|
+
kind,
|
|
18251
|
+
propertyValue,
|
|
18252
|
+
container,
|
|
18253
|
+
blockConfigs: getBlockTypeConfigurations(dataType.values)
|
|
18254
|
+
};
|
|
18255
|
+
}
|
|
18256
|
+
async function saveDocumentValues(documentId, document) {
|
|
18257
|
+
const client = UmbracoManagementClient3.getClient();
|
|
18258
|
+
const values = document.values.map((v) => ({
|
|
18259
|
+
alias: v.alias,
|
|
18260
|
+
culture: v.culture,
|
|
18261
|
+
segment: v.segment,
|
|
18262
|
+
value: v.value
|
|
18263
|
+
}));
|
|
18264
|
+
const variants = document.variants.map((v) => ({
|
|
18265
|
+
culture: v.culture,
|
|
18266
|
+
segment: v.segment,
|
|
18267
|
+
name: v.name
|
|
18268
|
+
}));
|
|
18269
|
+
const payload = {
|
|
18270
|
+
values,
|
|
18271
|
+
variants,
|
|
18272
|
+
template: document.template
|
|
18273
|
+
};
|
|
18274
|
+
await client.putDocumentById(documentId, payload);
|
|
18275
|
+
}
|
|
18276
|
+
|
|
18277
|
+
// src/umbraco-api/tools/document/put/create-document-block.ts
|
|
18278
|
+
|
|
18279
|
+
|
|
18280
|
+
|
|
18281
|
+
|
|
18282
|
+
|
|
18283
|
+
var createDocumentBlockOutputSchema = updateBlockPropertyOutputSchema;
|
|
18284
|
+
var blockPropertyValueSchema = _zod.z.object({
|
|
18285
|
+
alias: _zod.z.string().min(1).describe("The property alias on the block's element type"),
|
|
18286
|
+
value: _zod.z.any().nullish().describe("The property value"),
|
|
18287
|
+
culture: _zod.z.string().nullish().describe("Culture code, only for culture-variant element type properties"),
|
|
18288
|
+
segment: _zod.z.string().nullish().describe("Segment, only for segment-variant element type properties")
|
|
18289
|
+
});
|
|
18290
|
+
var placementSchema = _zod.z.object({
|
|
18291
|
+
position: _zod.z.enum(["before", "after", "append", "prepend"]).describe("'before'/'after' an existing sibling block (requires contentKey), or 'append'/'prepend' to the target container"),
|
|
18292
|
+
contentKey: _zod.z.string().uuid().nullish().describe("contentKey of the existing sibling block, required for 'before'/'after'")
|
|
18293
|
+
}).refine(
|
|
18294
|
+
(p) => p.position !== "before" && p.position !== "after" || !!p.contentKey,
|
|
18295
|
+
{ message: "contentKey is required when position is 'before' or 'after'", path: ["contentKey"] }
|
|
18296
|
+
);
|
|
18297
|
+
var gridSchema = _zod.z.object({
|
|
18298
|
+
columnSpan: _zod.z.number().int().positive().optional().describe("BlockGrid column span (default 12)"),
|
|
18299
|
+
rowSpan: _zod.z.number().int().positive().optional().describe("BlockGrid row span (default 1)"),
|
|
18300
|
+
areaKey: _zod.z.string().uuid().optional().describe("Key of the named area to insert into (requires parentContentKey)"),
|
|
18301
|
+
parentContentKey: _zod.z.string().uuid().optional().describe("contentKey of the block that owns the area (requires areaKey)")
|
|
18302
|
+
}).refine(
|
|
18303
|
+
(g) => !!g.areaKey === !!g.parentContentKey,
|
|
18304
|
+
{ message: "areaKey and parentContentKey must be provided together", path: ["parentContentKey"] }
|
|
18305
|
+
);
|
|
18306
|
+
var createDocumentBlockSchema = {
|
|
18307
|
+
documentId: _zod.z.string().uuid().describe("The document to add the block to"),
|
|
18308
|
+
propertyAlias: _zod.z.string().min(1).describe("Document property alias of the BlockList, BlockGrid, or RichText property"),
|
|
18309
|
+
culture: _zod.z.string().nullish().describe("Culture, only for culture-variant document properties"),
|
|
18310
|
+
segment: _zod.z.string().nullish().describe("Segment, only for segment-variant document properties"),
|
|
18311
|
+
contentTypeKey: _zod.z.string().uuid().describe("Element type key of the new block; must be allowed by the property's data type"),
|
|
18312
|
+
properties: _zod.z.array(blockPropertyValueSchema).optional().describe("Content property values for the new block"),
|
|
18313
|
+
settings: _zod.z.object({
|
|
18314
|
+
properties: _zod.z.array(blockPropertyValueSchema).describe("Settings property values")
|
|
18315
|
+
}).optional().describe("Settings for the new block; the settings element type comes from the data type configuration"),
|
|
18316
|
+
placement: placementSchema.optional().describe("Where to place the block relative to siblings (default: append)"),
|
|
18317
|
+
grid: gridSchema.optional().describe("BlockGrid-only layout options. Rejected for BlockList/RichText properties")
|
|
18318
|
+
};
|
|
18319
|
+
async function validateBlockProperties(elementTypeKey, properties, label) {
|
|
18320
|
+
if (properties.length === 0) {
|
|
18321
|
+
return [];
|
|
18322
|
+
}
|
|
18323
|
+
const definitions = await getAllDocumentTypeProperties(elementTypeKey);
|
|
18324
|
+
const errors = [];
|
|
18325
|
+
for (const prop of properties) {
|
|
18326
|
+
const def = definitions.find((d) => d.alias === prop.alias);
|
|
18327
|
+
if (!def) {
|
|
18328
|
+
errors.push(`${label} property '${getPropertyKey(prop.alias, prop.culture, prop.segment)}' does not exist on element type '${elementTypeKey}'`);
|
|
18329
|
+
continue;
|
|
18330
|
+
}
|
|
18331
|
+
const varianceError = validateCultureSegment(prop, def);
|
|
18332
|
+
if (varianceError) {
|
|
18333
|
+
errors.push(`${label}: ${varianceError}`);
|
|
18334
|
+
}
|
|
18335
|
+
}
|
|
18336
|
+
return errors;
|
|
18337
|
+
}
|
|
18338
|
+
var CreateDocumentBlockTool = {
|
|
18339
|
+
name: "create-document-block",
|
|
18340
|
+
description: `Creates (inserts) one new block in a document's BlockList, BlockGrid, or RichText property.
|
|
18341
|
+
|
|
18342
|
+
Writes the block's contentData (and settingsData), its expose entries, and its layout entry
|
|
18343
|
+
(and, for RichText, the <umb-rte-block> markup element) together in a single document update,
|
|
18344
|
+
so the block renders without any hand-assembled JSON. Acts on the property's top-level blocks only.
|
|
18345
|
+
|
|
18346
|
+
- contentTypeKey must be an element type allowed by the property's data type (and by the target area for BlockGrid).
|
|
18347
|
+
- placement is sibling-relative: { position: "before" | "after", contentKey: "<existing block>" }, or
|
|
18348
|
+
{ position: "append" | "prepend" } (default append). For BlockGrid, append/prepend targets the root,
|
|
18349
|
+
or the named area given in grid.
|
|
18350
|
+
- grid (BlockGrid only): columnSpan (default 12), rowSpan (default 1), and areaKey + parentContentKey
|
|
18351
|
+
to insert into a named area of an existing block.
|
|
18352
|
+
- New block keys are generated; the result returns the new contentKey.
|
|
18353
|
+
- The document is saved, not published.
|
|
18354
|
+
|
|
18355
|
+
Example: { documentId: "...", propertyAlias: "mainContent", contentTypeKey: "...",
|
|
18356
|
+
properties: [{ alias: "title", value: "Hello" }], placement: { position: "after", contentKey: "..." } }`,
|
|
18357
|
+
inputSchema: createDocumentBlockSchema,
|
|
18358
|
+
outputSchema: createDocumentBlockOutputSchema.shape,
|
|
18359
|
+
annotations: {
|
|
18360
|
+
idempotentHint: false
|
|
18361
|
+
},
|
|
18362
|
+
slices: ["update"],
|
|
18363
|
+
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Update),
|
|
18364
|
+
handler: (async (model) => {
|
|
18365
|
+
const client = UmbracoManagementClient3.getClient();
|
|
18366
|
+
const ctx = await loadDocumentBlockContext(model);
|
|
18367
|
+
const { kind, container, blockConfigs } = ctx;
|
|
18368
|
+
const placement = _nullishCoalesce(model.placement, () => ( { position: "append" }));
|
|
18369
|
+
const contentProperties = _nullishCoalesce(model.properties, () => ( []));
|
|
18370
|
+
const settingsProperties = _nullishCoalesce(_optionalChain([model, 'access', _32 => _32.settings, 'optionalAccess', _33 => _33.properties]), () => ( []));
|
|
18371
|
+
if (model.grid && kind !== "BlockGrid") {
|
|
18372
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18373
|
+
title: "grid options not supported",
|
|
18374
|
+
detail: `'grid' only applies to BlockGrid properties; '${model.propertyAlias}' is a ${kind} property`
|
|
18375
|
+
});
|
|
18376
|
+
}
|
|
18377
|
+
const areaKey = _optionalChain([model, 'access', _34 => _34.grid, 'optionalAccess', _35 => _35.areaKey]);
|
|
18378
|
+
const parentContentKey = _optionalChain([model, 'access', _36 => _36.grid, 'optionalAccess', _37 => _37.parentContentKey]);
|
|
18379
|
+
if (!!areaKey !== !!parentContentKey) {
|
|
18380
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18381
|
+
title: "Incomplete area target",
|
|
18382
|
+
detail: "grid.areaKey and grid.parentContentKey must be provided together"
|
|
18383
|
+
});
|
|
18384
|
+
}
|
|
18385
|
+
const blockConfig = findBlockTypeConfiguration(blockConfigs, model.contentTypeKey);
|
|
18386
|
+
if (!blockConfig) {
|
|
18387
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18388
|
+
title: "Element type not allowed",
|
|
18389
|
+
detail: `Element type '${model.contentTypeKey}' is not configured as a block on property '${model.propertyAlias}'`,
|
|
18390
|
+
extensions: {
|
|
18391
|
+
allowedBlocks: blockConfigs.map((c) => ({ contentTypeKey: c.contentElementTypeKey, label: _nullishCoalesce(c.label, () => ( null)) }))
|
|
18392
|
+
}
|
|
18393
|
+
});
|
|
18394
|
+
}
|
|
18395
|
+
if (model.settings && !blockConfig.settingsElementTypeKey) {
|
|
18396
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18397
|
+
title: "Settings not supported",
|
|
18398
|
+
detail: `Block type '${model.contentTypeKey}' has no settings element type configured`
|
|
18399
|
+
});
|
|
18400
|
+
}
|
|
18401
|
+
const propertyErrors = [
|
|
18402
|
+
...await validateBlockProperties(model.contentTypeKey, contentProperties, "Content"),
|
|
18403
|
+
...blockConfig.settingsElementTypeKey ? await validateBlockProperties(blockConfig.settingsElementTypeKey, settingsProperties, "Settings") : []
|
|
18404
|
+
];
|
|
18405
|
+
if (propertyErrors.length > 0) {
|
|
18406
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18407
|
+
title: "Invalid block properties",
|
|
18408
|
+
detail: propertyErrors.join("; "),
|
|
18409
|
+
extensions: { errors: propertyErrors }
|
|
18410
|
+
});
|
|
18411
|
+
}
|
|
18412
|
+
let targetItems = container.layoutItems;
|
|
18413
|
+
let targetArea = null;
|
|
18414
|
+
const resolveArea = (parent, key) => {
|
|
18415
|
+
const parentBlock = container.contentData.find((b) => b.key === parent.contentKey);
|
|
18416
|
+
if (!parentBlock) {
|
|
18417
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18418
|
+
title: "Parent block not found",
|
|
18419
|
+
detail: `Block '${parent.contentKey}' is in the layout but has no contentData entry`
|
|
18420
|
+
});
|
|
18421
|
+
}
|
|
18422
|
+
const config = findAreaConfiguration(blockConfigs, parentBlock.contentTypeKey, key);
|
|
18423
|
+
if (!config) {
|
|
18424
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18425
|
+
title: "Area not found",
|
|
18426
|
+
detail: `Area '${key}' is not configured for block type '${parentBlock.contentTypeKey}'`,
|
|
18427
|
+
extensions: {
|
|
18428
|
+
availableAreas: (_nullishCoalesce(_optionalChain([findBlockTypeConfiguration, 'call', _38 => _38(blockConfigs, parentBlock.contentTypeKey), 'optionalAccess', _39 => _39.areas]), () => ( []))).map((a) => ({ key: a.key, alias: _nullishCoalesce(a.alias, () => ( null)) }))
|
|
18429
|
+
}
|
|
18430
|
+
});
|
|
18431
|
+
}
|
|
18432
|
+
parent.areas = Array.isArray(parent.areas) ? parent.areas : [];
|
|
18433
|
+
let area = parent.areas.find((a) => a.key === key);
|
|
18434
|
+
if (!area) {
|
|
18435
|
+
area = { key, items: [] };
|
|
18436
|
+
parent.areas.push(area);
|
|
18437
|
+
}
|
|
18438
|
+
area.items = Array.isArray(area.items) ? area.items : [];
|
|
18439
|
+
return { items: area.items, config };
|
|
18440
|
+
};
|
|
18441
|
+
if (kind === "BlockGrid") {
|
|
18442
|
+
if (placement.position === "before" || placement.position === "after") {
|
|
18443
|
+
const sibling = findLayoutLocation(container.layoutItems, placement.contentKey);
|
|
18444
|
+
if (!sibling) {
|
|
18445
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18446
|
+
title: "Sibling block not found",
|
|
18447
|
+
detail: `No block with contentKey '${placement.contentKey}' exists in property '${model.propertyAlias}'`
|
|
18448
|
+
});
|
|
18449
|
+
}
|
|
18450
|
+
if (areaKey && (sibling.areaKey !== areaKey || _optionalChain([sibling, 'access', _40 => _40.parent, 'optionalAccess', _41 => _41.contentKey]) !== parentContentKey)) {
|
|
18451
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18452
|
+
title: "Sibling not in target area",
|
|
18453
|
+
detail: `Block '${placement.contentKey}' is not in area '${areaKey}' of block '${parentContentKey}'`
|
|
18454
|
+
});
|
|
18455
|
+
}
|
|
18456
|
+
targetItems = sibling.items;
|
|
18457
|
+
if (sibling.parent && sibling.areaKey) {
|
|
18458
|
+
targetArea = resolveArea(sibling.parent, sibling.areaKey).config;
|
|
18459
|
+
}
|
|
18460
|
+
} else if (areaKey && parentContentKey) {
|
|
18461
|
+
const parent = findLayoutLocation(container.layoutItems, parentContentKey);
|
|
18462
|
+
if (!parent) {
|
|
18463
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18464
|
+
title: "Parent block not found",
|
|
18465
|
+
detail: `No block with contentKey '${parentContentKey}' exists in property '${model.propertyAlias}'`
|
|
18466
|
+
});
|
|
18467
|
+
}
|
|
18468
|
+
const resolved = resolveArea(parent.entry, areaKey);
|
|
18469
|
+
targetItems = resolved.items;
|
|
18470
|
+
targetArea = resolved.config;
|
|
18471
|
+
}
|
|
18472
|
+
if (targetArea) {
|
|
18473
|
+
const notAllowed = checkAllowedInArea(blockConfig, targetArea);
|
|
18474
|
+
if (notAllowed) {
|
|
18475
|
+
throw new (0, _mcpserversdk.ToolValidationError)({ title: "Element type not allowed in area", detail: notAllowed });
|
|
18476
|
+
}
|
|
18477
|
+
if (targetArea.maxAllowed != null && targetItems.length >= targetArea.maxAllowed) {
|
|
18478
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18479
|
+
title: "Area is full",
|
|
18480
|
+
detail: `Area '${_nullishCoalesce(targetArea.alias, () => ( targetArea.key))}' allows at most ${targetArea.maxAllowed} block(s)`
|
|
18481
|
+
});
|
|
18482
|
+
}
|
|
18483
|
+
} else if (blockConfig.allowAtRoot === false) {
|
|
18484
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18485
|
+
title: "Element type not allowed at root",
|
|
18486
|
+
detail: `Element type '${model.contentTypeKey}' is not allowed at the root of this BlockGrid; insert it into an area instead`
|
|
18487
|
+
});
|
|
18488
|
+
}
|
|
18489
|
+
}
|
|
18490
|
+
const contentKey = _uuid.v4.call(void 0, );
|
|
18491
|
+
const settingsKey = model.settings ? _uuid.v4.call(void 0, ) : null;
|
|
18492
|
+
const layoutEntry = buildLayoutEntry(kind, {
|
|
18493
|
+
contentKey,
|
|
18494
|
+
settingsKey,
|
|
18495
|
+
columnSpan: _optionalChain([model, 'access', _42 => _42.grid, 'optionalAccess', _43 => _43.columnSpan]),
|
|
18496
|
+
rowSpan: _optionalChain([model, 'access', _44 => _44.grid, 'optionalAccess', _45 => _45.rowSpan]),
|
|
18497
|
+
areaKeys: (_nullishCoalesce(blockConfig.areas, () => ( []))).map((a) => a.key)
|
|
18498
|
+
});
|
|
18499
|
+
const elementType = await client.getDocumentTypeById(model.contentTypeKey);
|
|
18500
|
+
let exposeCultures = [null];
|
|
18501
|
+
if (elementType.variesByCulture) {
|
|
18502
|
+
if (model.culture) {
|
|
18503
|
+
exposeCultures = [model.culture];
|
|
18504
|
+
} else {
|
|
18505
|
+
const valueCultures = contentProperties.map((p) => p.culture).filter((c) => !!c);
|
|
18506
|
+
const documentCultures = ctx.document.variants.map((v) => v.culture).filter((c) => !!c);
|
|
18507
|
+
exposeCultures = valueCultures.length > 0 ? valueCultures : documentCultures.length > 0 ? documentCultures : [null];
|
|
18508
|
+
}
|
|
18509
|
+
}
|
|
18510
|
+
const exposeSegment = elementType.variesBySegment ? _nullishCoalesce(model.segment, () => ( null)) : null;
|
|
18511
|
+
let newMarkup = null;
|
|
18512
|
+
if (kind === "RichText") {
|
|
18513
|
+
const inline = blockConfig.displayInline === true;
|
|
18514
|
+
newMarkup = insertRteBlockElement(
|
|
18515
|
+
_nullishCoalesce(ctx.propertyValue.markup, () => ( "")),
|
|
18516
|
+
buildRteBlockElement(contentKey, inline),
|
|
18517
|
+
placement,
|
|
18518
|
+
inline
|
|
18519
|
+
);
|
|
18520
|
+
if (newMarkup === null) {
|
|
18521
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18522
|
+
title: "Sibling block not found",
|
|
18523
|
+
detail: `No block element with contentKey '${placement.contentKey}' exists in the RichText markup`
|
|
18524
|
+
});
|
|
18525
|
+
}
|
|
18526
|
+
}
|
|
18527
|
+
if (!insertAtPosition(targetItems, layoutEntry, placement, (i) => i.contentKey)) {
|
|
18528
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18529
|
+
title: "Sibling block not found",
|
|
18530
|
+
detail: `No block with contentKey '${placement.contentKey}' exists in property '${model.propertyAlias}'`
|
|
18531
|
+
});
|
|
18532
|
+
}
|
|
18533
|
+
container.contentData.push(buildBlockEntry(contentKey, model.contentTypeKey, contentProperties));
|
|
18534
|
+
if (settingsKey && blockConfig.settingsElementTypeKey) {
|
|
18535
|
+
container.settingsData.push(buildBlockEntry(settingsKey, blockConfig.settingsElementTypeKey, settingsProperties));
|
|
18536
|
+
}
|
|
18537
|
+
container.expose.push(...buildExposeEntries(contentKey, exposeCultures, exposeSegment));
|
|
18538
|
+
if (newMarkup !== null) {
|
|
18539
|
+
ctx.propertyValue.markup = newMarkup;
|
|
18540
|
+
}
|
|
18541
|
+
await saveDocumentValues(model.documentId, ctx.document);
|
|
18542
|
+
return _mcpserversdk.createToolResult.call(void 0, {
|
|
18543
|
+
success: true,
|
|
18544
|
+
message: `Created 1 block in ${kind} property '${getPropertyKey(model.propertyAlias, model.culture, model.segment)}'`,
|
|
18545
|
+
results: [{
|
|
18546
|
+
success: true,
|
|
18547
|
+
contentKey,
|
|
18548
|
+
message: settingsKey ? "Created block with settings" : "Created block"
|
|
18549
|
+
}]
|
|
18550
|
+
});
|
|
18551
|
+
})
|
|
18552
|
+
};
|
|
18553
|
+
var create_document_block_default = _mcpserversdk.withStandardDecorators.call(void 0, CreateDocumentBlockTool);
|
|
18554
|
+
|
|
18555
|
+
// src/umbraco-api/tools/document/put/delete-document-block.ts
|
|
18556
|
+
|
|
18557
|
+
|
|
18558
|
+
|
|
18559
|
+
|
|
18560
|
+
|
|
18561
|
+
|
|
18562
|
+
var deleteDocumentBlockOutputSchema = updateBlockPropertyOutputSchema;
|
|
18563
|
+
var deleteDocumentBlockSchema = {
|
|
18564
|
+
documentId: _zod.z.string().uuid().describe("The document containing the block"),
|
|
18565
|
+
propertyAlias: _zod.z.string().min(1).describe("Document property alias of the BlockList, BlockGrid, or RichText property"),
|
|
18566
|
+
culture: _zod.z.string().nullish().describe("Culture, only for culture-variant document properties"),
|
|
18567
|
+
segment: _zod.z.string().nullish().describe("Segment, only for segment-variant document properties"),
|
|
18568
|
+
contentKey: _zod.z.string().uuid().describe("contentKey of the block to delete")
|
|
18569
|
+
};
|
|
18570
|
+
var DeleteDocumentBlockTool = {
|
|
18571
|
+
name: "delete-document-block",
|
|
18572
|
+
description: `Deletes one block from a document's BlockList, BlockGrid, or RichText property.
|
|
18573
|
+
|
|
18574
|
+
Removes the block's contentData entry, its settingsData entry (via the layout settingsKey),
|
|
18575
|
+
its expose entries, and its layout entry (and, for RichText, its <umb-rte-block> markup element)
|
|
18576
|
+
together in a single document update. Acts on the property's top-level blocks only; BlockGrid
|
|
18577
|
+
blocks inside named areas can be deleted too.
|
|
18578
|
+
|
|
18579
|
+
A BlockGrid block whose areas still contain blocks is refused \u2014 delete the nested blocks first.
|
|
18580
|
+
The document is saved, not published.
|
|
18581
|
+
|
|
18582
|
+
Example: { documentId: "...", propertyAlias: "mainContent", contentKey: "..." }`,
|
|
18583
|
+
inputSchema: deleteDocumentBlockSchema,
|
|
18584
|
+
outputSchema: deleteDocumentBlockOutputSchema.shape,
|
|
18585
|
+
annotations: {
|
|
18586
|
+
destructiveHint: true
|
|
18587
|
+
},
|
|
18588
|
+
slices: ["update"],
|
|
18589
|
+
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Update),
|
|
18590
|
+
handler: (async (model) => {
|
|
18591
|
+
const ctx = await loadDocumentBlockContext(model);
|
|
18592
|
+
const { kind, container } = ctx;
|
|
18593
|
+
const location = findLayoutLocation(container.layoutItems, model.contentKey);
|
|
18594
|
+
if (!location) {
|
|
18595
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18596
|
+
title: "Block not found",
|
|
18597
|
+
detail: `No block with contentKey '${model.contentKey}' exists in property '${getPropertyKey(model.propertyAlias, model.culture, model.segment)}'`,
|
|
18598
|
+
extensions: {
|
|
18599
|
+
availableBlocks: container.contentData.map((b) => ({ contentKey: b.key, contentTypeKey: b.contentTypeKey }))
|
|
18600
|
+
}
|
|
18601
|
+
});
|
|
18602
|
+
}
|
|
18603
|
+
const nestedKeys = collectNestedAreaContentKeys(location.entry);
|
|
18604
|
+
if (nestedKeys.length > 0) {
|
|
18605
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18606
|
+
title: "Block has nested blocks",
|
|
18607
|
+
detail: `Block '${model.contentKey}' still contains ${nestedKeys.length} block(s) in its areas: ${nestedKeys.join(", ")}. Delete them first.`,
|
|
18608
|
+
extensions: { nestedContentKeys: nestedKeys }
|
|
18609
|
+
});
|
|
18610
|
+
}
|
|
18611
|
+
let newMarkup = null;
|
|
18612
|
+
if (kind === "RichText") {
|
|
18613
|
+
newMarkup = removeRteBlockElement(_nullishCoalesce(ctx.propertyValue.markup, () => ( "")), model.contentKey);
|
|
18614
|
+
if (newMarkup === null) {
|
|
18615
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18616
|
+
title: "Block markup not found",
|
|
18617
|
+
detail: `Block '${model.contentKey}' has a layout entry but no <umb-rte-block> element in the markup`
|
|
18618
|
+
});
|
|
18619
|
+
}
|
|
18620
|
+
}
|
|
18621
|
+
const removed = removeBlockFromContainer(container, location);
|
|
18622
|
+
if (!removed) {
|
|
18623
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
18624
|
+
title: "Block data not found",
|
|
18625
|
+
detail: `Block '${model.contentKey}' has a layout entry but no contentData entry`
|
|
18626
|
+
});
|
|
18627
|
+
}
|
|
18628
|
+
if (newMarkup !== null) {
|
|
18629
|
+
ctx.propertyValue.markup = newMarkup;
|
|
18630
|
+
}
|
|
18631
|
+
await saveDocumentValues(model.documentId, ctx.document);
|
|
18632
|
+
return _mcpserversdk.createToolResult.call(void 0, {
|
|
18633
|
+
success: true,
|
|
18634
|
+
message: `Deleted 1 block from ${kind} property '${getPropertyKey(model.propertyAlias, model.culture, model.segment)}'`,
|
|
18635
|
+
results: [{
|
|
18636
|
+
success: true,
|
|
18637
|
+
contentKey: model.contentKey,
|
|
18638
|
+
message: removed.settingsKey ? "Deleted block and its settings" : "Deleted block"
|
|
18639
|
+
}]
|
|
18640
|
+
});
|
|
18641
|
+
})
|
|
18642
|
+
};
|
|
18643
|
+
var delete_document_block_default = _mcpserversdk.withStandardDecorators.call(void 0, DeleteDocumentBlockTool);
|
|
18644
|
+
|
|
17935
18645
|
// src/umbraco-api/tools/document/items/get/get-root.ts
|
|
17936
18646
|
|
|
17937
18647
|
|
|
@@ -18166,6 +18876,8 @@ var DocumentCollection = {
|
|
|
18166
18876
|
tools.push(update_document_properties_default);
|
|
18167
18877
|
tools.push(update_document_name_default);
|
|
18168
18878
|
tools.push(update_block_property_default);
|
|
18879
|
+
tools.push(create_document_block_default);
|
|
18880
|
+
tools.push(delete_document_block_default);
|
|
18169
18881
|
tools.push(put_document_domains_default);
|
|
18170
18882
|
tools.push(put_document_notifications_default);
|
|
18171
18883
|
tools.push(put_document_public_access_default);
|
|
@@ -18515,7 +19227,7 @@ var CopyDocumentTypeTool = {
|
|
|
18515
19227
|
validateStatus: () => true
|
|
18516
19228
|
});
|
|
18517
19229
|
if (response.status === 201) {
|
|
18518
|
-
const location = _optionalChain([response, 'access',
|
|
19230
|
+
const location = _optionalChain([response, 'access', _46 => _46.headers, 'optionalAccess', _47 => _47.location]) || "";
|
|
18519
19231
|
const newId = location.split("/").pop() || "";
|
|
18520
19232
|
const output = { id: newId };
|
|
18521
19233
|
return _mcpserversdk.createToolResult.call(void 0, output);
|
|
@@ -20764,7 +21476,7 @@ var CopyElementTool = {
|
|
|
20764
21476
|
validateStatus: () => true
|
|
20765
21477
|
});
|
|
20766
21478
|
if (response.status === 201) {
|
|
20767
|
-
const location = _optionalChain([response, 'access',
|
|
21479
|
+
const location = _optionalChain([response, 'access', _48 => _48.headers, 'optionalAccess', _49 => _49.location]) || "";
|
|
20768
21480
|
const newId = location.split("/").pop() || "";
|
|
20769
21481
|
const output = { id: newId };
|
|
20770
21482
|
return _mcpserversdk.createToolResult.call(void 0, output);
|
|
@@ -22720,7 +23432,7 @@ function getExtensionFromMimeType(mimeType) {
|
|
|
22720
23432
|
return extension ? `.${extension}` : void 0;
|
|
22721
23433
|
}
|
|
22722
23434
|
function validateMediaTypeForSvg(filePath, fileUrl, fileName, mediaTypeName) {
|
|
22723
|
-
const isSvg = _optionalChain([filePath, 'optionalAccess',
|
|
23435
|
+
const isSvg = _optionalChain([filePath, 'optionalAccess', _50 => _50.toLowerCase, 'call', _51 => _51(), 'access', _52 => _52.endsWith, 'call', _53 => _53(".svg")]) || _optionalChain([fileUrl, 'optionalAccess', _54 => _54.toLowerCase, 'call', _55 => _55(), 'access', _56 => _56.endsWith, 'call', _57 => _57(".svg")]) || fileName.toLowerCase().endsWith(".svg");
|
|
22724
23436
|
if (isSvg && mediaTypeName === _mcpserversdk.MEDIA_TYPE_IMAGE) {
|
|
22725
23437
|
console.warn(`SVG detected - using ${_mcpserversdk.MEDIA_TYPE_VECTOR_GRAPHICS} media type instead of ${_mcpserversdk.MEDIA_TYPE_IMAGE}`);
|
|
22726
23438
|
return _mcpserversdk.MEDIA_TYPE_VECTOR_GRAPHICS;
|
|
@@ -22874,8 +23586,8 @@ async function uploadMediaFile(client, params) {
|
|
|
22874
23586
|
});
|
|
22875
23587
|
} catch (error) {
|
|
22876
23588
|
const err = error;
|
|
22877
|
-
const errorData = _optionalChain([err, 'access',
|
|
22878
|
-
throw new Error(`Failed to upload temporary file: ${_optionalChain([err, 'access',
|
|
23589
|
+
const errorData = _optionalChain([err, 'access', _58 => _58.response, 'optionalAccess', _59 => _59.data]) ? typeof err.response.data === "string" ? err.response.data : JSON.stringify(err.response.data) : err.message;
|
|
23590
|
+
throw new Error(`Failed to upload temporary file: ${_optionalChain([err, 'access', _60 => _60.response, 'optionalAccess', _61 => _61.status]) || "Unknown error"} - ${errorData}`);
|
|
22879
23591
|
}
|
|
22880
23592
|
const valueStructure = buildValueStructure(validatedMediaTypeName, params.temporaryFileId);
|
|
22881
23593
|
let response;
|
|
@@ -22895,12 +23607,12 @@ async function uploadMediaFile(client, params) {
|
|
|
22895
23607
|
}, _mcpserversdk.CAPTURE_RAW_HTTP_RESPONSE);
|
|
22896
23608
|
} catch (error) {
|
|
22897
23609
|
const err = error;
|
|
22898
|
-
throw new Error(`Failed to create media item: ${_optionalChain([err, 'access',
|
|
23610
|
+
throw new Error(`Failed to create media item: ${_optionalChain([err, 'access', _62 => _62.response, 'optionalAccess', _63 => _63.status]) || "Unknown error"} - ${JSON.stringify(_optionalChain([err, 'access', _64 => _64.response, 'optionalAccess', _65 => _65.data])) || err.message}`);
|
|
22899
23611
|
}
|
|
22900
23612
|
if (response.status < 200 || response.status >= 300) {
|
|
22901
23613
|
throw new Error(`Request failed with status code ${response.status}`);
|
|
22902
23614
|
}
|
|
22903
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
23615
|
+
const locationHeader = _optionalChain([response, 'access', _66 => _66.headers, 'optionalAccess', _67 => _67.location]) || _optionalChain([response, 'access', _68 => _68.headers, 'optionalAccess', _69 => _69.Location]);
|
|
22904
23616
|
if (!locationHeader) {
|
|
22905
23617
|
throw new Error("No Location header in response - cannot determine created media ID");
|
|
22906
23618
|
}
|
|
@@ -22925,36 +23637,22 @@ function buildSourceTypeSection(allowFilePath, otherSources) {
|
|
|
22925
23637
|
// src/umbraco-api/tools/media/post/helpers/streaming-upload.ts
|
|
22926
23638
|
|
|
22927
23639
|
|
|
22928
|
-
var _mcphosted = require('@umbraco-cms/mcp-hosted');
|
|
22929
23640
|
|
|
22930
23641
|
|
|
22931
23642
|
|
|
22932
23643
|
|
|
22933
23644
|
|
|
22934
23645
|
|
|
22935
|
-
|
|
22936
|
-
|
|
22937
|
-
return authContext !== null;
|
|
23646
|
+
function isStreamingUploadAvailable() {
|
|
23647
|
+
return _optionalChain([_mcpserversdk.getActiveRequestContext.call(void 0, ), 'optionalAccess', _70 => _70.umbracoAuth]) !== void 0;
|
|
22938
23648
|
}
|
|
22939
23649
|
async function resolveAuth() {
|
|
22940
|
-
|
|
22941
|
-
|
|
22942
|
-
"Streaming auth context not configured. setStreamingAuthContext() must be called in worker init()."
|
|
22943
|
-
);
|
|
22944
|
-
}
|
|
22945
|
-
const entry = await _mcphosted.getStoredUmbracoToken.call(void 0, authContext.env.OAUTH_KV, authContext.tokenKey);
|
|
22946
|
-
if (!_optionalChain([entry, 'optionalAccess', _49 => _49.tokens, 'optionalAccess', _50 => _50.access_token])) {
|
|
22947
|
-
throw new Error("No Umbraco access token in KV. Reconnect the MCP connector.");
|
|
22948
|
-
}
|
|
22949
|
-
const baseUrl = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([entry, 'access', _51 => _51.site, 'optionalAccess', _52 => _52.serverUrl]), () => ( _optionalChain([entry, 'access', _53 => _53.site, 'optionalAccess', _54 => _54.baseUrl]))), () => ( authContext.env.UMBRACO_SERVER_URL)), () => ( authContext.env.UMBRACO_BASE_URL));
|
|
22950
|
-
if (!baseUrl) {
|
|
22951
|
-
throw new Error("No Umbraco base URL resolvable from site or env.");
|
|
22952
|
-
}
|
|
22953
|
-
return { accessToken: entry.tokens.access_token, baseUrl: _mcpserversdk.normalizeBaseUrl.call(void 0, baseUrl) };
|
|
23650
|
+
const { accessToken, baseUrl } = await _mcpserversdk.getSessionUmbracoAuth.call(void 0, );
|
|
23651
|
+
return { accessToken, baseUrl: _mcpserversdk.normalizeBaseUrl.call(void 0, baseUrl) };
|
|
22954
23652
|
}
|
|
22955
23653
|
function ensureExtension(name, contentType, urlPath) {
|
|
22956
23654
|
if (name.includes(".")) return name;
|
|
22957
|
-
const fromUrl = _optionalChain([urlPath, 'access',
|
|
23655
|
+
const fromUrl = _optionalChain([urlPath, 'access', _71 => _71.match, 'call', _72 => _72(/\.([a-z0-9]{1,8})$/i), 'optionalAccess', _73 => _73[0]]);
|
|
22958
23656
|
if (fromUrl) return `${name}${fromUrl}`;
|
|
22959
23657
|
if (contentType) {
|
|
22960
23658
|
const subtype = contentType.split(";")[0].split("/")[1];
|
|
@@ -22974,10 +23672,7 @@ async function streamingUploadFromUrl(params) {
|
|
|
22974
23672
|
);
|
|
22975
23673
|
const [mediaTypeId, auth] = await Promise.all([
|
|
22976
23674
|
fetchMediaTypeId(client, validatedMediaTypeName),
|
|
22977
|
-
(
|
|
22978
|
-
await client.getTemporaryFileConfiguration().catch(() => void 0);
|
|
22979
|
-
return resolveAuth();
|
|
22980
|
-
})()
|
|
23675
|
+
resolveAuth()
|
|
22981
23676
|
]);
|
|
22982
23677
|
const { accessToken, baseUrl } = auth;
|
|
22983
23678
|
const ctl = new AbortController();
|
|
@@ -23063,8 +23758,8 @@ Content-Type: ${sourceContentType}\r
|
|
|
23063
23758
|
if (response.status < 200 || response.status >= 300) {
|
|
23064
23759
|
throw new Error(`postMedia failed with status ${response.status}`);
|
|
23065
23760
|
}
|
|
23066
|
-
const locationHeader = _nullishCoalesce(_optionalChain([response, 'access',
|
|
23067
|
-
const idMatch = _optionalChain([locationHeader, 'optionalAccess',
|
|
23761
|
+
const locationHeader = _nullishCoalesce(_optionalChain([response, 'access', _74 => _74.headers, 'optionalAccess', _75 => _75.location]), () => ( _optionalChain([response, 'access', _76 => _76.headers, 'optionalAccess', _77 => _77.Location])));
|
|
23762
|
+
const idMatch = _optionalChain([locationHeader, 'optionalAccess', _78 => _78.match, 'call', _79 => _79(/\/([a-f0-9-]{36})$/i)]);
|
|
23068
23763
|
if (!idMatch) {
|
|
23069
23764
|
throw new Error(
|
|
23070
23765
|
`Could not extract media id from Location header: ${_nullishCoalesce(locationHeader, () => ( "(missing)"))}`
|
|
@@ -23169,7 +23864,7 @@ ${filePathSection}
|
|
|
23169
23864
|
let effectiveSourceType;
|
|
23170
23865
|
let effectiveFileUrl = model.fileUrl;
|
|
23171
23866
|
if (model.sourceType === "file") {
|
|
23172
|
-
if (!_optionalChain([model, 'access',
|
|
23867
|
+
if (!_optionalChain([model, 'access', _80 => _80.file, 'optionalAccess', _81 => _81.download_url])) {
|
|
23173
23868
|
return _mcpserversdk.createToolResultError.call(void 0, {
|
|
23174
23869
|
detail: "Error creating media: sourceType is 'file' but no file object was provided. ChatGPT's connector should inject this automatically when a file is attached \u2014 if it didn't, the user has nothing attached or your client doesn't support openai/fileParams."
|
|
23175
23870
|
});
|
|
@@ -23179,7 +23874,7 @@ ${filePathSection}
|
|
|
23179
23874
|
} else {
|
|
23180
23875
|
effectiveSourceType = model.sourceType;
|
|
23181
23876
|
}
|
|
23182
|
-
if (effectiveSourceType === "url" &&
|
|
23877
|
+
if (effectiveSourceType === "url" && isStreamingUploadAvailable()) {
|
|
23183
23878
|
if (!effectiveFileUrl) {
|
|
23184
23879
|
return _mcpserversdk.createToolResultError.call(void 0, {
|
|
23185
23880
|
detail: "Error creating media: fileUrl is required when sourceType is 'url'"
|
|
@@ -23308,7 +24003,7 @@ ${filePathSection}
|
|
|
23308
24003
|
});
|
|
23309
24004
|
}
|
|
23310
24005
|
const client = UmbracoManagementClient3.getClient();
|
|
23311
|
-
const streamingAvailable =
|
|
24006
|
+
const streamingAvailable = isStreamingUploadAvailable();
|
|
23312
24007
|
const results = await mapWithConcurrency(
|
|
23313
24008
|
model.files,
|
|
23314
24009
|
UPLOAD_CONCURRENCY,
|
|
@@ -23318,7 +24013,7 @@ ${filePathSection}
|
|
|
23318
24013
|
let effectiveSourceType;
|
|
23319
24014
|
let effectiveFileUrl = file.fileUrl;
|
|
23320
24015
|
if (model.sourceType === "file") {
|
|
23321
|
-
if (!_optionalChain([file, 'access',
|
|
24016
|
+
if (!_optionalChain([file, 'access', _82 => _82.file, 'optionalAccess', _83 => _83.download_url])) {
|
|
23322
24017
|
return {
|
|
23323
24018
|
success: false,
|
|
23324
24019
|
name: file.name,
|
|
@@ -23417,7 +24112,7 @@ var CreateMediaFolderTool = {
|
|
|
23417
24112
|
if (response.status < 200 || response.status >= 300) {
|
|
23418
24113
|
throw new Error(`Request failed with status code ${response.status}`);
|
|
23419
24114
|
}
|
|
23420
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
24115
|
+
const locationHeader = _optionalChain([response, 'access', _84 => _84.headers, 'optionalAccess', _85 => _85.location]) || _optionalChain([response, 'access', _86 => _86.headers, 'optionalAccess', _87 => _87.Location]);
|
|
23421
24116
|
if (!locationHeader) {
|
|
23422
24117
|
throw new Error("No Location header in response - cannot determine created folder ID");
|
|
23423
24118
|
}
|
|
@@ -24703,7 +25398,7 @@ var CreateMediaTypeFolderTool = {
|
|
|
24703
25398
|
validateStatus: () => true
|
|
24704
25399
|
});
|
|
24705
25400
|
if (response.status === 201) {
|
|
24706
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25401
|
+
const locationHeader = _optionalChain([response, 'access', _88 => _88.headers, 'optionalAccess', _89 => _89["location"]]) || _optionalChain([response, 'access', _90 => _90.headers, 'optionalAccess', _91 => _91["Location"]]);
|
|
24707
25402
|
let createdId = model.id || "";
|
|
24708
25403
|
if (locationHeader) {
|
|
24709
25404
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -24838,7 +25533,7 @@ var CreateMediaTypeTool = {
|
|
|
24838
25533
|
validateStatus: () => true
|
|
24839
25534
|
});
|
|
24840
25535
|
if (response.status === 201) {
|
|
24841
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25536
|
+
const locationHeader = _optionalChain([response, 'access', _92 => _92.headers, 'optionalAccess', _93 => _93["location"]]) || _optionalChain([response, 'access', _94 => _94.headers, 'optionalAccess', _95 => _95["Location"]]);
|
|
24842
25537
|
let createdId = model.id || "";
|
|
24843
25538
|
if (locationHeader) {
|
|
24844
25539
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -24889,7 +25584,7 @@ var CopyMediaTypeTool = {
|
|
|
24889
25584
|
validateStatus: () => true
|
|
24890
25585
|
});
|
|
24891
25586
|
if (response.status === 201) {
|
|
24892
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25587
|
+
const locationHeader = _optionalChain([response, 'access', _96 => _96.headers, 'optionalAccess', _97 => _97["location"]]) || _optionalChain([response, 'access', _98 => _98.headers, 'optionalAccess', _99 => _99["Location"]]);
|
|
24893
25588
|
let createdId = "";
|
|
24894
25589
|
if (locationHeader) {
|
|
24895
25590
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -25099,7 +25794,7 @@ var CreateMemberTool = {
|
|
|
25099
25794
|
validateStatus: () => true
|
|
25100
25795
|
});
|
|
25101
25796
|
if (response.status === 201) {
|
|
25102
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25797
|
+
const locationHeader = _optionalChain([response, 'access', _100 => _100.headers, 'optionalAccess', _101 => _101["location"]]) || _optionalChain([response, 'access', _102 => _102.headers, 'optionalAccess', _103 => _103["Location"]]);
|
|
25103
25798
|
let createdId = model.id || "";
|
|
25104
25799
|
if (locationHeader) {
|
|
25105
25800
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -25648,7 +26343,7 @@ var CreateMemberTypeTool = {
|
|
|
25648
26343
|
validateStatus: () => true
|
|
25649
26344
|
});
|
|
25650
26345
|
if (response.status === 201) {
|
|
25651
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
26346
|
+
const locationHeader = _optionalChain([response, 'access', _104 => _104.headers, 'optionalAccess', _105 => _105["location"]]) || _optionalChain([response, 'access', _106 => _106.headers, 'optionalAccess', _107 => _107["Location"]]);
|
|
25652
26347
|
let createdId = model.id || "";
|
|
25653
26348
|
if (locationHeader) {
|
|
25654
26349
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -25818,7 +26513,7 @@ var CopyMemberTypeTool = {
|
|
|
25818
26513
|
validateStatus: () => true
|
|
25819
26514
|
});
|
|
25820
26515
|
if (response.status === 201) {
|
|
25821
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
26516
|
+
const locationHeader = _optionalChain([response, 'access', _108 => _108.headers, 'optionalAccess', _109 => _109["location"]]) || _optionalChain([response, 'access', _110 => _110.headers, 'optionalAccess', _111 => _111["Location"]]);
|
|
25822
26517
|
let createdId = "";
|
|
25823
26518
|
if (locationHeader) {
|
|
25824
26519
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -26178,7 +26873,7 @@ var CreatePartialViewTool = {
|
|
|
26178
26873
|
validateStatus: () => true
|
|
26179
26874
|
});
|
|
26180
26875
|
if (response.status === 201) {
|
|
26181
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
26876
|
+
const locationHeader = _optionalChain([response, 'access', _112 => _112.headers, 'optionalAccess', _113 => _113["location"]]) || _optionalChain([response, 'access', _114 => _114.headers, 'optionalAccess', _115 => _115["Location"]]);
|
|
26182
26877
|
let createdPath = "";
|
|
26183
26878
|
if (locationHeader) {
|
|
26184
26879
|
const pathMatch = locationHeader.match(/partial-view\/(.+)$/);
|
|
@@ -26225,7 +26920,7 @@ var CreatePartialViewFolderTool = {
|
|
|
26225
26920
|
validateStatus: () => true
|
|
26226
26921
|
});
|
|
26227
26922
|
if (response.status === 201) {
|
|
26228
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
26923
|
+
const locationHeader = _optionalChain([response, 'access', _116 => _116.headers, 'optionalAccess', _117 => _117["location"]]) || _optionalChain([response, 'access', _118 => _118.headers, 'optionalAccess', _119 => _119["Location"]]);
|
|
26229
26924
|
let createdPath = "";
|
|
26230
26925
|
if (locationHeader) {
|
|
26231
26926
|
const pathMatch = locationHeader.match(/partial-view\/folder\/(.+)$/);
|
|
@@ -27022,7 +27717,7 @@ var CreateScriptTool = {
|
|
|
27022
27717
|
validateStatus: () => true
|
|
27023
27718
|
});
|
|
27024
27719
|
if (response.status === 201) {
|
|
27025
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
27720
|
+
const locationHeader = _optionalChain([response, 'access', _120 => _120.headers, 'optionalAccess', _121 => _121["location"]]) || _optionalChain([response, 'access', _122 => _122.headers, 'optionalAccess', _123 => _123["Location"]]);
|
|
27026
27721
|
let createdPath = "";
|
|
27027
27722
|
if (locationHeader) {
|
|
27028
27723
|
const pathMatch = locationHeader.match(/script\/(.+)$/);
|
|
@@ -27069,7 +27764,7 @@ var CreateScriptFolderTool = {
|
|
|
27069
27764
|
validateStatus: () => true
|
|
27070
27765
|
});
|
|
27071
27766
|
if (response.status === 201) {
|
|
27072
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
27767
|
+
const locationHeader = _optionalChain([response, 'access', _124 => _124.headers, 'optionalAccess', _125 => _125["location"]]) || _optionalChain([response, 'access', _126 => _126.headers, 'optionalAccess', _127 => _127["Location"]]);
|
|
27073
27768
|
let createdPath = "";
|
|
27074
27769
|
if (locationHeader) {
|
|
27075
27770
|
const pathMatch = locationHeader.match(/script\/folder\/(.+)$/);
|
|
@@ -27666,7 +28361,7 @@ var CreateStylesheetTool = {
|
|
|
27666
28361
|
validateStatus: () => true
|
|
27667
28362
|
});
|
|
27668
28363
|
if (response.status === 201) {
|
|
27669
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
28364
|
+
const locationHeader = _optionalChain([response, 'access', _128 => _128.headers, 'optionalAccess', _129 => _129["location"]]) || _optionalChain([response, 'access', _130 => _130.headers, 'optionalAccess', _131 => _131["Location"]]);
|
|
27670
28365
|
let createdPath = "";
|
|
27671
28366
|
if (locationHeader) {
|
|
27672
28367
|
const pathMatch = locationHeader.match(/stylesheet\/(.+)$/);
|
|
@@ -27713,7 +28408,7 @@ var CreateStylesheetFolderTool = {
|
|
|
27713
28408
|
validateStatus: () => true
|
|
27714
28409
|
});
|
|
27715
28410
|
if (response.status === 201) {
|
|
27716
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
28411
|
+
const locationHeader = _optionalChain([response, 'access', _132 => _132.headers, 'optionalAccess', _133 => _133["location"]]) || _optionalChain([response, 'access', _134 => _134.headers, 'optionalAccess', _135 => _135["Location"]]);
|
|
27717
28412
|
let createdPath = "";
|
|
27718
28413
|
if (locationHeader) {
|
|
27719
28414
|
const pathMatch = locationHeader.match(/stylesheet\/folder\/(.+)$/);
|
|
@@ -28077,7 +28772,7 @@ var CreateTemplateTool = {
|
|
|
28077
28772
|
validateStatus: () => true
|
|
28078
28773
|
});
|
|
28079
28774
|
if (response.status === 201) {
|
|
28080
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
28775
|
+
const locationHeader = _optionalChain([response, 'access', _136 => _136.headers, 'optionalAccess', _137 => _137["location"]]) || _optionalChain([response, 'access', _138 => _138.headers, 'optionalAccess', _139 => _139["Location"]]);
|
|
28081
28776
|
let createdId = "";
|
|
28082
28777
|
if (locationHeader) {
|
|
28083
28778
|
const idMatch = locationHeader.match(/template\/([a-f0-9-]+)$/i);
|
|
@@ -28806,15 +29501,11 @@ var get_user_current_permissions_default = _mcpserversdk.withStandardDecorators.
|
|
|
28806
29501
|
|
|
28807
29502
|
|
|
28808
29503
|
|
|
28809
|
-
|
|
28810
|
-
var outputSchema66 = _zod.z.object({
|
|
28811
|
-
items: getUserCurrentPermissionsDocumentResponse
|
|
28812
|
-
});
|
|
28813
29504
|
var GetUserCurrentPermissionsDocumentTool = {
|
|
28814
29505
|
name: "get-user-current-permissions-document",
|
|
28815
29506
|
description: "Gets the current user's document permissions for specific documents",
|
|
28816
29507
|
inputSchema: getUserCurrentPermissionsDocumentQueryParams.shape,
|
|
28817
|
-
outputSchema:
|
|
29508
|
+
outputSchema: getUserCurrentPermissionsDocumentResponse.shape,
|
|
28818
29509
|
annotations: { readOnlyHint: true },
|
|
28819
29510
|
slices: ["permissions"],
|
|
28820
29511
|
handler: (async (params) => {
|
|
@@ -29009,7 +29700,7 @@ var CreateUserDataTool = {
|
|
|
29009
29700
|
validateStatus: () => true
|
|
29010
29701
|
});
|
|
29011
29702
|
if (response.status === 201) {
|
|
29012
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
29703
|
+
const locationHeader = _optionalChain([response, 'access', _140 => _140.headers, 'optionalAccess', _141 => _141["location"]]) || _optionalChain([response, 'access', _142 => _142.headers, 'optionalAccess', _143 => _143["Location"]]);
|
|
29013
29704
|
let createdId = "";
|
|
29014
29705
|
if (locationHeader) {
|
|
29015
29706
|
const idMatch = locationHeader.match(/user-data\/([a-f0-9-]+)$/i);
|
|
@@ -29163,14 +29854,14 @@ var get_user_group_default = _mcpserversdk.withStandardDecorators.call(void 0, G
|
|
|
29163
29854
|
|
|
29164
29855
|
|
|
29165
29856
|
|
|
29166
|
-
var
|
|
29857
|
+
var outputSchema66 = _zod.z.object({
|
|
29167
29858
|
items: getItemUserGroupResponse
|
|
29168
29859
|
});
|
|
29169
29860
|
var GetUserGroupByIdArrayTool = {
|
|
29170
29861
|
name: "get-user-group-by-id-array",
|
|
29171
29862
|
description: "Gets user groups by an array of IDs",
|
|
29172
29863
|
inputSchema: getItemUserGroupQueryParams.shape,
|
|
29173
|
-
outputSchema:
|
|
29864
|
+
outputSchema: outputSchema66.shape,
|
|
29174
29865
|
annotations: { readOnlyHint: true },
|
|
29175
29866
|
slices: ["list"],
|
|
29176
29867
|
handler: (async (params) => {
|
|
@@ -29247,7 +29938,7 @@ var CreateUserGroupTool = {
|
|
|
29247
29938
|
validateStatus: () => true
|
|
29248
29939
|
});
|
|
29249
29940
|
if (response.status === 201) {
|
|
29250
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
29941
|
+
const locationHeader = _optionalChain([response, 'access', _144 => _144.headers, 'optionalAccess', _145 => _145["location"]]) || _optionalChain([response, 'access', _146 => _146.headers, 'optionalAccess', _147 => _147["Location"]]);
|
|
29251
29942
|
let createdId = "";
|
|
29252
29943
|
if (locationHeader) {
|
|
29253
29944
|
const idMatch = locationHeader.match(/user-group\/([a-f0-9-]+)$/i);
|
|
@@ -29391,14 +30082,14 @@ var get_webhook_by_id_default = _mcpserversdk.withStandardDecorators.call(void 0
|
|
|
29391
30082
|
|
|
29392
30083
|
|
|
29393
30084
|
|
|
29394
|
-
var
|
|
30085
|
+
var outputSchema67 = _zod.z.object({
|
|
29395
30086
|
items: getItemWebhookResponse
|
|
29396
30087
|
});
|
|
29397
30088
|
var GetWebhookItemTool = {
|
|
29398
30089
|
name: "get-webhook-item",
|
|
29399
30090
|
description: "Gets webhooks by IDs (or empty array if no IDs are provided)",
|
|
29400
30091
|
inputSchema: getItemWebhookQueryParams.shape,
|
|
29401
|
-
outputSchema:
|
|
30092
|
+
outputSchema: outputSchema67.shape,
|
|
29402
30093
|
annotations: { readOnlyHint: true },
|
|
29403
30094
|
slices: ["list"],
|
|
29404
30095
|
handler: (async (params) => {
|
|
@@ -29545,7 +30236,7 @@ var CreateWebhookTool = {
|
|
|
29545
30236
|
validateStatus: () => true
|
|
29546
30237
|
});
|
|
29547
30238
|
if (response.status === 201) {
|
|
29548
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
30239
|
+
const locationHeader = _optionalChain([response, 'access', _148 => _148.headers, 'optionalAccess', _149 => _149["location"]]) || _optionalChain([response, 'access', _150 => _150.headers, 'optionalAccess', _151 => _151["Location"]]);
|
|
29549
30240
|
let createdId = "";
|
|
29550
30241
|
if (locationHeader) {
|
|
29551
30242
|
const idMatch = locationHeader.match(/webhook\/([a-f0-9-]+)$/i);
|
|
@@ -29782,4 +30473,4 @@ var allSliceNames = [...toolSliceNames, "other"];
|
|
|
29782
30473
|
|
|
29783
30474
|
|
|
29784
30475
|
exports.__commonJS = __commonJS; exports.__toESM = __toESM; exports.UmbracoManagementClient = UmbracoManagementClient3; exports.setAllowFilePathUploads = setAllowFilePathUploads; exports.setUmbracoVersion = setUmbracoVersion; exports.availableCollections = availableCollections; exports.allModes = allModes; exports.allModeNames = allModeNames; exports.allSliceNames = allSliceNames;
|
|
29785
|
-
//# sourceMappingURL=chunk-
|
|
30476
|
+
//# sourceMappingURL=chunk-R2HBS7YH.cjs.map
|