@umbraco-cms/mcp-dev 17.8.0 → 17.8.1
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-3Y7ABEM5.cjs → chunk-JXXGY3HS.cjs} +399 -58
- package/dist/chunk-JXXGY3HS.cjs.map +1 -0
- package/dist/{chunk-CNSTSNMN.js → chunk-SELP32TD.js} +2148 -1807
- package/dist/chunk-SELP32TD.js.map +1 -0
- package/dist/collections.cjs +2 -2
- package/dist/collections.js +1 -1
- package/dist/index.cjs +154 -154
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/tool-types.d.ts +93 -0
- package/package.json +3 -3
- package/dist/chunk-3Y7ABEM5.cjs.map +0 -1
- package/dist/chunk-CNSTSNMN.js.map +0 -1
|
@@ -15619,7 +15619,13 @@ var PublishDocumentWithDescendantsTool = {
|
|
|
15619
15619
|
description: `Publishes a document and its descendants by Id. This is an asynchronous operation that may take time for large document trees.
|
|
15620
15620
|
The tool polls for completion for up to 60 seconds. If the publish is still running or ambiguous when that limit is reached, follow up with get-document-publish-with-descendants-result using the returned taskId.`,
|
|
15621
15621
|
inputSchema: inputSchema12,
|
|
15622
|
-
annotations: {
|
|
15622
|
+
annotations: {
|
|
15623
|
+
// Unlike the other document put/ tools, this one starts a new async,
|
|
15624
|
+
// recursive publish task on every call rather than converging to the
|
|
15625
|
+
// same end state — a retried call fires a second concurrent job over
|
|
15626
|
+
// the same subtree, so it is not safe to advertise as idempotent.
|
|
15627
|
+
idempotentHint: false
|
|
15628
|
+
},
|
|
15623
15629
|
slices: ["publish"],
|
|
15624
15630
|
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Publish),
|
|
15625
15631
|
handler: (async (model) => {
|
|
@@ -15711,7 +15717,9 @@ var UnpublishDocumentTool = {
|
|
|
15711
15717
|
name: "unpublish-document",
|
|
15712
15718
|
description: "Unpublishes a document by Id.",
|
|
15713
15719
|
inputSchema: inputSchema13,
|
|
15714
|
-
annotations: {
|
|
15720
|
+
annotations: {
|
|
15721
|
+
idempotentHint: true
|
|
15722
|
+
},
|
|
15715
15723
|
slices: ["publish"],
|
|
15716
15724
|
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Unpublish),
|
|
15717
15725
|
handler: (async (model) => {
|
|
@@ -15733,7 +15741,9 @@ var SortDocumentTool = {
|
|
|
15733
15741
|
name: "sort-document",
|
|
15734
15742
|
description: "Sorts the order of documents under a parent.",
|
|
15735
15743
|
inputSchema: putDocumentSortBody.shape,
|
|
15736
|
-
annotations: {
|
|
15744
|
+
annotations: {
|
|
15745
|
+
idempotentHint: true
|
|
15746
|
+
},
|
|
15737
15747
|
slices: ["sort"],
|
|
15738
15748
|
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Sort),
|
|
15739
15749
|
handler: (async (model) => {
|
|
@@ -15763,7 +15773,9 @@ var SortDocumentChildrenTool = {
|
|
|
15763
15773
|
|
|
15764
15774
|
When sorting by Name, an optional culture selects which variant name to sort by; the culture is not validated, so children that do not vary by it (or an unrecognised culture) fall back to the invariant name.`,
|
|
15765
15775
|
inputSchema: inputSchema14,
|
|
15766
|
-
annotations: {
|
|
15776
|
+
annotations: {
|
|
15777
|
+
idempotentHint: true
|
|
15778
|
+
},
|
|
15767
15779
|
slices: ["sort"],
|
|
15768
15780
|
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Sort),
|
|
15769
15781
|
handler: (async (model) => {
|
|
@@ -15788,7 +15800,9 @@ var SortDocumentRootChildrenTool = {
|
|
|
15788
15800
|
|
|
15789
15801
|
When sorting by Name, an optional culture selects which variant name to sort by; the culture is not validated, so documents that do not vary by it (or an unrecognised culture) fall back to the invariant name.`,
|
|
15790
15802
|
inputSchema: putDocumentRootSortChildrenBody.shape,
|
|
15791
|
-
annotations: {
|
|
15803
|
+
annotations: {
|
|
15804
|
+
idempotentHint: true
|
|
15805
|
+
},
|
|
15792
15806
|
slices: ["sort"],
|
|
15793
15807
|
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Sort),
|
|
15794
15808
|
handler: (async (model) => {
|
|
@@ -15814,7 +15828,9 @@ var MoveDocumentTool = {
|
|
|
15814
15828
|
name: "move-document",
|
|
15815
15829
|
description: "Move a document to a new location",
|
|
15816
15830
|
inputSchema: inputSchema15,
|
|
15817
|
-
annotations: {
|
|
15831
|
+
annotations: {
|
|
15832
|
+
idempotentHint: true
|
|
15833
|
+
},
|
|
15818
15834
|
slices: ["move"],
|
|
15819
15835
|
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Move),
|
|
15820
15836
|
handler: (async (model) => {
|
|
@@ -15843,7 +15859,9 @@ var PublishDocumentTool = {
|
|
|
15843
15859
|
When the culture is not provided, the default culture is null.
|
|
15844
15860
|
When the schedule is not provided, the default schedule is null.`,
|
|
15845
15861
|
inputSchema: inputSchema16,
|
|
15846
|
-
annotations: {
|
|
15862
|
+
annotations: {
|
|
15863
|
+
idempotentHint: true
|
|
15864
|
+
},
|
|
15847
15865
|
slices: ["publish"],
|
|
15848
15866
|
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Publish),
|
|
15849
15867
|
handler: (async (model) => {
|
|
@@ -15890,7 +15908,9 @@ var RestoreFromRecycleBinTool = {
|
|
|
15890
15908
|
name: "restore-document-from-recycle-bin",
|
|
15891
15909
|
description: "Restores a document from the recycle bin.",
|
|
15892
15910
|
inputSchema: putRecycleBinDocumentByIdRestoreParams.shape,
|
|
15893
|
-
annotations: {
|
|
15911
|
+
annotations: {
|
|
15912
|
+
idempotentHint: true
|
|
15913
|
+
},
|
|
15894
15914
|
slices: ["move", "recycle-bin"],
|
|
15895
15915
|
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Delete),
|
|
15896
15916
|
handler: (async ({ id }) => {
|
|
@@ -15911,7 +15931,9 @@ var MoveDocumentToRecycleBinTool = {
|
|
|
15911
15931
|
name: "move-document-to-recycle-bin",
|
|
15912
15932
|
description: "Move a document to the recycle bin",
|
|
15913
15933
|
inputSchema: putDocumentByIdMoveToRecycleBinParams.shape,
|
|
15914
|
-
annotations: {
|
|
15934
|
+
annotations: {
|
|
15935
|
+
idempotentHint: true
|
|
15936
|
+
},
|
|
15915
15937
|
slices: ["move", "recycle-bin"],
|
|
15916
15938
|
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Delete),
|
|
15917
15939
|
handler: (async ({ id }) => {
|
|
@@ -15990,6 +16012,34 @@ var UpdateDocumentTool = {
|
|
|
15990
16012
|
};
|
|
15991
16013
|
var update_document_default = _mcpserversdk.withStandardDecorators.call(void 0, UpdateDocumentTool);
|
|
15992
16014
|
|
|
16015
|
+
// src/umbraco-api/tools/document/put/validate-document-update.ts
|
|
16016
|
+
|
|
16017
|
+
|
|
16018
|
+
|
|
16019
|
+
|
|
16020
|
+
|
|
16021
|
+
|
|
16022
|
+
var validateDocumentUpdateSchema = {
|
|
16023
|
+
id: _zod.z.string().uuid(),
|
|
16024
|
+
data: _zod.z.object(putDocumentByIdValidateBody.shape)
|
|
16025
|
+
};
|
|
16026
|
+
var ValidateDocumentUpdateTool = {
|
|
16027
|
+
name: "validate-document-update",
|
|
16028
|
+
description: "Validates changes to an existing document, using the Umbraco API (PUT, does not persist changes). Use this instead of validate-document when validating an update to a document that already exists - it only requires Update permission on the document, not Create permission on its parent.",
|
|
16029
|
+
inputSchema: validateDocumentUpdateSchema,
|
|
16030
|
+
annotations: {
|
|
16031
|
+
readOnlyHint: true
|
|
16032
|
+
},
|
|
16033
|
+
slices: ["validate"],
|
|
16034
|
+
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Update),
|
|
16035
|
+
handler: (async (model) => {
|
|
16036
|
+
return _mcpserversdk.executeVoidApiCall.call(void 0,
|
|
16037
|
+
(client) => client.putDocumentByIdValidate(model.id, model.data, _mcpserversdk.CAPTURE_RAW_HTTP_RESPONSE)
|
|
16038
|
+
);
|
|
16039
|
+
})
|
|
16040
|
+
};
|
|
16041
|
+
var validate_document_update_default = _mcpserversdk.withStandardDecorators.call(void 0, ValidateDocumentUpdateTool);
|
|
16042
|
+
|
|
15993
16043
|
// src/umbraco-api/tools/document/put/update-and-publish-document.ts
|
|
15994
16044
|
|
|
15995
16045
|
|
|
@@ -17165,17 +17215,17 @@ function checkAllowedInArea(blockConfig, area) {
|
|
|
17165
17215
|
|
|
17166
17216
|
// src/umbraco-api/tools/document/put/helpers/document-block-context.ts
|
|
17167
17217
|
|
|
17168
|
-
async function
|
|
17218
|
+
async function resolveBlockPropertyContext(owner, model) {
|
|
17169
17219
|
const client = UmbracoManagementClient3.getClient();
|
|
17170
|
-
const
|
|
17171
|
-
const
|
|
17172
|
-
const propertyDefinition =
|
|
17220
|
+
const { values } = owner;
|
|
17221
|
+
const contentTypeProperties = await getAllDocumentTypeProperties(owner.contentTypeId);
|
|
17222
|
+
const propertyDefinition = contentTypeProperties.find((p) => p.alias === model.propertyAlias);
|
|
17173
17223
|
if (!propertyDefinition) {
|
|
17174
17224
|
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
17175
17225
|
title: "Property not found",
|
|
17176
|
-
detail: `Property '${model.propertyAlias}' does not exist on this
|
|
17226
|
+
detail: `Property '${model.propertyAlias}' does not exist on this ${owner.ownerLabel}'s type`,
|
|
17177
17227
|
extensions: {
|
|
17178
|
-
availableProperties:
|
|
17228
|
+
availableProperties: contentTypeProperties.map((p) => p.alias)
|
|
17179
17229
|
}
|
|
17180
17230
|
});
|
|
17181
17231
|
}
|
|
@@ -17194,7 +17244,7 @@ async function loadDocumentBlockContext(model) {
|
|
|
17194
17244
|
detail: `Property '${model.propertyAlias}' uses editor '${dataType.editorAlias}', not a BlockList, BlockGrid, or RichText editor`
|
|
17195
17245
|
});
|
|
17196
17246
|
}
|
|
17197
|
-
let valueEntry =
|
|
17247
|
+
let valueEntry = values.find(
|
|
17198
17248
|
(v) => matchesProperty(v, model.propertyAlias, model.culture, model.segment)
|
|
17199
17249
|
);
|
|
17200
17250
|
if (!valueEntry) {
|
|
@@ -17205,7 +17255,7 @@ async function loadDocumentBlockContext(model) {
|
|
|
17205
17255
|
editorAlias: dataType.editorAlias,
|
|
17206
17256
|
value: null
|
|
17207
17257
|
};
|
|
17208
|
-
|
|
17258
|
+
values.push(valueEntry);
|
|
17209
17259
|
}
|
|
17210
17260
|
if (valueEntry.value === null || valueEntry.value === void 0 || valueEntry.value === "") {
|
|
17211
17261
|
valueEntry.value = createEmptyBlockValue(kind);
|
|
@@ -17222,7 +17272,6 @@ async function loadDocumentBlockContext(model) {
|
|
|
17222
17272
|
});
|
|
17223
17273
|
}
|
|
17224
17274
|
return {
|
|
17225
|
-
document,
|
|
17226
17275
|
propertyDefinition,
|
|
17227
17276
|
kind,
|
|
17228
17277
|
propertyValue,
|
|
@@ -17230,6 +17279,15 @@ async function loadDocumentBlockContext(model) {
|
|
|
17230
17279
|
blockConfigs: getBlockTypeConfigurations(dataType.values)
|
|
17231
17280
|
};
|
|
17232
17281
|
}
|
|
17282
|
+
async function loadDocumentBlockContext(model) {
|
|
17283
|
+
const client = UmbracoManagementClient3.getClient();
|
|
17284
|
+
const document = await client.getDocumentById(model.documentId);
|
|
17285
|
+
const context = await resolveBlockPropertyContext(
|
|
17286
|
+
{ values: document.values, contentTypeId: document.documentType.id, ownerLabel: "document" },
|
|
17287
|
+
model
|
|
17288
|
+
);
|
|
17289
|
+
return { document, ...context };
|
|
17290
|
+
}
|
|
17233
17291
|
async function saveDocumentValues(documentId, document) {
|
|
17234
17292
|
const client = UmbracoManagementClient3.getClient();
|
|
17235
17293
|
const values = document.values.map((v) => ({
|
|
@@ -17257,7 +17315,10 @@ async function saveDocumentValues(documentId, document) {
|
|
|
17257
17315
|
|
|
17258
17316
|
|
|
17259
17317
|
|
|
17260
|
-
var
|
|
17318
|
+
var blockEditorKindSchema = _zod.z.enum(["BlockList", "BlockGrid", "RichText"]);
|
|
17319
|
+
var createDocumentBlockOutputSchema = updateBlockPropertyOutputSchema.extend({
|
|
17320
|
+
kind: blockEditorKindSchema
|
|
17321
|
+
});
|
|
17261
17322
|
var blockPropertyValueSchema = _zod.z.object({
|
|
17262
17323
|
alias: _zod.z.string().min(1).describe("The property alias on the block's element type"),
|
|
17263
17324
|
value: _zod.z.any().nullish().describe("The property value"),
|
|
@@ -17291,7 +17352,8 @@ var createDocumentBlockSchema = {
|
|
|
17291
17352
|
properties: _zod.z.array(blockPropertyValueSchema).describe("Settings property values")
|
|
17292
17353
|
}).optional().describe("Settings for the new block; the settings element type comes from the data type configuration. When the block type has a settings element type, a settings entry is always created (empty if this is omitted), as the backoffice does"),
|
|
17293
17354
|
placement: placementSchema.optional().describe("Where to place the block relative to siblings (default: append)"),
|
|
17294
|
-
grid: gridSchema.optional().describe("BlockGrid-only layout options. Rejected for BlockList/RichText properties")
|
|
17355
|
+
grid: gridSchema.optional().describe("BlockGrid-only layout options. Rejected for BlockList/RichText properties"),
|
|
17356
|
+
expectedKind: blockEditorKindSchema.optional().describe("Optional guard: the editor the property must use. If the property uses a different editor, nothing is written and the call is rejected")
|
|
17295
17357
|
};
|
|
17296
17358
|
async function validateBlockProperties(elementTypeKey, properties, label) {
|
|
17297
17359
|
if (properties.length === 0) {
|
|
@@ -17338,7 +17400,9 @@ var CreateDocumentBlockTool = {
|
|
|
17338
17400
|
or the named area given in grid.
|
|
17339
17401
|
- grid (BlockGrid only): columnSpan (default 12), rowSpan (default 1), and areaKey + parentContentKey
|
|
17340
17402
|
to insert into a named area of an existing block.
|
|
17341
|
-
-
|
|
17403
|
+
- expectedKind (optional): "BlockList" | "BlockGrid" | "RichText". When given, the call is rejected
|
|
17404
|
+
without writing anything if the property uses a different editor.
|
|
17405
|
+
- New block keys are generated; the result returns the new contentKey and the property's editor kind.
|
|
17342
17406
|
- The document is saved, not published.
|
|
17343
17407
|
|
|
17344
17408
|
Example: { documentId: "...", propertyAlias: "mainContent", contentTypeKey: "...",
|
|
@@ -17357,6 +17421,12 @@ var CreateDocumentBlockTool = {
|
|
|
17357
17421
|
const placement = _nullishCoalesce(model.placement, () => ( { position: "append" }));
|
|
17358
17422
|
const contentProperties = _nullishCoalesce(model.properties, () => ( []));
|
|
17359
17423
|
const settingsProperties = _nullishCoalesce(_optionalChain([model, 'access', _38 => _38.settings, 'optionalAccess', _39 => _39.properties]), () => ( []));
|
|
17424
|
+
if (model.expectedKind && kind !== model.expectedKind) {
|
|
17425
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
17426
|
+
title: "Unexpected block editor",
|
|
17427
|
+
detail: `Property '${model.propertyAlias}' is a ${kind} property, not ${model.expectedKind}`
|
|
17428
|
+
});
|
|
17429
|
+
}
|
|
17360
17430
|
if (model.grid && kind !== "BlockGrid") {
|
|
17361
17431
|
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
17362
17432
|
title: "grid options not supported",
|
|
@@ -17531,6 +17601,7 @@ var CreateDocumentBlockTool = {
|
|
|
17531
17601
|
return _mcpserversdk.createToolResult.call(void 0, {
|
|
17532
17602
|
success: true,
|
|
17533
17603
|
message: `Created 1 block in ${kind} property '${getPropertyKey(model.propertyAlias, model.culture, model.segment)}'`,
|
|
17604
|
+
kind,
|
|
17534
17605
|
results: [{
|
|
17535
17606
|
success: true,
|
|
17536
17607
|
contentKey,
|
|
@@ -17631,6 +17702,274 @@ var DeleteDocumentBlockTool = {
|
|
|
17631
17702
|
};
|
|
17632
17703
|
var delete_document_block_default = _mcpserversdk.withStandardDecorators.call(void 0, DeleteDocumentBlockTool);
|
|
17633
17704
|
|
|
17705
|
+
// src/umbraco-api/tools/document/put/move-document-block.ts
|
|
17706
|
+
|
|
17707
|
+
|
|
17708
|
+
// src/umbraco-api/tools/document/put/helpers/block-move.ts
|
|
17709
|
+
|
|
17710
|
+
function describeContainer(location) {
|
|
17711
|
+
return location.parent ? `area '${location.areaKey}' of block '${location.parent.contentKey}'` : "the root of the property";
|
|
17712
|
+
}
|
|
17713
|
+
function blockNotFoundError(contentKey, propertyKey, availableKeys) {
|
|
17714
|
+
return new (0, _mcpserversdk.ToolValidationError)({
|
|
17715
|
+
title: "Block not found",
|
|
17716
|
+
detail: `No block with contentKey '${contentKey}' exists in property '${propertyKey}'`,
|
|
17717
|
+
extensions: { availableContentKeys: availableKeys }
|
|
17718
|
+
});
|
|
17719
|
+
}
|
|
17720
|
+
function collectAllLayoutKeys(items) {
|
|
17721
|
+
const keys = [];
|
|
17722
|
+
for (const item of items) {
|
|
17723
|
+
keys.push(item.contentKey);
|
|
17724
|
+
for (const area of _nullishCoalesce(item.areas, () => ( []))) {
|
|
17725
|
+
keys.push(...collectAllLayoutKeys(_nullishCoalesce(area.items, () => ( []))));
|
|
17726
|
+
}
|
|
17727
|
+
}
|
|
17728
|
+
return keys;
|
|
17729
|
+
}
|
|
17730
|
+
function reorderKeys(order, contentKey, target) {
|
|
17731
|
+
const without = order.filter((k) => k !== contentKey);
|
|
17732
|
+
switch (target.position) {
|
|
17733
|
+
case "first":
|
|
17734
|
+
return [contentKey, ...without];
|
|
17735
|
+
case "last":
|
|
17736
|
+
return [...without, contentKey];
|
|
17737
|
+
case "before":
|
|
17738
|
+
case "after": {
|
|
17739
|
+
if (target.relativeToContentKey === contentKey) {
|
|
17740
|
+
return [...order];
|
|
17741
|
+
}
|
|
17742
|
+
const index = without.indexOf(target.relativeToContentKey);
|
|
17743
|
+
const insertAt = target.position === "before" ? index : index + 1;
|
|
17744
|
+
return [...without.slice(0, insertAt), contentKey, ...without.slice(insertAt)];
|
|
17745
|
+
}
|
|
17746
|
+
}
|
|
17747
|
+
}
|
|
17748
|
+
function sameOrder(a, b) {
|
|
17749
|
+
return a.length === b.length && a.every((k, i) => k === b[i]);
|
|
17750
|
+
}
|
|
17751
|
+
function moveLayoutBlock(layoutItems, contentKey, target, propertyKey) {
|
|
17752
|
+
const location = findLayoutLocation(layoutItems, contentKey);
|
|
17753
|
+
if (!location) {
|
|
17754
|
+
throw blockNotFoundError(contentKey, propertyKey, collectAllLayoutKeys(layoutItems));
|
|
17755
|
+
}
|
|
17756
|
+
const containerItems = location.items;
|
|
17757
|
+
const currentOrder = containerItems.map((i) => i.contentKey);
|
|
17758
|
+
if (target.position === "before" || target.position === "after") {
|
|
17759
|
+
const relativeKey = target.relativeToContentKey;
|
|
17760
|
+
if (!currentOrder.includes(relativeKey)) {
|
|
17761
|
+
const relativeLocation = findLayoutLocation(layoutItems, relativeKey);
|
|
17762
|
+
if (relativeLocation) {
|
|
17763
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
17764
|
+
title: "Target in a different container",
|
|
17765
|
+
detail: `Block '${relativeKey}' is in ${describeContainer(relativeLocation)}, but block '${contentKey}' is in ${describeContainer(location)}. Blocks can only be moved within their own container; moving between BlockGrid areas, or into or out of an area, is not supported.`,
|
|
17766
|
+
extensions: { blocksInSameContainer: currentOrder }
|
|
17767
|
+
});
|
|
17768
|
+
}
|
|
17769
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
17770
|
+
title: "Relative block not found",
|
|
17771
|
+
detail: `No block with contentKey '${relativeKey}' exists in property '${propertyKey}'`,
|
|
17772
|
+
extensions: { blocksInSameContainer: currentOrder }
|
|
17773
|
+
});
|
|
17774
|
+
}
|
|
17775
|
+
}
|
|
17776
|
+
const newOrder = reorderKeys(currentOrder, contentKey, target);
|
|
17777
|
+
const moved = !sameOrder(currentOrder, newOrder);
|
|
17778
|
+
if (moved) {
|
|
17779
|
+
const byKey = new Map(containerItems.map((i) => [i.contentKey, i]));
|
|
17780
|
+
containerItems.splice(0, containerItems.length, ...newOrder.map((k) => byKey.get(k)));
|
|
17781
|
+
}
|
|
17782
|
+
return {
|
|
17783
|
+
moved,
|
|
17784
|
+
blockOrder: newOrder,
|
|
17785
|
+
parentContentKey: _nullishCoalesce(_optionalChain([location, 'access', _52 => _52.parent, 'optionalAccess', _53 => _53.contentKey]), () => ( null)),
|
|
17786
|
+
areaKey: _nullishCoalesce(location.areaKey, () => ( null))
|
|
17787
|
+
};
|
|
17788
|
+
}
|
|
17789
|
+
var RTE_BLOCK_KEY_PATTERN = /<umb-rte-block(?:-inline)?\b[^>]*\bdata-content-key=["']([^"']+)["']/gi;
|
|
17790
|
+
function getRteMarkupBlockOrder(markup) {
|
|
17791
|
+
return Array.from((_nullishCoalesce(markup, () => ( ""))).matchAll(RTE_BLOCK_KEY_PATTERN), (m) => m[1]);
|
|
17792
|
+
}
|
|
17793
|
+
function findRteBlockUnit(markup, contentKey) {
|
|
17794
|
+
const found = findRteBlockElement(markup, contentKey);
|
|
17795
|
+
if (!found) {
|
|
17796
|
+
return null;
|
|
17797
|
+
}
|
|
17798
|
+
let { start, end } = found;
|
|
17799
|
+
const element = markup.slice(start, end);
|
|
17800
|
+
const inlineElement = /^<umb-rte-block-inline\b/i.test(element);
|
|
17801
|
+
const openingParagraph = /<p\b[^>]*>\s*$/i.exec(markup.slice(0, start));
|
|
17802
|
+
const closingParagraph = /^\s*<\/p>/i.exec(markup.slice(end));
|
|
17803
|
+
const wrapped = Boolean(openingParagraph && closingParagraph);
|
|
17804
|
+
if (openingParagraph && closingParagraph) {
|
|
17805
|
+
start -= openingParagraph[0].length;
|
|
17806
|
+
end += closingParagraph[0].length;
|
|
17807
|
+
}
|
|
17808
|
+
return { start, end, element, inlineElement, wrapped, level: inlineElement && !wrapped ? "inline" : "block" };
|
|
17809
|
+
}
|
|
17810
|
+
function markupForLevel(unit, blockMarkup, level) {
|
|
17811
|
+
if (level === "block") {
|
|
17812
|
+
return unit.level === "inline" ? `<p>${unit.element}</p>` : blockMarkup;
|
|
17813
|
+
}
|
|
17814
|
+
return unit.inlineElement ? unit.element : null;
|
|
17815
|
+
}
|
|
17816
|
+
function moveRichTextBlock(rteValue, layoutItems, contentKey, target, propertyKey) {
|
|
17817
|
+
const markup = _nullishCoalesce(rteValue.markup, () => ( ""));
|
|
17818
|
+
const currentOrder = getRteMarkupBlockOrder(markup);
|
|
17819
|
+
const unit = findRteBlockUnit(markup, contentKey);
|
|
17820
|
+
if (!unit) {
|
|
17821
|
+
if (layoutItems.some((i) => i.contentKey === contentKey)) {
|
|
17822
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
17823
|
+
title: "Block markup not found",
|
|
17824
|
+
detail: `Block '${contentKey}' has a layout entry but no <umb-rte-block> element in the markup`
|
|
17825
|
+
});
|
|
17826
|
+
}
|
|
17827
|
+
throw blockNotFoundError(contentKey, propertyKey, currentOrder);
|
|
17828
|
+
}
|
|
17829
|
+
const relativeKey = target.position === "before" || target.position === "after" ? target.relativeToContentKey : null;
|
|
17830
|
+
if (relativeKey && !currentOrder.includes(relativeKey)) {
|
|
17831
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
17832
|
+
title: "Relative block not found",
|
|
17833
|
+
detail: `No block with contentKey '${relativeKey}' exists in the markup of property '${propertyKey}'`,
|
|
17834
|
+
extensions: { blocksInSameContainer: currentOrder }
|
|
17835
|
+
});
|
|
17836
|
+
}
|
|
17837
|
+
if (relativeKey && relativeKey !== contentKey) {
|
|
17838
|
+
const relativeLevel = findRteBlockUnit(markup, relativeKey).level;
|
|
17839
|
+
if (markupForLevel(unit, markup.slice(unit.start, unit.end), relativeLevel) === null) {
|
|
17840
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
17841
|
+
title: "Cannot place block inside text",
|
|
17842
|
+
detail: `Block '${relativeKey}' is an inline block inside a paragraph of text, and block '${contentKey}' is a block-level block, which can't be placed inside a paragraph. Move it relative to a block-level block, or to the first/last position, instead.`,
|
|
17843
|
+
extensions: { blocksInSameContainer: currentOrder }
|
|
17844
|
+
});
|
|
17845
|
+
}
|
|
17846
|
+
}
|
|
17847
|
+
let alreadyInPlace;
|
|
17848
|
+
switch (target.position) {
|
|
17849
|
+
case "first":
|
|
17850
|
+
alreadyInPlace = markup.slice(0, unit.start).trim() === "";
|
|
17851
|
+
break;
|
|
17852
|
+
case "last":
|
|
17853
|
+
alreadyInPlace = markup.slice(unit.end).trim() === "";
|
|
17854
|
+
break;
|
|
17855
|
+
default:
|
|
17856
|
+
alreadyInPlace = sameOrder(currentOrder, reorderKeys(currentOrder, contentKey, target));
|
|
17857
|
+
}
|
|
17858
|
+
if (!alreadyInPlace) {
|
|
17859
|
+
const blockMarkup = markup.slice(unit.start, unit.end);
|
|
17860
|
+
const remaining = markup.slice(0, unit.start) + markup.slice(unit.end);
|
|
17861
|
+
let newMarkup;
|
|
17862
|
+
if (target.position === "first" || target.position === "last") {
|
|
17863
|
+
const standalone = markupForLevel(unit, blockMarkup, "block");
|
|
17864
|
+
newMarkup = target.position === "first" ? standalone + remaining : remaining + standalone;
|
|
17865
|
+
} else {
|
|
17866
|
+
const relativeUnit = relativeKey ? findRteBlockUnit(remaining, relativeKey) : null;
|
|
17867
|
+
if (!relativeUnit) {
|
|
17868
|
+
throw new (0, _mcpserversdk.ToolValidationError)({
|
|
17869
|
+
title: "Relative block markup not found",
|
|
17870
|
+
detail: `Relative block '${relativeKey}' markup could not be re-located in property '${propertyKey}' after removing the markup of moved block '${contentKey}'`,
|
|
17871
|
+
extensions: {
|
|
17872
|
+
contentKey,
|
|
17873
|
+
relativeToContentKey: relativeKey,
|
|
17874
|
+
blocksInSameContainer: currentOrder
|
|
17875
|
+
}
|
|
17876
|
+
});
|
|
17877
|
+
}
|
|
17878
|
+
const insert = markupForLevel(unit, blockMarkup, relativeUnit.level);
|
|
17879
|
+
const at = target.position === "before" ? relativeUnit.start : relativeUnit.end;
|
|
17880
|
+
newMarkup = remaining.slice(0, at) + insert + remaining.slice(at);
|
|
17881
|
+
}
|
|
17882
|
+
rteValue.markup = newMarkup;
|
|
17883
|
+
}
|
|
17884
|
+
return {
|
|
17885
|
+
moved: !alreadyInPlace,
|
|
17886
|
+
blockOrder: getRteMarkupBlockOrder(_nullishCoalesce(rteValue.markup, () => ( ""))),
|
|
17887
|
+
parentContentKey: null,
|
|
17888
|
+
areaKey: null
|
|
17889
|
+
};
|
|
17890
|
+
}
|
|
17891
|
+
function moveBlock(context, contentKey, target, propertyKey) {
|
|
17892
|
+
const kind = context.kind;
|
|
17893
|
+
if (kind === "RichText") {
|
|
17894
|
+
return moveRichTextBlock(context.propertyValue, context.container.layoutItems, contentKey, target, propertyKey);
|
|
17895
|
+
}
|
|
17896
|
+
return moveLayoutBlock(context.container.layoutItems, contentKey, target, propertyKey);
|
|
17897
|
+
}
|
|
17898
|
+
|
|
17899
|
+
// src/umbraco-api/tools/document/put/move-document-block.ts
|
|
17900
|
+
|
|
17901
|
+
|
|
17902
|
+
|
|
17903
|
+
|
|
17904
|
+
var blockMoveTargetSchema = _zod.z.discriminatedUnion("position", [
|
|
17905
|
+
_zod.z.object({
|
|
17906
|
+
position: _zod.z.enum(["first", "last"]).describe("Move to the start or end of the block's container")
|
|
17907
|
+
}),
|
|
17908
|
+
_zod.z.object({
|
|
17909
|
+
position: _zod.z.enum(["before", "after"]).describe("Move directly before or after another block"),
|
|
17910
|
+
relativeToContentKey: _zod.z.string().uuid().describe("contentKey of the block to move next to; must be in the same container")
|
|
17911
|
+
})
|
|
17912
|
+
]).describe("Where to move the block");
|
|
17913
|
+
var moveBlockOutputSchema = _zod.z.object({
|
|
17914
|
+
success: _zod.z.boolean(),
|
|
17915
|
+
message: _zod.z.string(),
|
|
17916
|
+
contentKey: _zod.z.string().guid(),
|
|
17917
|
+
moved: _zod.z.boolean().describe("False when the block was already at the requested position and nothing was saved"),
|
|
17918
|
+
blockOrder: _zod.z.array(_zod.z.string().guid()).describe("contentKeys of the block's container, in their new order"),
|
|
17919
|
+
parentContentKey: _zod.z.string().guid().nullable().describe("BlockGrid only: the block owning the area the block was moved within; null for the property root"),
|
|
17920
|
+
areaKey: _zod.z.string().guid().nullable().describe("BlockGrid only: the area the block was moved within; null for the property root")
|
|
17921
|
+
});
|
|
17922
|
+
var moveDocumentBlockSchema = {
|
|
17923
|
+
documentId: _zod.z.string().uuid().describe("The document containing the block"),
|
|
17924
|
+
propertyAlias: _zod.z.string().min(1).describe("Document property alias of the BlockList, BlockGrid, or RichText property"),
|
|
17925
|
+
culture: _zod.z.string().nullish().describe("Culture, only for culture-variant document properties"),
|
|
17926
|
+
segment: _zod.z.string().nullish().describe("Segment, only for segment-variant document properties"),
|
|
17927
|
+
contentKey: _zod.z.string().uuid().describe("contentKey of the block to move"),
|
|
17928
|
+
target: blockMoveTargetSchema
|
|
17929
|
+
};
|
|
17930
|
+
var MoveDocumentBlockTool = {
|
|
17931
|
+
name: "move-document-block",
|
|
17932
|
+
description: `Reorders one block within a document's BlockList, BlockGrid, or RichText property.
|
|
17933
|
+
|
|
17934
|
+
- BlockList: moves the block's layout entry; its settings stay paired with it.
|
|
17935
|
+
- BlockGrid: moves the block within its own container (the root, or one area), keeping its
|
|
17936
|
+
columnSpan/rowSpan and nested areas. Moving between areas, or into or out of an area, is not
|
|
17937
|
+
supported; a relativeToContentKey in another container is refused.
|
|
17938
|
+
- RichText: moves the block's <umb-rte-block> element in the markup (before/after another
|
|
17939
|
+
block's element, or to the start/end of the markup); the markup alone sets the block order.
|
|
17940
|
+
A block-level block can't be placed next to an inline block that sits inside a paragraph of
|
|
17941
|
+
text; an inline block moved to block level gets its own paragraph.
|
|
17942
|
+
|
|
17943
|
+
Moving a block to where it already is changes nothing and succeeds (moved: false).
|
|
17944
|
+
Returns the container's new block order. The document is saved, not published.
|
|
17945
|
+
|
|
17946
|
+
Examples:
|
|
17947
|
+
- { documentId: "...", propertyAlias: "mainContent", contentKey: "...", target: { position: "first" } }
|
|
17948
|
+
- { documentId: "...", propertyAlias: "mainContent", contentKey: "...", target: { position: "before", relativeToContentKey: "..." } }`,
|
|
17949
|
+
inputSchema: moveDocumentBlockSchema,
|
|
17950
|
+
outputSchema: moveBlockOutputSchema.shape,
|
|
17951
|
+
annotations: {
|
|
17952
|
+
idempotentHint: true
|
|
17953
|
+
},
|
|
17954
|
+
slices: ["update"],
|
|
17955
|
+
enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Update),
|
|
17956
|
+
handler: (async (model) => {
|
|
17957
|
+
const ctx = await loadDocumentBlockContext(model);
|
|
17958
|
+
const propertyKey = getPropertyKey(model.propertyAlias, model.culture, model.segment);
|
|
17959
|
+
const result = moveBlock(ctx, model.contentKey, model.target, propertyKey);
|
|
17960
|
+
if (result.moved) {
|
|
17961
|
+
await saveDocumentValues(model.documentId, ctx.document);
|
|
17962
|
+
}
|
|
17963
|
+
return _mcpserversdk.createToolResult.call(void 0, {
|
|
17964
|
+
success: true,
|
|
17965
|
+
message: result.moved ? `Moved block '${model.contentKey}' in ${ctx.kind} property '${propertyKey}'` : `Block '${model.contentKey}' is already at the requested position in ${ctx.kind} property '${propertyKey}'; nothing changed`,
|
|
17966
|
+
contentKey: model.contentKey,
|
|
17967
|
+
...result
|
|
17968
|
+
});
|
|
17969
|
+
})
|
|
17970
|
+
};
|
|
17971
|
+
var move_document_block_default = _mcpserversdk.withStandardDecorators.call(void 0, MoveDocumentBlockTool);
|
|
17972
|
+
|
|
17634
17973
|
// src/umbraco-api/tools/document/items/get/get-root.ts
|
|
17635
17974
|
|
|
17636
17975
|
|
|
@@ -17843,7 +18182,7 @@ var DocumentCollection = {
|
|
|
17843
18182
|
tools.push(get_document_type_schema_default);
|
|
17844
18183
|
tools.push(copy_document_default);
|
|
17845
18184
|
tools.push(create_document_default);
|
|
17846
|
-
if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess',
|
|
18185
|
+
if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _54 => _54.umbracoVersion]))) {
|
|
17847
18186
|
tools.push(create_and_publish_document_default);
|
|
17848
18187
|
}
|
|
17849
18188
|
tools.push(post_document_public_access_default);
|
|
@@ -17860,13 +18199,13 @@ var DocumentCollection = {
|
|
|
17860
18199
|
tools.push(publish_document_default);
|
|
17861
18200
|
tools.push(publish_document_with_descendants_default);
|
|
17862
18201
|
tools.push(sort_document_default);
|
|
17863
|
-
if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess',
|
|
18202
|
+
if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _55 => _55.umbracoVersion]))) {
|
|
17864
18203
|
tools.push(sort_document_children_default);
|
|
17865
18204
|
tools.push(sort_document_root_children_default);
|
|
17866
18205
|
}
|
|
17867
18206
|
tools.push(unpublish_document_default);
|
|
17868
18207
|
tools.push(update_document_default);
|
|
17869
|
-
if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess',
|
|
18208
|
+
if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _56 => _56.umbracoVersion]))) {
|
|
17870
18209
|
tools.push(update_and_publish_document_default);
|
|
17871
18210
|
}
|
|
17872
18211
|
tools.push(update_document_properties_default);
|
|
@@ -17874,6 +18213,7 @@ var DocumentCollection = {
|
|
|
17874
18213
|
tools.push(update_block_property_default);
|
|
17875
18214
|
tools.push(create_document_block_default);
|
|
17876
18215
|
tools.push(delete_document_block_default);
|
|
18216
|
+
tools.push(move_document_block_default);
|
|
17877
18217
|
tools.push(put_document_domains_default);
|
|
17878
18218
|
tools.push(put_document_notifications_default);
|
|
17879
18219
|
tools.push(put_document_public_access_default);
|
|
@@ -17884,6 +18224,7 @@ var DocumentCollection = {
|
|
|
17884
18224
|
tools.push(get_recycle_bin_children_default);
|
|
17885
18225
|
tools.push(search_document_default);
|
|
17886
18226
|
tools.push(validate_document_default);
|
|
18227
|
+
tools.push(validate_document_update_default);
|
|
17887
18228
|
tools.push(get_collection_document_by_id_default);
|
|
17888
18229
|
tools.push(get_item_document_default);
|
|
17889
18230
|
tools.push(get_document_are_referenced_default);
|
|
@@ -18202,7 +18543,7 @@ var CopyDocumentTypeTool = {
|
|
|
18202
18543
|
validateStatus: () => true
|
|
18203
18544
|
});
|
|
18204
18545
|
if (response.status === 201) {
|
|
18205
|
-
const location = _optionalChain([response, 'access',
|
|
18546
|
+
const location = _optionalChain([response, 'access', _57 => _57.headers, 'optionalAccess', _58 => _58.location]) || "";
|
|
18206
18547
|
const newId = location.split("/").pop() || "";
|
|
18207
18548
|
const output = { id: newId };
|
|
18208
18549
|
return _mcpserversdk.createToolResult.call(void 0, output);
|
|
@@ -20413,7 +20754,7 @@ function getExtensionFromMimeType(mimeType) {
|
|
|
20413
20754
|
return extension ? `.${extension}` : void 0;
|
|
20414
20755
|
}
|
|
20415
20756
|
function validateMediaTypeForSvg(filePath, fileUrl, fileName, mediaTypeName) {
|
|
20416
|
-
const isSvg = _optionalChain([filePath, 'optionalAccess',
|
|
20757
|
+
const isSvg = _optionalChain([filePath, 'optionalAccess', _59 => _59.toLowerCase, 'call', _60 => _60(), 'access', _61 => _61.endsWith, 'call', _62 => _62(".svg")]) || _optionalChain([fileUrl, 'optionalAccess', _63 => _63.toLowerCase, 'call', _64 => _64(), 'access', _65 => _65.endsWith, 'call', _66 => _66(".svg")]) || fileName.toLowerCase().endsWith(".svg");
|
|
20417
20758
|
if (isSvg && mediaTypeName.toLowerCase() === _mcpserversdk.MEDIA_TYPE_IMAGE.toLowerCase()) {
|
|
20418
20759
|
console.warn(`SVG detected - using ${_mcpserversdk.MEDIA_TYPE_VECTOR_GRAPHICS} media type instead of ${_mcpserversdk.MEDIA_TYPE_IMAGE}`);
|
|
20419
20760
|
return _mcpserversdk.MEDIA_TYPE_VECTOR_GRAPHICS;
|
|
@@ -20595,8 +20936,8 @@ async function uploadMediaFile(client, params) {
|
|
|
20595
20936
|
});
|
|
20596
20937
|
} catch (error) {
|
|
20597
20938
|
const err = error;
|
|
20598
|
-
const errorData = _optionalChain([err, 'access',
|
|
20599
|
-
throw new Error(`Failed to upload temporary file: ${_optionalChain([err, 'access',
|
|
20939
|
+
const errorData = _optionalChain([err, 'access', _67 => _67.response, 'optionalAccess', _68 => _68.data]) ? typeof err.response.data === "string" ? err.response.data : JSON.stringify(err.response.data) : err.message;
|
|
20940
|
+
throw new Error(`Failed to upload temporary file: ${_optionalChain([err, 'access', _69 => _69.response, 'optionalAccess', _70 => _70.status]) || "Unknown error"} - ${errorData}`);
|
|
20600
20941
|
}
|
|
20601
20942
|
const valueStructure = buildValueStructure(mediaType.name, params.temporaryFileId);
|
|
20602
20943
|
let response;
|
|
@@ -20616,12 +20957,12 @@ async function uploadMediaFile(client, params) {
|
|
|
20616
20957
|
}, _mcpserversdk.CAPTURE_RAW_HTTP_RESPONSE);
|
|
20617
20958
|
} catch (error) {
|
|
20618
20959
|
const err = error;
|
|
20619
|
-
throw new Error(`Failed to create media item: ${_optionalChain([err, 'access',
|
|
20960
|
+
throw new Error(`Failed to create media item: ${_optionalChain([err, 'access', _71 => _71.response, 'optionalAccess', _72 => _72.status]) || "Unknown error"} - ${JSON.stringify(_optionalChain([err, 'access', _73 => _73.response, 'optionalAccess', _74 => _74.data])) || err.message}`);
|
|
20620
20961
|
}
|
|
20621
20962
|
if (response.status < 200 || response.status >= 300) {
|
|
20622
20963
|
throw new Error(`Request failed with status code ${response.status}`);
|
|
20623
20964
|
}
|
|
20624
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
20965
|
+
const locationHeader = _optionalChain([response, 'access', _75 => _75.headers, 'optionalAccess', _76 => _76.location]) || _optionalChain([response, 'access', _77 => _77.headers, 'optionalAccess', _78 => _78.Location]);
|
|
20625
20966
|
if (!locationHeader) {
|
|
20626
20967
|
throw new Error("No Location header in response - cannot determine created media ID");
|
|
20627
20968
|
}
|
|
@@ -20658,7 +20999,7 @@ function buildSourceTypeSection(allowFilePath, otherSources) {
|
|
|
20658
20999
|
|
|
20659
21000
|
|
|
20660
21001
|
function isStreamingUploadAvailable() {
|
|
20661
|
-
return _optionalChain([_mcpserversdk.getActiveRequestContext.call(void 0, ), 'optionalAccess',
|
|
21002
|
+
return _optionalChain([_mcpserversdk.getActiveRequestContext.call(void 0, ), 'optionalAccess', _79 => _79.umbracoAuth]) !== void 0;
|
|
20662
21003
|
}
|
|
20663
21004
|
async function resolveAuth() {
|
|
20664
21005
|
const { accessToken, baseUrl } = await _mcpserversdk.getSessionUmbracoAuth.call(void 0, );
|
|
@@ -20666,7 +21007,7 @@ async function resolveAuth() {
|
|
|
20666
21007
|
}
|
|
20667
21008
|
function ensureExtension(name, contentType, urlPath) {
|
|
20668
21009
|
if (name.includes(".")) return name;
|
|
20669
|
-
const fromUrl = _optionalChain([urlPath, 'access',
|
|
21010
|
+
const fromUrl = _optionalChain([urlPath, 'access', _80 => _80.match, 'call', _81 => _81(/\.([a-z0-9]{1,8})$/i), 'optionalAccess', _82 => _82[0]]);
|
|
20670
21011
|
if (fromUrl) return `${name}${fromUrl}`;
|
|
20671
21012
|
if (contentType) {
|
|
20672
21013
|
const subtype = contentType.split(";")[0].split("/")[1];
|
|
@@ -20772,8 +21113,8 @@ Content-Type: ${sourceContentType}\r
|
|
|
20772
21113
|
if (response.status < 200 || response.status >= 300) {
|
|
20773
21114
|
throw new Error(`postMedia failed with status ${response.status}`);
|
|
20774
21115
|
}
|
|
20775
|
-
const locationHeader = _nullishCoalesce(_optionalChain([response, 'access',
|
|
20776
|
-
const idMatch = _optionalChain([locationHeader, 'optionalAccess',
|
|
21116
|
+
const locationHeader = _nullishCoalesce(_optionalChain([response, 'access', _83 => _83.headers, 'optionalAccess', _84 => _84.location]), () => ( _optionalChain([response, 'access', _85 => _85.headers, 'optionalAccess', _86 => _86.Location])));
|
|
21117
|
+
const idMatch = _optionalChain([locationHeader, 'optionalAccess', _87 => _87.match, 'call', _88 => _88(/\/([a-f0-9-]{36})$/i)]);
|
|
20777
21118
|
if (!idMatch) {
|
|
20778
21119
|
throw new Error(
|
|
20779
21120
|
`Could not extract media id from Location header: ${_nullishCoalesce(locationHeader, () => ( "(missing)"))}`
|
|
@@ -20887,7 +21228,7 @@ ${filePathSection}
|
|
|
20887
21228
|
let effectiveSourceType;
|
|
20888
21229
|
let effectiveFileUrl = model.fileUrl;
|
|
20889
21230
|
if (model.sourceType === "file") {
|
|
20890
|
-
if (!_optionalChain([model, 'access',
|
|
21231
|
+
if (!_optionalChain([model, 'access', _89 => _89.file, 'optionalAccess', _90 => _90.download_url])) {
|
|
20891
21232
|
return _mcpserversdk.createToolResultError.call(void 0, {
|
|
20892
21233
|
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."
|
|
20893
21234
|
});
|
|
@@ -21044,7 +21385,7 @@ ${filePathSection}
|
|
|
21044
21385
|
let effectiveSourceType;
|
|
21045
21386
|
let effectiveFileUrl = file.fileUrl;
|
|
21046
21387
|
if (model.sourceType === "file") {
|
|
21047
|
-
if (!_optionalChain([file, 'access',
|
|
21388
|
+
if (!_optionalChain([file, 'access', _91 => _91.file, 'optionalAccess', _92 => _92.download_url])) {
|
|
21048
21389
|
return {
|
|
21049
21390
|
success: false,
|
|
21050
21391
|
name: file.name,
|
|
@@ -21150,7 +21491,7 @@ var CreateMediaFolderTool = {
|
|
|
21150
21491
|
if (response.status < 200 || response.status >= 300) {
|
|
21151
21492
|
throw new Error(`Request failed with status code ${response.status}`);
|
|
21152
21493
|
}
|
|
21153
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
21494
|
+
const locationHeader = _optionalChain([response, 'access', _93 => _93.headers, 'optionalAccess', _94 => _94.location]) || _optionalChain([response, 'access', _95 => _95.headers, 'optionalAccess', _96 => _96.Location]);
|
|
21154
21495
|
if (!locationHeader) {
|
|
21155
21496
|
throw new Error("No Location header in response - cannot determine created folder ID");
|
|
21156
21497
|
}
|
|
@@ -21985,7 +22326,7 @@ var MediaCollection = {
|
|
|
21985
22326
|
tools.push(validate_media_default);
|
|
21986
22327
|
tools.push(validate_media_default2);
|
|
21987
22328
|
tools.push(sort_media_default);
|
|
21988
|
-
if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess',
|
|
22329
|
+
if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _97 => _97.umbracoVersion]))) {
|
|
21989
22330
|
tools.push(sort_media_children_default);
|
|
21990
22331
|
tools.push(sort_media_root_children_default);
|
|
21991
22332
|
}
|
|
@@ -22006,7 +22347,7 @@ var MediaCollection = {
|
|
|
22006
22347
|
tools.push(get_collection_media_default);
|
|
22007
22348
|
tools.push(get_recycle_bin_media_referenced_by_default);
|
|
22008
22349
|
tools.push(get_recycle_bin_media_original_parent_default);
|
|
22009
|
-
if (isUmbracoAtLeast(17, 4, _optionalChain([options, 'optionalAccess',
|
|
22350
|
+
if (isUmbracoAtLeast(17, 4, _optionalChain([options, 'optionalAccess', _98 => _98.umbracoVersion]))) {
|
|
22010
22351
|
tools.push(get_media_type_schema_default);
|
|
22011
22352
|
}
|
|
22012
22353
|
}
|
|
@@ -22440,7 +22781,7 @@ var CreateMediaTypeFolderTool = {
|
|
|
22440
22781
|
validateStatus: () => true
|
|
22441
22782
|
});
|
|
22442
22783
|
if (response.status === 201) {
|
|
22443
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
22784
|
+
const locationHeader = _optionalChain([response, 'access', _99 => _99.headers, 'optionalAccess', _100 => _100["location"]]) || _optionalChain([response, 'access', _101 => _101.headers, 'optionalAccess', _102 => _102["Location"]]);
|
|
22444
22785
|
let createdId = model.id || "";
|
|
22445
22786
|
if (locationHeader) {
|
|
22446
22787
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -22574,7 +22915,7 @@ var CreateMediaTypeTool = {
|
|
|
22574
22915
|
validateStatus: () => true
|
|
22575
22916
|
});
|
|
22576
22917
|
if (response.status === 201) {
|
|
22577
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
22918
|
+
const locationHeader = _optionalChain([response, 'access', _103 => _103.headers, 'optionalAccess', _104 => _104["location"]]) || _optionalChain([response, 'access', _105 => _105.headers, 'optionalAccess', _106 => _106["Location"]]);
|
|
22578
22919
|
let createdId = model.id || "";
|
|
22579
22920
|
if (locationHeader) {
|
|
22580
22921
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -22625,7 +22966,7 @@ var CopyMediaTypeTool = {
|
|
|
22625
22966
|
validateStatus: () => true
|
|
22626
22967
|
});
|
|
22627
22968
|
if (response.status === 201) {
|
|
22628
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
22969
|
+
const locationHeader = _optionalChain([response, 'access', _107 => _107.headers, 'optionalAccess', _108 => _108["location"]]) || _optionalChain([response, 'access', _109 => _109.headers, 'optionalAccess', _110 => _110["Location"]]);
|
|
22629
22970
|
let createdId = "";
|
|
22630
22971
|
if (locationHeader) {
|
|
22631
22972
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -22836,7 +23177,7 @@ var CreateMemberTool = {
|
|
|
22836
23177
|
validateStatus: () => true
|
|
22837
23178
|
});
|
|
22838
23179
|
if (response.status === 201) {
|
|
22839
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
23180
|
+
const locationHeader = _optionalChain([response, 'access', _111 => _111.headers, 'optionalAccess', _112 => _112["location"]]) || _optionalChain([response, 'access', _113 => _113.headers, 'optionalAccess', _114 => _114["Location"]]);
|
|
22840
23181
|
let createdId = model.id || "";
|
|
22841
23182
|
if (locationHeader) {
|
|
22842
23183
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -23144,7 +23485,7 @@ var MemberCollection = {
|
|
|
23144
23485
|
tools.push(get_member_are_referenced_default);
|
|
23145
23486
|
tools.push(get_member_by_id_referenced_by_default);
|
|
23146
23487
|
tools.push(get_member_by_id_referenced_descendants_default);
|
|
23147
|
-
if (isUmbracoAtLeast(17, 4, _optionalChain([options, 'optionalAccess',
|
|
23488
|
+
if (isUmbracoAtLeast(17, 4, _optionalChain([options, 'optionalAccess', _115 => _115.umbracoVersion]))) {
|
|
23148
23489
|
tools.push(get_member_type_schema_default);
|
|
23149
23490
|
}
|
|
23150
23491
|
}
|
|
@@ -23388,7 +23729,7 @@ var CreateMemberTypeTool = {
|
|
|
23388
23729
|
validateStatus: () => true
|
|
23389
23730
|
});
|
|
23390
23731
|
if (response.status === 201) {
|
|
23391
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
23732
|
+
const locationHeader = _optionalChain([response, 'access', _116 => _116.headers, 'optionalAccess', _117 => _117["location"]]) || _optionalChain([response, 'access', _118 => _118.headers, 'optionalAccess', _119 => _119["Location"]]);
|
|
23392
23733
|
let createdId = model.id || "";
|
|
23393
23734
|
if (locationHeader) {
|
|
23394
23735
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -23558,7 +23899,7 @@ var CopyMemberTypeTool = {
|
|
|
23558
23899
|
validateStatus: () => true
|
|
23559
23900
|
});
|
|
23560
23901
|
if (response.status === 201) {
|
|
23561
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
23902
|
+
const locationHeader = _optionalChain([response, 'access', _120 => _120.headers, 'optionalAccess', _121 => _121["location"]]) || _optionalChain([response, 'access', _122 => _122.headers, 'optionalAccess', _123 => _123["Location"]]);
|
|
23562
23903
|
let createdId = "";
|
|
23563
23904
|
if (locationHeader) {
|
|
23564
23905
|
const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
|
|
@@ -23918,7 +24259,7 @@ var CreatePartialViewTool = {
|
|
|
23918
24259
|
validateStatus: () => true
|
|
23919
24260
|
});
|
|
23920
24261
|
if (response.status === 201) {
|
|
23921
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
24262
|
+
const locationHeader = _optionalChain([response, 'access', _124 => _124.headers, 'optionalAccess', _125 => _125["location"]]) || _optionalChain([response, 'access', _126 => _126.headers, 'optionalAccess', _127 => _127["Location"]]);
|
|
23922
24263
|
let createdPath = "";
|
|
23923
24264
|
if (locationHeader) {
|
|
23924
24265
|
const pathMatch = locationHeader.match(/partial-view\/(.+)$/);
|
|
@@ -23965,7 +24306,7 @@ var CreatePartialViewFolderTool = {
|
|
|
23965
24306
|
validateStatus: () => true
|
|
23966
24307
|
});
|
|
23967
24308
|
if (response.status === 201) {
|
|
23968
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
24309
|
+
const locationHeader = _optionalChain([response, 'access', _128 => _128.headers, 'optionalAccess', _129 => _129["location"]]) || _optionalChain([response, 'access', _130 => _130.headers, 'optionalAccess', _131 => _131["Location"]]);
|
|
23969
24310
|
let createdPath = "";
|
|
23970
24311
|
if (locationHeader) {
|
|
23971
24312
|
const pathMatch = locationHeader.match(/partial-view\/folder\/(.+)$/);
|
|
@@ -24798,7 +25139,7 @@ var CreateScriptTool = {
|
|
|
24798
25139
|
validateStatus: () => true
|
|
24799
25140
|
});
|
|
24800
25141
|
if (response.status === 201) {
|
|
24801
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25142
|
+
const locationHeader = _optionalChain([response, 'access', _132 => _132.headers, 'optionalAccess', _133 => _133["location"]]) || _optionalChain([response, 'access', _134 => _134.headers, 'optionalAccess', _135 => _135["Location"]]);
|
|
24802
25143
|
let createdPath = "";
|
|
24803
25144
|
if (locationHeader) {
|
|
24804
25145
|
const pathMatch = locationHeader.match(/script\/(.+)$/);
|
|
@@ -24845,7 +25186,7 @@ var CreateScriptFolderTool = {
|
|
|
24845
25186
|
validateStatus: () => true
|
|
24846
25187
|
});
|
|
24847
25188
|
if (response.status === 201) {
|
|
24848
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25189
|
+
const locationHeader = _optionalChain([response, 'access', _136 => _136.headers, 'optionalAccess', _137 => _137["location"]]) || _optionalChain([response, 'access', _138 => _138.headers, 'optionalAccess', _139 => _139["Location"]]);
|
|
24849
25190
|
let createdPath = "";
|
|
24850
25191
|
if (locationHeader) {
|
|
24851
25192
|
const pathMatch = locationHeader.match(/script\/folder\/(.+)$/);
|
|
@@ -25442,7 +25783,7 @@ var CreateStylesheetTool = {
|
|
|
25442
25783
|
validateStatus: () => true
|
|
25443
25784
|
});
|
|
25444
25785
|
if (response.status === 201) {
|
|
25445
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25786
|
+
const locationHeader = _optionalChain([response, 'access', _140 => _140.headers, 'optionalAccess', _141 => _141["location"]]) || _optionalChain([response, 'access', _142 => _142.headers, 'optionalAccess', _143 => _143["Location"]]);
|
|
25446
25787
|
let createdPath = "";
|
|
25447
25788
|
if (locationHeader) {
|
|
25448
25789
|
const pathMatch = locationHeader.match(/stylesheet\/(.+)$/);
|
|
@@ -25489,7 +25830,7 @@ var CreateStylesheetFolderTool = {
|
|
|
25489
25830
|
validateStatus: () => true
|
|
25490
25831
|
});
|
|
25491
25832
|
if (response.status === 201) {
|
|
25492
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
25833
|
+
const locationHeader = _optionalChain([response, 'access', _144 => _144.headers, 'optionalAccess', _145 => _145["location"]]) || _optionalChain([response, 'access', _146 => _146.headers, 'optionalAccess', _147 => _147["Location"]]);
|
|
25493
25834
|
let createdPath = "";
|
|
25494
25835
|
if (locationHeader) {
|
|
25495
25836
|
const pathMatch = locationHeader.match(/stylesheet\/folder\/(.+)$/);
|
|
@@ -25853,7 +26194,7 @@ var CreateTemplateTool = {
|
|
|
25853
26194
|
validateStatus: () => true
|
|
25854
26195
|
});
|
|
25855
26196
|
if (response.status === 201) {
|
|
25856
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
26197
|
+
const locationHeader = _optionalChain([response, 'access', _148 => _148.headers, 'optionalAccess', _149 => _149["location"]]) || _optionalChain([response, 'access', _150 => _150.headers, 'optionalAccess', _151 => _151["Location"]]);
|
|
25857
26198
|
let createdId = "";
|
|
25858
26199
|
if (locationHeader) {
|
|
25859
26200
|
const idMatch = locationHeader.match(/template\/([a-f0-9-]+)$/i);
|
|
@@ -26795,7 +27136,7 @@ var UserCollection = {
|
|
|
26795
27136
|
tools.push(get_item_user_default);
|
|
26796
27137
|
tools.push(get_user_configuration_default);
|
|
26797
27138
|
tools.push(get_user_by_id_calculate_start_nodes_default);
|
|
26798
|
-
if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess',
|
|
27139
|
+
if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _152 => _152.umbracoVersion]))) {
|
|
26799
27140
|
tools.push(get_user_batch_default);
|
|
26800
27141
|
}
|
|
26801
27142
|
tools.push(upload_user_avatar_by_id_default);
|
|
@@ -26829,7 +27170,7 @@ var CreateUserDataTool = {
|
|
|
26829
27170
|
validateStatus: () => true
|
|
26830
27171
|
});
|
|
26831
27172
|
if (response.status === 201) {
|
|
26832
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
27173
|
+
const locationHeader = _optionalChain([response, 'access', _153 => _153.headers, 'optionalAccess', _154 => _154["location"]]) || _optionalChain([response, 'access', _155 => _155.headers, 'optionalAccess', _156 => _156["Location"]]);
|
|
26833
27174
|
let createdId = "";
|
|
26834
27175
|
if (locationHeader) {
|
|
26835
27176
|
const idMatch = locationHeader.match(/user-data\/([a-f0-9-]+)$/i);
|
|
@@ -27067,7 +27408,7 @@ var CreateUserGroupTool = {
|
|
|
27067
27408
|
validateStatus: () => true
|
|
27068
27409
|
});
|
|
27069
27410
|
if (response.status === 201) {
|
|
27070
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
27411
|
+
const locationHeader = _optionalChain([response, 'access', _157 => _157.headers, 'optionalAccess', _158 => _158["location"]]) || _optionalChain([response, 'access', _159 => _159.headers, 'optionalAccess', _160 => _160["Location"]]);
|
|
27071
27412
|
let createdId = "";
|
|
27072
27413
|
if (locationHeader) {
|
|
27073
27414
|
const idMatch = locationHeader.match(/user-group\/([a-f0-9-]+)$/i);
|
|
@@ -27365,7 +27706,7 @@ var CreateWebhookTool = {
|
|
|
27365
27706
|
validateStatus: () => true
|
|
27366
27707
|
});
|
|
27367
27708
|
if (response.status === 201) {
|
|
27368
|
-
const locationHeader = _optionalChain([response, 'access',
|
|
27709
|
+
const locationHeader = _optionalChain([response, 'access', _161 => _161.headers, 'optionalAccess', _162 => _162["location"]]) || _optionalChain([response, 'access', _163 => _163.headers, 'optionalAccess', _164 => _164["Location"]]);
|
|
27369
27710
|
let createdId = "";
|
|
27370
27711
|
if (locationHeader) {
|
|
27371
27712
|
const idMatch = locationHeader.match(/webhook\/([a-f0-9-]+)$/i);
|
|
@@ -27610,4 +27951,4 @@ var allSliceNames = [...toolSliceNames, "other"];
|
|
|
27610
27951
|
|
|
27611
27952
|
|
|
27612
27953
|
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;
|
|
27613
|
-
//# sourceMappingURL=chunk-
|
|
27954
|
+
//# sourceMappingURL=chunk-JXXGY3HS.cjs.map
|