@umbraco-cms/mcp-dev 18.1.7 → 18.1.8
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/dist/{chunk-BVWOXDOS.cjs → chunk-GOS3TR7Z.cjs} +744 -32
- package/dist/chunk-GOS3TR7Z.cjs.map +1 -0
- package/dist/{chunk-66TKBJQ7.js → chunk-O6YXPPS2.js} +1987 -1275
- package/dist/chunk-O6YXPPS2.js.map +1 -0
- package/dist/collections.cjs +2 -2
- package/dist/collections.js +1 -1
- package/dist/index.cjs +320 -235
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +120 -35
- package/dist/index.js.map +1 -1
- package/dist/tool-types.d.ts +151 -0
- package/package.json +3 -3
- 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
|
}
|
|
@@ -22943,10 +23655,10 @@ async function resolveAuth() {
|
|
|
22943
23655
|
);
|
|
22944
23656
|
}
|
|
22945
23657
|
const entry = await _mcphosted.getStoredUmbracoToken.call(void 0, authContext.env.OAUTH_KV, authContext.tokenKey);
|
|
22946
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
23658
|
+
if (!_optionalChain([entry, 'optionalAccess', _70 => _70.tokens, 'optionalAccess', _71 => _71.access_token])) {
|
|
22947
23659
|
throw new Error("No Umbraco access token in KV. Reconnect the MCP connector.");
|
|
22948
23660
|
}
|
|
22949
|
-
const baseUrl = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([entry, 'access',
|
|
23661
|
+
const baseUrl = _nullishCoalesce(_nullishCoalesce(_nullishCoalesce(_optionalChain([entry, 'access', _72 => _72.site, 'optionalAccess', _73 => _73.serverUrl]), () => ( _optionalChain([entry, 'access', _74 => _74.site, 'optionalAccess', _75 => _75.baseUrl]))), () => ( authContext.env.UMBRACO_SERVER_URL)), () => ( authContext.env.UMBRACO_BASE_URL));
|
|
22950
23662
|
if (!baseUrl) {
|
|
22951
23663
|
throw new Error("No Umbraco base URL resolvable from site or env.");
|
|
22952
23664
|
}
|
|
@@ -22954,7 +23666,7 @@ async function resolveAuth() {
|
|
|
22954
23666
|
}
|
|
22955
23667
|
function ensureExtension(name, contentType, urlPath) {
|
|
22956
23668
|
if (name.includes(".")) return name;
|
|
22957
|
-
const fromUrl = _optionalChain([urlPath, 'access',
|
|
23669
|
+
const fromUrl = _optionalChain([urlPath, 'access', _76 => _76.match, 'call', _77 => _77(/\.([a-z0-9]{1,8})$/i), 'optionalAccess', _78 => _78[0]]);
|
|
22958
23670
|
if (fromUrl) return `${name}${fromUrl}`;
|
|
22959
23671
|
if (contentType) {
|
|
22960
23672
|
const subtype = contentType.split(";")[0].split("/")[1];
|
|
@@ -23063,8 +23775,8 @@ Content-Type: ${sourceContentType}\r
|
|
|
23063
23775
|
if (response.status < 200 || response.status >= 300) {
|
|
23064
23776
|
throw new Error(`postMedia failed with status ${response.status}`);
|
|
23065
23777
|
}
|
|
23066
|
-
const locationHeader = _nullishCoalesce(_optionalChain([response, 'access',
|
|
23067
|
-
const idMatch = _optionalChain([locationHeader, 'optionalAccess',
|
|
23778
|
+
const locationHeader = _nullishCoalesce(_optionalChain([response, 'access', _79 => _79.headers, 'optionalAccess', _80 => _80.location]), () => ( _optionalChain([response, 'access', _81 => _81.headers, 'optionalAccess', _82 => _82.Location])));
|
|
23779
|
+
const idMatch = _optionalChain([locationHeader, 'optionalAccess', _83 => _83.match, 'call', _84 => _84(/\/([a-f0-9-]{36})$/i)]);
|
|
23068
23780
|
if (!idMatch) {
|
|
23069
23781
|
throw new Error(
|
|
23070
23782
|
`Could not extract media id from Location header: ${_nullishCoalesce(locationHeader, () => ( "(missing)"))}`
|
|
@@ -23169,7 +23881,7 @@ ${filePathSection}
|
|
|
23169
23881
|
let effectiveSourceType;
|
|
23170
23882
|
let effectiveFileUrl = model.fileUrl;
|
|
23171
23883
|
if (model.sourceType === "file") {
|
|
23172
|
-
if (!_optionalChain([model, 'access',
|
|
23884
|
+
if (!_optionalChain([model, 'access', _85 => _85.file, 'optionalAccess', _86 => _86.download_url])) {
|
|
23173
23885
|
return _mcpserversdk.createToolResultError.call(void 0, {
|
|
23174
23886
|
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
23887
|
});
|
|
@@ -23318,7 +24030,7 @@ ${filePathSection}
|
|
|
23318
24030
|
let effectiveSourceType;
|
|
23319
24031
|
let effectiveFileUrl = file.fileUrl;
|
|
23320
24032
|
if (model.sourceType === "file") {
|
|
23321
|
-
if (!_optionalChain([file, 'access',
|
|
24033
|
+
if (!_optionalChain([file, 'access', _87 => _87.file, 'optionalAccess', _88 => _88.download_url])) {
|
|
23322
24034
|
return {
|
|
23323
24035
|
success: false,
|
|
23324
24036
|
name: file.name,
|
|
@@ -23417,7 +24129,7 @@ var CreateMediaFolderTool = {
|
|
|
23417
24129
|
if (response.status < 200 || response.status >= 300) {
|
|
23418
24130
|
throw new Error(`Request failed with status code ${response.status}`);
|
|
23419
24131
|
}
|
|
23420
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
24132
|
+
const locationHeader = _optionalChain([response, 'access', _89 => _89.headers, 'optionalAccess', _90 => _90.location]) || _optionalChain([response, 'access', _91 => _91.headers, 'optionalAccess', _92 => _92.Location]);
|
|
23421
24133
|
if (!locationHeader) {
|
|
23422
24134
|
throw new Error("No Location header in response - cannot determine created folder ID");
|
|
23423
24135
|
}
|
|
@@ -24703,7 +25415,7 @@ var CreateMediaTypeFolderTool = {
|
|
|
24703
25415
|
validateStatus: () => true
|
|
24704
25416
|
});
|
|
24705
25417
|
if (response.status === 201) {
|
|
24706
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25418
|
+
const locationHeader = _optionalChain([response, 'access', _93 => _93.headers, 'optionalAccess', _94 => _94["location"]]) || _optionalChain([response, 'access', _95 => _95.headers, 'optionalAccess', _96 => _96["Location"]]);
|
|
24707
25419
|
let createdId = model.id || "";
|
|
24708
25420
|
if (locationHeader) {
|
|
24709
25421
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -24838,7 +25550,7 @@ var CreateMediaTypeTool = {
|
|
|
24838
25550
|
validateStatus: () => true
|
|
24839
25551
|
});
|
|
24840
25552
|
if (response.status === 201) {
|
|
24841
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25553
|
+
const locationHeader = _optionalChain([response, 'access', _97 => _97.headers, 'optionalAccess', _98 => _98["location"]]) || _optionalChain([response, 'access', _99 => _99.headers, 'optionalAccess', _100 => _100["Location"]]);
|
|
24842
25554
|
let createdId = model.id || "";
|
|
24843
25555
|
if (locationHeader) {
|
|
24844
25556
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -24889,7 +25601,7 @@ var CopyMediaTypeTool = {
|
|
|
24889
25601
|
validateStatus: () => true
|
|
24890
25602
|
});
|
|
24891
25603
|
if (response.status === 201) {
|
|
24892
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25604
|
+
const locationHeader = _optionalChain([response, 'access', _101 => _101.headers, 'optionalAccess', _102 => _102["location"]]) || _optionalChain([response, 'access', _103 => _103.headers, 'optionalAccess', _104 => _104["Location"]]);
|
|
24893
25605
|
let createdId = "";
|
|
24894
25606
|
if (locationHeader) {
|
|
24895
25607
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -25099,7 +25811,7 @@ var CreateMemberTool = {
|
|
|
25099
25811
|
validateStatus: () => true
|
|
25100
25812
|
});
|
|
25101
25813
|
if (response.status === 201) {
|
|
25102
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25814
|
+
const locationHeader = _optionalChain([response, 'access', _105 => _105.headers, 'optionalAccess', _106 => _106["location"]]) || _optionalChain([response, 'access', _107 => _107.headers, 'optionalAccess', _108 => _108["Location"]]);
|
|
25103
25815
|
let createdId = model.id || "";
|
|
25104
25816
|
if (locationHeader) {
|
|
25105
25817
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -25648,7 +26360,7 @@ var CreateMemberTypeTool = {
|
|
|
25648
26360
|
validateStatus: () => true
|
|
25649
26361
|
});
|
|
25650
26362
|
if (response.status === 201) {
|
|
25651
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
26363
|
+
const locationHeader = _optionalChain([response, 'access', _109 => _109.headers, 'optionalAccess', _110 => _110["location"]]) || _optionalChain([response, 'access', _111 => _111.headers, 'optionalAccess', _112 => _112["Location"]]);
|
|
25652
26364
|
let createdId = model.id || "";
|
|
25653
26365
|
if (locationHeader) {
|
|
25654
26366
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -25818,7 +26530,7 @@ var CopyMemberTypeTool = {
|
|
|
25818
26530
|
validateStatus: () => true
|
|
25819
26531
|
});
|
|
25820
26532
|
if (response.status === 201) {
|
|
25821
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
26533
|
+
const locationHeader = _optionalChain([response, 'access', _113 => _113.headers, 'optionalAccess', _114 => _114["location"]]) || _optionalChain([response, 'access', _115 => _115.headers, 'optionalAccess', _116 => _116["Location"]]);
|
|
25822
26534
|
let createdId = "";
|
|
25823
26535
|
if (locationHeader) {
|
|
25824
26536
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -26178,7 +26890,7 @@ var CreatePartialViewTool = {
|
|
|
26178
26890
|
validateStatus: () => true
|
|
26179
26891
|
});
|
|
26180
26892
|
if (response.status === 201) {
|
|
26181
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
26893
|
+
const locationHeader = _optionalChain([response, 'access', _117 => _117.headers, 'optionalAccess', _118 => _118["location"]]) || _optionalChain([response, 'access', _119 => _119.headers, 'optionalAccess', _120 => _120["Location"]]);
|
|
26182
26894
|
let createdPath = "";
|
|
26183
26895
|
if (locationHeader) {
|
|
26184
26896
|
const pathMatch = locationHeader.match(/partial-view\/(.+)$/);
|
|
@@ -26225,7 +26937,7 @@ var CreatePartialViewFolderTool = {
|
|
|
26225
26937
|
validateStatus: () => true
|
|
26226
26938
|
});
|
|
26227
26939
|
if (response.status === 201) {
|
|
26228
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
26940
|
+
const locationHeader = _optionalChain([response, 'access', _121 => _121.headers, 'optionalAccess', _122 => _122["location"]]) || _optionalChain([response, 'access', _123 => _123.headers, 'optionalAccess', _124 => _124["Location"]]);
|
|
26229
26941
|
let createdPath = "";
|
|
26230
26942
|
if (locationHeader) {
|
|
26231
26943
|
const pathMatch = locationHeader.match(/partial-view\/folder\/(.+)$/);
|
|
@@ -27022,7 +27734,7 @@ var CreateScriptTool = {
|
|
|
27022
27734
|
validateStatus: () => true
|
|
27023
27735
|
});
|
|
27024
27736
|
if (response.status === 201) {
|
|
27025
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
27737
|
+
const locationHeader = _optionalChain([response, 'access', _125 => _125.headers, 'optionalAccess', _126 => _126["location"]]) || _optionalChain([response, 'access', _127 => _127.headers, 'optionalAccess', _128 => _128["Location"]]);
|
|
27026
27738
|
let createdPath = "";
|
|
27027
27739
|
if (locationHeader) {
|
|
27028
27740
|
const pathMatch = locationHeader.match(/script\/(.+)$/);
|
|
@@ -27069,7 +27781,7 @@ var CreateScriptFolderTool = {
|
|
|
27069
27781
|
validateStatus: () => true
|
|
27070
27782
|
});
|
|
27071
27783
|
if (response.status === 201) {
|
|
27072
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
27784
|
+
const locationHeader = _optionalChain([response, 'access', _129 => _129.headers, 'optionalAccess', _130 => _130["location"]]) || _optionalChain([response, 'access', _131 => _131.headers, 'optionalAccess', _132 => _132["Location"]]);
|
|
27073
27785
|
let createdPath = "";
|
|
27074
27786
|
if (locationHeader) {
|
|
27075
27787
|
const pathMatch = locationHeader.match(/script\/folder\/(.+)$/);
|
|
@@ -27666,7 +28378,7 @@ var CreateStylesheetTool = {
|
|
|
27666
28378
|
validateStatus: () => true
|
|
27667
28379
|
});
|
|
27668
28380
|
if (response.status === 201) {
|
|
27669
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
28381
|
+
const locationHeader = _optionalChain([response, 'access', _133 => _133.headers, 'optionalAccess', _134 => _134["location"]]) || _optionalChain([response, 'access', _135 => _135.headers, 'optionalAccess', _136 => _136["Location"]]);
|
|
27670
28382
|
let createdPath = "";
|
|
27671
28383
|
if (locationHeader) {
|
|
27672
28384
|
const pathMatch = locationHeader.match(/stylesheet\/(.+)$/);
|
|
@@ -27713,7 +28425,7 @@ var CreateStylesheetFolderTool = {
|
|
|
27713
28425
|
validateStatus: () => true
|
|
27714
28426
|
});
|
|
27715
28427
|
if (response.status === 201) {
|
|
27716
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
28428
|
+
const locationHeader = _optionalChain([response, 'access', _137 => _137.headers, 'optionalAccess', _138 => _138["location"]]) || _optionalChain([response, 'access', _139 => _139.headers, 'optionalAccess', _140 => _140["Location"]]);
|
|
27717
28429
|
let createdPath = "";
|
|
27718
28430
|
if (locationHeader) {
|
|
27719
28431
|
const pathMatch = locationHeader.match(/stylesheet\/folder\/(.+)$/);
|
|
@@ -28077,7 +28789,7 @@ var CreateTemplateTool = {
|
|
|
28077
28789
|
validateStatus: () => true
|
|
28078
28790
|
});
|
|
28079
28791
|
if (response.status === 201) {
|
|
28080
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
28792
|
+
const locationHeader = _optionalChain([response, 'access', _141 => _141.headers, 'optionalAccess', _142 => _142["location"]]) || _optionalChain([response, 'access', _143 => _143.headers, 'optionalAccess', _144 => _144["Location"]]);
|
|
28081
28793
|
let createdId = "";
|
|
28082
28794
|
if (locationHeader) {
|
|
28083
28795
|
const idMatch = locationHeader.match(/template\/([a-f0-9-]+)$/i);
|
|
@@ -29009,7 +29721,7 @@ var CreateUserDataTool = {
|
|
|
29009
29721
|
validateStatus: () => true
|
|
29010
29722
|
});
|
|
29011
29723
|
if (response.status === 201) {
|
|
29012
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
29724
|
+
const locationHeader = _optionalChain([response, 'access', _145 => _145.headers, 'optionalAccess', _146 => _146["location"]]) || _optionalChain([response, 'access', _147 => _147.headers, 'optionalAccess', _148 => _148["Location"]]);
|
|
29013
29725
|
let createdId = "";
|
|
29014
29726
|
if (locationHeader) {
|
|
29015
29727
|
const idMatch = locationHeader.match(/user-data\/([a-f0-9-]+)$/i);
|
|
@@ -29247,7 +29959,7 @@ var CreateUserGroupTool = {
|
|
|
29247
29959
|
validateStatus: () => true
|
|
29248
29960
|
});
|
|
29249
29961
|
if (response.status === 201) {
|
|
29250
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
29962
|
+
const locationHeader = _optionalChain([response, 'access', _149 => _149.headers, 'optionalAccess', _150 => _150["location"]]) || _optionalChain([response, 'access', _151 => _151.headers, 'optionalAccess', _152 => _152["Location"]]);
|
|
29251
29963
|
let createdId = "";
|
|
29252
29964
|
if (locationHeader) {
|
|
29253
29965
|
const idMatch = locationHeader.match(/user-group\/([a-f0-9-]+)$/i);
|
|
@@ -29545,7 +30257,7 @@ var CreateWebhookTool = {
|
|
|
29545
30257
|
validateStatus: () => true
|
|
29546
30258
|
});
|
|
29547
30259
|
if (response.status === 201) {
|
|
29548
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
30260
|
+
const locationHeader = _optionalChain([response, 'access', _153 => _153.headers, 'optionalAccess', _154 => _154["location"]]) || _optionalChain([response, 'access', _155 => _155.headers, 'optionalAccess', _156 => _156["Location"]]);
|
|
29549
30261
|
let createdId = "";
|
|
29550
30262
|
if (locationHeader) {
|
|
29551
30263
|
const idMatch = locationHeader.match(/webhook\/([a-f0-9-]+)$/i);
|
|
@@ -29782,4 +30494,4 @@ var allSliceNames = [...toolSliceNames, "other"];
|
|
|
29782
30494
|
|
|
29783
30495
|
|
|
29784
30496
|
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-
|
|
30497
|
+
//# sourceMappingURL=chunk-GOS3TR7Z.cjs.map
|