@umbraco-cms/mcp-dev 17.0.0 → 17.0.1-beta.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/index.cjs +782 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +887 -118
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -7597,7 +7597,7 @@ var UmbracoManagementClient2 = class {
|
|
|
7597
7597
|
// package.json
|
|
7598
7598
|
var package_default = {
|
|
7599
7599
|
name: "@umbraco-cms/mcp-dev",
|
|
7600
|
-
version: "17.0.
|
|
7600
|
+
version: "17.0.1-beta.1",
|
|
7601
7601
|
type: "module",
|
|
7602
7602
|
description: "A model context protocol (MCP) server for Umbraco CMS",
|
|
7603
7603
|
main: "index.js",
|
|
@@ -7620,6 +7620,8 @@ var package_default = {
|
|
|
7620
7620
|
"eval-mcp:create-document-type": "npx mcp-server-tester@1.4.0 evals tests/e2e/create-document-type/create-document-type.yaml --server-config tests/e2e/create-document-type/create-document-type-config.json",
|
|
7621
7621
|
"eval-mcp:create-document-copy": "npx mcp-server-tester@1.4.0 evals tests/e2e/create-document-copy/create-document-copy.yaml --server-config tests/e2e/create-document-copy/create-document-copy-config.json",
|
|
7622
7622
|
"eval-mcp:create-document-with-template": "npx mcp-server-tester@1.4.0 evals tests/e2e/create-document-with-template/create-document-with-template.yaml --server-config tests/e2e/create-document-with-template/create-document-with-template-config.json",
|
|
7623
|
+
"eval-mcp:update-document-properties": "npx mcp-server-tester@1.4.0 evals tests/e2e/update-document-properties/update-document-properties.yaml --server-config tests/e2e/update-document-properties/update-document-properties-config.json",
|
|
7624
|
+
"eval-mcp:update-block-property": "npx mcp-server-tester@1.4.0 evals tests/e2e/update-block-property/update-block-property.yaml --server-config tests/e2e/update-block-property/update-block-property-config.json",
|
|
7623
7625
|
"eval-mcp:all": "npm run eval-mcp:basic && npm run eval-mcp:create-data-type && npm run eval-mcp:create-document-type && npm run eval-mcp:create-blog-post"
|
|
7624
7626
|
},
|
|
7625
7627
|
engines: {
|
|
@@ -19544,9 +19546,19 @@ var move_to_recycle_bin_default = MoveDocumentToRecycleBinTool;
|
|
|
19544
19546
|
import { z as z41 } from "zod";
|
|
19545
19547
|
var UpdateDocumentTool = CreateUmbracoTool(
|
|
19546
19548
|
"update-document",
|
|
19547
|
-
`Updates a document by Id
|
|
19548
|
-
|
|
19549
|
-
|
|
19549
|
+
`Updates a document by Id. USE AS LAST RESORT ONLY.
|
|
19550
|
+
|
|
19551
|
+
IMPORTANT: Prefer these specialized tools instead:
|
|
19552
|
+
- update-document-properties: For updating individual property values (simpler, safer)
|
|
19553
|
+
- update-block-property: For updating properties within BlockList/BlockGrid/RichText blocks
|
|
19554
|
+
|
|
19555
|
+
Only use this tool when you need to update document-level metadata (template, variants)
|
|
19556
|
+
or when the specialized tools cannot handle your specific use case.
|
|
19557
|
+
|
|
19558
|
+
If you must use this tool:
|
|
19559
|
+
- Always read the current document value first
|
|
19560
|
+
- Only update the required values
|
|
19561
|
+
- Don't miss any properties from the original document`,
|
|
19550
19562
|
{
|
|
19551
19563
|
id: putDocumentByIdParams.shape.id,
|
|
19552
19564
|
data: z41.object(putDocumentByIdBody.shape)
|
|
@@ -19567,6 +19579,761 @@ var UpdateDocumentTool = CreateUmbracoTool(
|
|
|
19567
19579
|
);
|
|
19568
19580
|
var update_document_default = UpdateDocumentTool;
|
|
19569
19581
|
|
|
19582
|
+
// src/umb-management-api/tools/document/put/update-document-properties.ts
|
|
19583
|
+
import { z as z42 } from "zod";
|
|
19584
|
+
|
|
19585
|
+
// src/umb-management-api/tools/document/put/helpers/document-type-properties-resolver.ts
|
|
19586
|
+
async function getAllDocumentTypeProperties(documentTypeId) {
|
|
19587
|
+
const client = UmbracoManagementClient2.getClient();
|
|
19588
|
+
const visitedIds = /* @__PURE__ */ new Set();
|
|
19589
|
+
const properties = [];
|
|
19590
|
+
async function resolveDocumentType(docTypeId) {
|
|
19591
|
+
if (visitedIds.has(docTypeId)) {
|
|
19592
|
+
return;
|
|
19593
|
+
}
|
|
19594
|
+
visitedIds.add(docTypeId);
|
|
19595
|
+
const docType = await client.getDocumentTypeById(docTypeId);
|
|
19596
|
+
for (const prop of docType.properties) {
|
|
19597
|
+
if (!properties.some((p) => p.alias === prop.alias)) {
|
|
19598
|
+
properties.push({
|
|
19599
|
+
alias: prop.alias,
|
|
19600
|
+
name: prop.name,
|
|
19601
|
+
dataTypeId: prop.dataType.id,
|
|
19602
|
+
variesByCulture: prop.variesByCulture,
|
|
19603
|
+
variesBySegment: prop.variesBySegment
|
|
19604
|
+
});
|
|
19605
|
+
}
|
|
19606
|
+
}
|
|
19607
|
+
for (const composition of docType.compositions) {
|
|
19608
|
+
await resolveDocumentType(composition.documentType.id);
|
|
19609
|
+
}
|
|
19610
|
+
}
|
|
19611
|
+
await resolveDocumentType(documentTypeId);
|
|
19612
|
+
return properties;
|
|
19613
|
+
}
|
|
19614
|
+
function validateCultureSegment(prop, def) {
|
|
19615
|
+
if (!def.variesByCulture && prop.culture) {
|
|
19616
|
+
return `Property '${prop.alias}' does not vary by culture, but culture '${prop.culture}' was provided`;
|
|
19617
|
+
}
|
|
19618
|
+
if (def.variesByCulture && !prop.culture) {
|
|
19619
|
+
return `Property '${prop.alias}' varies by culture - culture is required`;
|
|
19620
|
+
}
|
|
19621
|
+
if (!def.variesBySegment && prop.segment) {
|
|
19622
|
+
return `Property '${prop.alias}' does not vary by segment, but segment '${prop.segment}' was provided`;
|
|
19623
|
+
}
|
|
19624
|
+
if (def.variesBySegment && !prop.segment) {
|
|
19625
|
+
return `Property '${prop.alias}' varies by segment - segment is required`;
|
|
19626
|
+
}
|
|
19627
|
+
return null;
|
|
19628
|
+
}
|
|
19629
|
+
|
|
19630
|
+
// src/umb-management-api/tools/document/put/helpers/property-value-validator.ts
|
|
19631
|
+
var EDITOR_FORMAT_MAP = {
|
|
19632
|
+
// Editors with allowed values validation
|
|
19633
|
+
"Umbraco.DropDown.Flexible": { valueType: "string[]", allowedValuesKey: "items", validateAllowedValues: true },
|
|
19634
|
+
"Umbraco.RadioButtonList": { valueType: "string", allowedValuesKey: "items", validateAllowedValues: true },
|
|
19635
|
+
"Umbraco.CheckBoxList": { valueType: "string[]", allowedValuesKey: "items", validateAllowedValues: true },
|
|
19636
|
+
"Umbraco.ColorPicker": { valueType: "object", allowedValuesKey: "items", validateAllowedValues: true },
|
|
19637
|
+
// Editors with format-only validation
|
|
19638
|
+
"Umbraco.TextBox": { valueType: "string" },
|
|
19639
|
+
"Umbraco.TextArea": { valueType: "string" },
|
|
19640
|
+
"Umbraco.Integer": { valueType: "number" },
|
|
19641
|
+
"Umbraco.Decimal": { valueType: "number" },
|
|
19642
|
+
"Umbraco.TrueFalse": { valueType: "boolean" },
|
|
19643
|
+
"Umbraco.Tags": { valueType: "string[]" },
|
|
19644
|
+
"Umbraco.MultipleTextstring": { valueType: "string[]" },
|
|
19645
|
+
"Umbraco.DateTime": { valueType: "string" },
|
|
19646
|
+
"Umbraco.EmailAddress": { valueType: "string" },
|
|
19647
|
+
"Umbraco.MarkdownEditor": { valueType: "string" },
|
|
19648
|
+
"Umbraco.ColorPicker.EyeDropper": { valueType: "string" }
|
|
19649
|
+
};
|
|
19650
|
+
function validateValueType(value, expectedType, propertyAlias, editorAlias) {
|
|
19651
|
+
if (value === null || value === void 0) {
|
|
19652
|
+
return null;
|
|
19653
|
+
}
|
|
19654
|
+
switch (expectedType) {
|
|
19655
|
+
case "string":
|
|
19656
|
+
if (typeof value !== "string") {
|
|
19657
|
+
return `Property '${propertyAlias}': Value must be a string for ${editorAlias} editor, got ${typeof value}`;
|
|
19658
|
+
}
|
|
19659
|
+
break;
|
|
19660
|
+
case "string[]":
|
|
19661
|
+
if (!Array.isArray(value)) {
|
|
19662
|
+
return `Property '${propertyAlias}': Value must be an array for ${editorAlias} editor, got ${typeof value}`;
|
|
19663
|
+
}
|
|
19664
|
+
if (!value.every((item) => typeof item === "string")) {
|
|
19665
|
+
return `Property '${propertyAlias}': All array items must be strings for ${editorAlias} editor`;
|
|
19666
|
+
}
|
|
19667
|
+
break;
|
|
19668
|
+
case "number":
|
|
19669
|
+
if (typeof value !== "number") {
|
|
19670
|
+
return `Property '${propertyAlias}': Value must be a number for ${editorAlias} editor, got ${typeof value}`;
|
|
19671
|
+
}
|
|
19672
|
+
break;
|
|
19673
|
+
case "boolean":
|
|
19674
|
+
if (typeof value !== "boolean") {
|
|
19675
|
+
return `Property '${propertyAlias}': Value must be a boolean for ${editorAlias} editor, got ${typeof value}`;
|
|
19676
|
+
}
|
|
19677
|
+
break;
|
|
19678
|
+
case "object":
|
|
19679
|
+
if (typeof value !== "object" || Array.isArray(value)) {
|
|
19680
|
+
return `Property '${propertyAlias}': Value must be an object for ${editorAlias} editor, got ${Array.isArray(value) ? "array" : typeof value}`;
|
|
19681
|
+
}
|
|
19682
|
+
break;
|
|
19683
|
+
}
|
|
19684
|
+
return null;
|
|
19685
|
+
}
|
|
19686
|
+
function extractAllowedValues(dataType, configKey) {
|
|
19687
|
+
const configItem = dataType.values.find((v) => v.alias === configKey);
|
|
19688
|
+
if (!configItem || !configItem.value) {
|
|
19689
|
+
return null;
|
|
19690
|
+
}
|
|
19691
|
+
const value = configItem.value;
|
|
19692
|
+
if (Array.isArray(value)) {
|
|
19693
|
+
if (value.every((item) => typeof item === "string")) {
|
|
19694
|
+
return value;
|
|
19695
|
+
}
|
|
19696
|
+
if (value.every((item) => typeof item === "object" && item !== null && "value" in item)) {
|
|
19697
|
+
return value.map((item) => item.value);
|
|
19698
|
+
}
|
|
19699
|
+
}
|
|
19700
|
+
return null;
|
|
19701
|
+
}
|
|
19702
|
+
function validateAllowedValues(value, allowedValues, propertyAlias, editorAlias, valueType) {
|
|
19703
|
+
const errors = [];
|
|
19704
|
+
if (value === null || value === void 0) {
|
|
19705
|
+
return errors;
|
|
19706
|
+
}
|
|
19707
|
+
if (editorAlias === "Umbraco.ColorPicker" && typeof value === "object" && value !== null && "value" in value) {
|
|
19708
|
+
const colorValue = value.value;
|
|
19709
|
+
if (!allowedValues.includes(colorValue)) {
|
|
19710
|
+
errors.push(`Property '${propertyAlias}': Color value '${colorValue}' is not in allowed values: [${allowedValues.map((v) => `'${v}'`).join(", ")}]`);
|
|
19711
|
+
}
|
|
19712
|
+
return errors;
|
|
19713
|
+
}
|
|
19714
|
+
if (valueType === "string[]" && Array.isArray(value)) {
|
|
19715
|
+
for (const item of value) {
|
|
19716
|
+
if (!allowedValues.includes(item)) {
|
|
19717
|
+
errors.push(`Property '${propertyAlias}': Value '${item}' is not in allowed values: [${allowedValues.map((v) => `'${v}'`).join(", ")}]`);
|
|
19718
|
+
}
|
|
19719
|
+
}
|
|
19720
|
+
return errors;
|
|
19721
|
+
}
|
|
19722
|
+
if (valueType === "string" && typeof value === "string") {
|
|
19723
|
+
if (!allowedValues.includes(value)) {
|
|
19724
|
+
errors.push(`Property '${propertyAlias}': Value '${value}' is not in allowed values: [${allowedValues.map((v) => `'${v}'`).join(", ")}]`);
|
|
19725
|
+
}
|
|
19726
|
+
return errors;
|
|
19727
|
+
}
|
|
19728
|
+
return errors;
|
|
19729
|
+
}
|
|
19730
|
+
function validatePropertyValue(dataType, value, propertyAlias) {
|
|
19731
|
+
const errors = [];
|
|
19732
|
+
const editorAlias = dataType.editorAlias;
|
|
19733
|
+
const formatConfig = EDITOR_FORMAT_MAP[editorAlias];
|
|
19734
|
+
if (!formatConfig) {
|
|
19735
|
+
return { isValid: true, errors: [] };
|
|
19736
|
+
}
|
|
19737
|
+
const typeError = validateValueType(value, formatConfig.valueType, propertyAlias, editorAlias);
|
|
19738
|
+
if (typeError) {
|
|
19739
|
+
errors.push(typeError);
|
|
19740
|
+
return { isValid: false, errors };
|
|
19741
|
+
}
|
|
19742
|
+
if (formatConfig.validateAllowedValues && formatConfig.allowedValuesKey) {
|
|
19743
|
+
const allowedValues = extractAllowedValues(dataType, formatConfig.allowedValuesKey);
|
|
19744
|
+
if (allowedValues && allowedValues.length > 0) {
|
|
19745
|
+
const allowedValueErrors = validateAllowedValues(
|
|
19746
|
+
value,
|
|
19747
|
+
allowedValues,
|
|
19748
|
+
propertyAlias,
|
|
19749
|
+
editorAlias,
|
|
19750
|
+
formatConfig.valueType
|
|
19751
|
+
);
|
|
19752
|
+
errors.push(...allowedValueErrors);
|
|
19753
|
+
}
|
|
19754
|
+
}
|
|
19755
|
+
return {
|
|
19756
|
+
isValid: errors.length === 0,
|
|
19757
|
+
errors
|
|
19758
|
+
};
|
|
19759
|
+
}
|
|
19760
|
+
async function validatePropertiesBeforeSave(properties) {
|
|
19761
|
+
const client = UmbracoManagementClient2.getClient();
|
|
19762
|
+
const errors = [];
|
|
19763
|
+
const dataTypeCache = /* @__PURE__ */ new Map();
|
|
19764
|
+
async function getCachedDataType(dataTypeId) {
|
|
19765
|
+
if (!dataTypeCache.has(dataTypeId)) {
|
|
19766
|
+
try {
|
|
19767
|
+
const dataType = await client.getDataTypeById(dataTypeId);
|
|
19768
|
+
dataTypeCache.set(dataTypeId, dataType);
|
|
19769
|
+
} catch (error) {
|
|
19770
|
+
console.error(`Failed to fetch Data Type ${dataTypeId}:`, error);
|
|
19771
|
+
return null;
|
|
19772
|
+
}
|
|
19773
|
+
}
|
|
19774
|
+
return dataTypeCache.get(dataTypeId) ?? null;
|
|
19775
|
+
}
|
|
19776
|
+
for (const prop of properties) {
|
|
19777
|
+
if (!prop.dataTypeId) {
|
|
19778
|
+
continue;
|
|
19779
|
+
}
|
|
19780
|
+
const dataType = await getCachedDataType(prop.dataTypeId);
|
|
19781
|
+
if (!dataType) {
|
|
19782
|
+
continue;
|
|
19783
|
+
}
|
|
19784
|
+
const validation = validatePropertyValue(dataType, prop.value, prop.alias);
|
|
19785
|
+
if (!validation.isValid) {
|
|
19786
|
+
errors.push(...validation.errors);
|
|
19787
|
+
}
|
|
19788
|
+
}
|
|
19789
|
+
return {
|
|
19790
|
+
isValid: errors.length === 0,
|
|
19791
|
+
errors
|
|
19792
|
+
};
|
|
19793
|
+
}
|
|
19794
|
+
|
|
19795
|
+
// src/umb-management-api/tools/document/put/helpers/property-matching.ts
|
|
19796
|
+
function matchesProperty(value, alias, culture, segment) {
|
|
19797
|
+
return value.alias === alias && (value.culture ?? null) === (culture ?? null) && (value.segment ?? null) === (segment ?? null);
|
|
19798
|
+
}
|
|
19799
|
+
function getPropertyKey(alias, culture, segment) {
|
|
19800
|
+
let key = alias;
|
|
19801
|
+
if (culture) key += `[${culture}]`;
|
|
19802
|
+
if (segment) key += `[${segment}]`;
|
|
19803
|
+
return key;
|
|
19804
|
+
}
|
|
19805
|
+
|
|
19806
|
+
// src/umb-management-api/tools/document/put/update-document-properties.ts
|
|
19807
|
+
var propertySchema2 = z42.object({
|
|
19808
|
+
alias: z42.string().min(1).describe("The property alias to update or add"),
|
|
19809
|
+
value: z42.any().nullish().describe("The new value for the property"),
|
|
19810
|
+
culture: z42.string().nullish().describe("Optional culture code for variant properties (e.g., 'en-US')"),
|
|
19811
|
+
segment: z42.string().nullish().describe("Optional segment identifier for variant properties")
|
|
19812
|
+
});
|
|
19813
|
+
var updateDocumentPropertiesSchema = {
|
|
19814
|
+
id: z42.string().uuid().describe("The unique identifier of the document to update"),
|
|
19815
|
+
properties: z42.array(propertySchema2).min(1).describe("Array of properties to update or add - at least one property is required")
|
|
19816
|
+
};
|
|
19817
|
+
var UpdateDocumentPropertiesTool = CreateUmbracoTool(
|
|
19818
|
+
"update-document-properties",
|
|
19819
|
+
`Updates or adds property values on a document without requiring the full document JSON payload.
|
|
19820
|
+
|
|
19821
|
+
This tool simplifies property updates by handling the read-modify-write cycle internally.
|
|
19822
|
+
You can update existing properties, add new properties, or do both in a single call.
|
|
19823
|
+
|
|
19824
|
+
Key features:
|
|
19825
|
+
- Update existing properties or add new ones
|
|
19826
|
+
- Property must exist on the document type (including compositions)
|
|
19827
|
+
- Full i18n support with culture and segment parameters
|
|
19828
|
+
- Automatic validation of property aliases against document type
|
|
19829
|
+
- Culture/segment requirements validated against property variance flags
|
|
19830
|
+
- Returns detailed error messages with available properties
|
|
19831
|
+
|
|
19832
|
+
Example usage:
|
|
19833
|
+
- Update a single property: { id: "...", properties: [{ alias: "title", value: "New Title" }] }
|
|
19834
|
+
- Add a new property: { id: "...", properties: [{ alias: "author", value: "John Doe" }] }
|
|
19835
|
+
- Update with culture: { id: "...", properties: [{ alias: "title", value: "Nuevo T\xEDtulo", culture: "es-ES" }] }
|
|
19836
|
+
- Mix update and add: { id: "...", properties: [{ alias: "title", value: "New" }, { alias: "newProp", value: "Value" }] }`,
|
|
19837
|
+
updateDocumentPropertiesSchema,
|
|
19838
|
+
async (model) => {
|
|
19839
|
+
const client = UmbracoManagementClient2.getClient();
|
|
19840
|
+
const currentDocument = await client.getDocumentById(model.id);
|
|
19841
|
+
const invalidAliases = [];
|
|
19842
|
+
const varianceErrors = [];
|
|
19843
|
+
const propertiesToUpdate = [];
|
|
19844
|
+
const propertiesToAdd = [];
|
|
19845
|
+
let documentTypeProperties = null;
|
|
19846
|
+
const getDocumentTypeProperties = async () => {
|
|
19847
|
+
if (documentTypeProperties === null) {
|
|
19848
|
+
try {
|
|
19849
|
+
documentTypeProperties = await getAllDocumentTypeProperties(currentDocument.documentType.id);
|
|
19850
|
+
} catch (error) {
|
|
19851
|
+
console.error("Failed to fetch document type properties:", error);
|
|
19852
|
+
documentTypeProperties = [];
|
|
19853
|
+
}
|
|
19854
|
+
}
|
|
19855
|
+
return documentTypeProperties;
|
|
19856
|
+
};
|
|
19857
|
+
for (const prop of model.properties) {
|
|
19858
|
+
const existsOnDocument = currentDocument.values.some(
|
|
19859
|
+
(v) => matchesProperty(v, prop.alias, prop.culture, prop.segment)
|
|
19860
|
+
);
|
|
19861
|
+
if (existsOnDocument) {
|
|
19862
|
+
propertiesToUpdate.push({
|
|
19863
|
+
alias: prop.alias,
|
|
19864
|
+
value: prop.value,
|
|
19865
|
+
culture: prop.culture,
|
|
19866
|
+
segment: prop.segment
|
|
19867
|
+
});
|
|
19868
|
+
} else {
|
|
19869
|
+
const docTypeProperties = await getDocumentTypeProperties();
|
|
19870
|
+
const propertyDef = docTypeProperties.find((p) => p.alias === prop.alias);
|
|
19871
|
+
if (propertyDef) {
|
|
19872
|
+
const validationError = validateCultureSegment(prop, propertyDef);
|
|
19873
|
+
if (validationError) {
|
|
19874
|
+
varianceErrors.push(validationError);
|
|
19875
|
+
} else {
|
|
19876
|
+
propertiesToAdd.push({
|
|
19877
|
+
alias: prop.alias,
|
|
19878
|
+
value: prop.value,
|
|
19879
|
+
culture: prop.culture,
|
|
19880
|
+
segment: prop.segment
|
|
19881
|
+
});
|
|
19882
|
+
}
|
|
19883
|
+
} else if (docTypeProperties.length > 0) {
|
|
19884
|
+
invalidAliases.push(getPropertyKey(prop.alias, prop.culture, prop.segment));
|
|
19885
|
+
} else {
|
|
19886
|
+
invalidAliases.push(getPropertyKey(prop.alias, prop.culture, prop.segment));
|
|
19887
|
+
}
|
|
19888
|
+
}
|
|
19889
|
+
}
|
|
19890
|
+
if (varianceErrors.length > 0) {
|
|
19891
|
+
return {
|
|
19892
|
+
content: [{
|
|
19893
|
+
type: "text",
|
|
19894
|
+
text: JSON.stringify({
|
|
19895
|
+
success: false,
|
|
19896
|
+
error: "Culture/segment validation failed",
|
|
19897
|
+
message: varianceErrors.join("; "),
|
|
19898
|
+
errors: varianceErrors,
|
|
19899
|
+
availableProperties: (documentTypeProperties ?? []).map((p) => ({
|
|
19900
|
+
alias: p.alias,
|
|
19901
|
+
name: p.name,
|
|
19902
|
+
variesByCulture: p.variesByCulture,
|
|
19903
|
+
variesBySegment: p.variesBySegment
|
|
19904
|
+
}))
|
|
19905
|
+
}, null, 2)
|
|
19906
|
+
}]
|
|
19907
|
+
};
|
|
19908
|
+
}
|
|
19909
|
+
if (invalidAliases.length > 0) {
|
|
19910
|
+
const docTypeProps = documentTypeProperties ?? [];
|
|
19911
|
+
const availableProperties = docTypeProps.length > 0 ? docTypeProps.map((p) => ({
|
|
19912
|
+
alias: p.alias,
|
|
19913
|
+
name: p.name,
|
|
19914
|
+
variesByCulture: p.variesByCulture,
|
|
19915
|
+
variesBySegment: p.variesBySegment
|
|
19916
|
+
})) : currentDocument.values.map((v) => ({
|
|
19917
|
+
alias: v.alias,
|
|
19918
|
+
culture: v.culture ?? null,
|
|
19919
|
+
segment: v.segment ?? null,
|
|
19920
|
+
editorAlias: v.editorAlias
|
|
19921
|
+
}));
|
|
19922
|
+
return {
|
|
19923
|
+
content: [{
|
|
19924
|
+
type: "text",
|
|
19925
|
+
text: JSON.stringify({
|
|
19926
|
+
success: false,
|
|
19927
|
+
error: "Invalid property aliases",
|
|
19928
|
+
message: `The following properties do not exist on this document type: ${invalidAliases.join(", ")}`,
|
|
19929
|
+
invalidAliases,
|
|
19930
|
+
availableProperties
|
|
19931
|
+
}, null, 2)
|
|
19932
|
+
}]
|
|
19933
|
+
};
|
|
19934
|
+
}
|
|
19935
|
+
const allPropertiesToValidate = [...propertiesToUpdate, ...propertiesToAdd];
|
|
19936
|
+
if (allPropertiesToValidate.length > 0) {
|
|
19937
|
+
const docTypeProps = await getDocumentTypeProperties();
|
|
19938
|
+
const propsToValidate = allPropertiesToValidate.map((p) => {
|
|
19939
|
+
const def = docTypeProps.find((d) => d.alias === p.alias);
|
|
19940
|
+
return { alias: p.alias, value: p.value, dataTypeId: def?.dataTypeId ?? "" };
|
|
19941
|
+
}).filter((p) => p.dataTypeId);
|
|
19942
|
+
if (propsToValidate.length > 0) {
|
|
19943
|
+
const valueValidation = await validatePropertiesBeforeSave(propsToValidate);
|
|
19944
|
+
if (!valueValidation.isValid) {
|
|
19945
|
+
return {
|
|
19946
|
+
content: [{
|
|
19947
|
+
type: "text",
|
|
19948
|
+
text: JSON.stringify({
|
|
19949
|
+
success: false,
|
|
19950
|
+
error: "Property value validation failed",
|
|
19951
|
+
errors: valueValidation.errors
|
|
19952
|
+
}, null, 2)
|
|
19953
|
+
}]
|
|
19954
|
+
};
|
|
19955
|
+
}
|
|
19956
|
+
}
|
|
19957
|
+
}
|
|
19958
|
+
const updatedValues = currentDocument.values.map((existingValue) => {
|
|
19959
|
+
const updateProp = propertiesToUpdate.find(
|
|
19960
|
+
(p) => matchesProperty(existingValue, p.alias, p.culture, p.segment)
|
|
19961
|
+
);
|
|
19962
|
+
if (updateProp) {
|
|
19963
|
+
return {
|
|
19964
|
+
alias: existingValue.alias,
|
|
19965
|
+
culture: existingValue.culture,
|
|
19966
|
+
segment: existingValue.segment,
|
|
19967
|
+
value: updateProp.value
|
|
19968
|
+
};
|
|
19969
|
+
}
|
|
19970
|
+
return {
|
|
19971
|
+
alias: existingValue.alias,
|
|
19972
|
+
culture: existingValue.culture,
|
|
19973
|
+
segment: existingValue.segment,
|
|
19974
|
+
value: existingValue.value
|
|
19975
|
+
};
|
|
19976
|
+
});
|
|
19977
|
+
for (const newProp of propertiesToAdd) {
|
|
19978
|
+
updatedValues.push({
|
|
19979
|
+
alias: newProp.alias,
|
|
19980
|
+
culture: newProp.culture ?? null,
|
|
19981
|
+
segment: newProp.segment ?? null,
|
|
19982
|
+
value: newProp.value
|
|
19983
|
+
});
|
|
19984
|
+
}
|
|
19985
|
+
const variants = currentDocument.variants.map((v) => ({
|
|
19986
|
+
culture: v.culture,
|
|
19987
|
+
segment: v.segment,
|
|
19988
|
+
name: v.name
|
|
19989
|
+
}));
|
|
19990
|
+
const updatePayload = {
|
|
19991
|
+
values: updatedValues,
|
|
19992
|
+
variants,
|
|
19993
|
+
template: currentDocument.template
|
|
19994
|
+
};
|
|
19995
|
+
await client.putDocumentById(model.id, updatePayload);
|
|
19996
|
+
const updatedDocument = await client.getDocumentById(model.id);
|
|
19997
|
+
const updatedPropertyKeys = propertiesToUpdate.map(
|
|
19998
|
+
(p) => getPropertyKey(p.alias, p.culture, p.segment)
|
|
19999
|
+
);
|
|
20000
|
+
const addedPropertyKeys = propertiesToAdd.map(
|
|
20001
|
+
(p) => getPropertyKey(p.alias, p.culture, p.segment)
|
|
20002
|
+
);
|
|
20003
|
+
const totalCount = propertiesToUpdate.length + propertiesToAdd.length;
|
|
20004
|
+
let message = `Successfully processed ${totalCount} property value(s)`;
|
|
20005
|
+
if (propertiesToUpdate.length > 0 && propertiesToAdd.length > 0) {
|
|
20006
|
+
message = `Successfully updated ${propertiesToUpdate.length} and added ${propertiesToAdd.length} property value(s)`;
|
|
20007
|
+
} else if (propertiesToAdd.length > 0) {
|
|
20008
|
+
message = `Successfully added ${propertiesToAdd.length} property value(s)`;
|
|
20009
|
+
} else {
|
|
20010
|
+
message = `Successfully updated ${propertiesToUpdate.length} property value(s)`;
|
|
20011
|
+
}
|
|
20012
|
+
return {
|
|
20013
|
+
content: [{
|
|
20014
|
+
type: "text",
|
|
20015
|
+
text: JSON.stringify({
|
|
20016
|
+
success: true,
|
|
20017
|
+
message,
|
|
20018
|
+
updatedProperties: updatedPropertyKeys,
|
|
20019
|
+
addedProperties: addedPropertyKeys,
|
|
20020
|
+
document: updatedDocument
|
|
20021
|
+
}, null, 2)
|
|
20022
|
+
}]
|
|
20023
|
+
};
|
|
20024
|
+
},
|
|
20025
|
+
(user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Update)
|
|
20026
|
+
);
|
|
20027
|
+
var update_document_properties_default = UpdateDocumentPropertiesTool;
|
|
20028
|
+
|
|
20029
|
+
// src/umb-management-api/tools/document/put/update-block-property.ts
|
|
20030
|
+
import { z as z43 } from "zod";
|
|
20031
|
+
|
|
20032
|
+
// src/umb-management-api/tools/document/put/helpers/block-discovery.ts
|
|
20033
|
+
function isRichTextValue(value) {
|
|
20034
|
+
if (!value || typeof value !== "object") {
|
|
20035
|
+
return false;
|
|
20036
|
+
}
|
|
20037
|
+
if (!("markup" in value)) {
|
|
20038
|
+
return false;
|
|
20039
|
+
}
|
|
20040
|
+
if (!value.blocks || typeof value.blocks !== "object") {
|
|
20041
|
+
return false;
|
|
20042
|
+
}
|
|
20043
|
+
return Array.isArray(value.blocks.contentData) && Array.isArray(value.blocks.settingsData);
|
|
20044
|
+
}
|
|
20045
|
+
function isBlockStructure(value) {
|
|
20046
|
+
if (!value || typeof value !== "object") {
|
|
20047
|
+
return false;
|
|
20048
|
+
}
|
|
20049
|
+
return Array.isArray(value.contentData) && Array.isArray(value.settingsData);
|
|
20050
|
+
}
|
|
20051
|
+
function discoverAllBlockArrays(value, path4 = "root") {
|
|
20052
|
+
const results = [];
|
|
20053
|
+
if (!value || typeof value !== "object") {
|
|
20054
|
+
return results;
|
|
20055
|
+
}
|
|
20056
|
+
if (isRichTextValue(value)) {
|
|
20057
|
+
const nestedResults = discoverAllBlockArrays(value.blocks, `${path4}.blocks`);
|
|
20058
|
+
results.push(...nestedResults);
|
|
20059
|
+
return results;
|
|
20060
|
+
}
|
|
20061
|
+
if (isBlockStructure(value)) {
|
|
20062
|
+
results.push({
|
|
20063
|
+
contentData: value.contentData,
|
|
20064
|
+
settingsData: value.settingsData,
|
|
20065
|
+
path: path4
|
|
20066
|
+
});
|
|
20067
|
+
value.contentData.forEach((block, index) => {
|
|
20068
|
+
if (block.values && Array.isArray(block.values)) {
|
|
20069
|
+
block.values.forEach((prop, propIndex) => {
|
|
20070
|
+
const propPath = `${path4}.contentData[${index}].values[${propIndex}](${prop.alias})`;
|
|
20071
|
+
if (isRichTextValue(prop.value)) {
|
|
20072
|
+
const nestedResults = discoverAllBlockArrays(prop.value.blocks, `${propPath}.blocks`);
|
|
20073
|
+
results.push(...nestedResults);
|
|
20074
|
+
} else if (isBlockStructure(prop.value)) {
|
|
20075
|
+
const nestedResults = discoverAllBlockArrays(prop.value, propPath);
|
|
20076
|
+
results.push(...nestedResults);
|
|
20077
|
+
}
|
|
20078
|
+
});
|
|
20079
|
+
}
|
|
20080
|
+
});
|
|
20081
|
+
value.settingsData.forEach((block, index) => {
|
|
20082
|
+
if (block.values && Array.isArray(block.values)) {
|
|
20083
|
+
block.values.forEach((prop, propIndex) => {
|
|
20084
|
+
const propPath = `${path4}.settingsData[${index}].values[${propIndex}](${prop.alias})`;
|
|
20085
|
+
if (isRichTextValue(prop.value)) {
|
|
20086
|
+
const nestedResults = discoverAllBlockArrays(prop.value.blocks, `${propPath}.blocks`);
|
|
20087
|
+
results.push(...nestedResults);
|
|
20088
|
+
} else if (isBlockStructure(prop.value)) {
|
|
20089
|
+
const nestedResults = discoverAllBlockArrays(prop.value, propPath);
|
|
20090
|
+
results.push(...nestedResults);
|
|
20091
|
+
}
|
|
20092
|
+
});
|
|
20093
|
+
}
|
|
20094
|
+
});
|
|
20095
|
+
}
|
|
20096
|
+
return results;
|
|
20097
|
+
}
|
|
20098
|
+
function findBlockByKey(discoveredArrays, contentKey, blockType) {
|
|
20099
|
+
for (const discovered of discoveredArrays) {
|
|
20100
|
+
const array = blockType === "content" ? discovered.contentData : discovered.settingsData;
|
|
20101
|
+
const block = array.find((b) => b.key === contentKey);
|
|
20102
|
+
if (block) {
|
|
20103
|
+
return { block, arrayRef: array, path: discovered.path };
|
|
20104
|
+
}
|
|
20105
|
+
}
|
|
20106
|
+
return null;
|
|
20107
|
+
}
|
|
20108
|
+
|
|
20109
|
+
// src/umb-management-api/tools/document/put/update-block-property.ts
|
|
20110
|
+
var blockPropertyUpdateSchema = z43.object({
|
|
20111
|
+
alias: z43.string().min(1).describe("The property alias within the block to update"),
|
|
20112
|
+
value: z43.any().nullish().describe("The new value for the property"),
|
|
20113
|
+
culture: z43.string().nullish().describe("Optional culture code for variant block properties"),
|
|
20114
|
+
segment: z43.string().nullish().describe("Optional segment identifier for variant block properties")
|
|
20115
|
+
});
|
|
20116
|
+
var blockUpdateSchema = z43.object({
|
|
20117
|
+
contentKey: z43.string().uuid().describe("The unique key (UUID) identifying the block"),
|
|
20118
|
+
blockType: z43.enum(["content", "settings"]).describe("'content' for contentData, 'settings' for settingsData"),
|
|
20119
|
+
properties: z43.array(blockPropertyUpdateSchema).min(1).describe("Properties to update within this block")
|
|
20120
|
+
});
|
|
20121
|
+
var updateBlockPropertySchema = {
|
|
20122
|
+
documentId: z43.string().uuid().describe("The document containing the block"),
|
|
20123
|
+
propertyAlias: z43.string().min(1).describe("Document property alias containing BlockList/BlockGrid"),
|
|
20124
|
+
culture: z43.string().nullish().describe("Optional culture for variant document properties"),
|
|
20125
|
+
segment: z43.string().nullish().describe("Optional segment for variant document properties"),
|
|
20126
|
+
updates: z43.array(blockUpdateSchema).min(1).describe("Array of block updates")
|
|
20127
|
+
};
|
|
20128
|
+
var UpdateBlockPropertyTool = CreateUmbracoTool(
|
|
20129
|
+
"update-block-property",
|
|
20130
|
+
`Updates or adds property values within BlockList, BlockGrid, or RichText block content.
|
|
20131
|
+
|
|
20132
|
+
This tool enables targeted updates to individual block properties without sending the entire JSON payload.
|
|
20133
|
+
You can update existing properties, add new properties, or do both in a single call.
|
|
20134
|
+
It automatically handles deep traversal of nested block structures (e.g., RichText blocks containing nested blocks).
|
|
20135
|
+
|
|
20136
|
+
Key features:
|
|
20137
|
+
- Update existing properties or add new ones to blocks
|
|
20138
|
+
- Property must exist on the Element Type (including compositions)
|
|
20139
|
+
- Support for both content and settings blocks
|
|
20140
|
+
- Batch updates to multiple blocks in a single call
|
|
20141
|
+
- Deep traversal of nested block structures
|
|
20142
|
+
- Full i18n support with culture and segment parameters
|
|
20143
|
+
- Culture/segment requirements validated against property variance flags
|
|
20144
|
+
|
|
20145
|
+
Example usage:
|
|
20146
|
+
- Update a block property: { documentId: "...", propertyAlias: "mainContent", updates: [{ contentKey: "block-uuid", blockType: "content", properties: [{ alias: "title", value: "New Title" }] }] }
|
|
20147
|
+
- Add a new property to block: { documentId: "...", propertyAlias: "mainContent", updates: [{ contentKey: "block-uuid", blockType: "content", properties: [{ alias: "newProp", value: "Value" }] }] }
|
|
20148
|
+
- Update with culture: { documentId: "...", propertyAlias: "mainContent", culture: "es-ES", updates: [...] }
|
|
20149
|
+
- Batch update multiple blocks: { documentId: "...", propertyAlias: "mainContent", updates: [{ contentKey: "uuid1", ... }, { contentKey: "uuid2", ... }] }`,
|
|
20150
|
+
updateBlockPropertySchema,
|
|
20151
|
+
async (model) => {
|
|
20152
|
+
const client = UmbracoManagementClient2.getClient();
|
|
20153
|
+
const currentDocument = await client.getDocumentById(model.documentId);
|
|
20154
|
+
const documentProperty = currentDocument.values.find(
|
|
20155
|
+
(v) => matchesProperty(v, model.propertyAlias, model.culture, model.segment)
|
|
20156
|
+
);
|
|
20157
|
+
if (!documentProperty) {
|
|
20158
|
+
const availableAliases = currentDocument.values.map((v) => ({
|
|
20159
|
+
alias: v.alias,
|
|
20160
|
+
culture: v.culture ?? null,
|
|
20161
|
+
segment: v.segment ?? null,
|
|
20162
|
+
editorAlias: v.editorAlias
|
|
20163
|
+
}));
|
|
20164
|
+
return {
|
|
20165
|
+
content: [{
|
|
20166
|
+
type: "text",
|
|
20167
|
+
text: JSON.stringify({
|
|
20168
|
+
success: false,
|
|
20169
|
+
error: "Property not found",
|
|
20170
|
+
message: `Property '${getPropertyKey(model.propertyAlias, model.culture, model.segment)}' does not exist on this document`,
|
|
20171
|
+
availableProperties: availableAliases
|
|
20172
|
+
}, null, 2)
|
|
20173
|
+
}]
|
|
20174
|
+
};
|
|
20175
|
+
}
|
|
20176
|
+
const discoveredArrays = discoverAllBlockArrays(documentProperty.value, `property(${model.propertyAlias})`);
|
|
20177
|
+
if (discoveredArrays.length === 0) {
|
|
20178
|
+
return {
|
|
20179
|
+
content: [{
|
|
20180
|
+
type: "text",
|
|
20181
|
+
text: JSON.stringify({
|
|
20182
|
+
success: false,
|
|
20183
|
+
error: "No block structure found",
|
|
20184
|
+
message: `Property '${model.propertyAlias}' does not contain a BlockList, BlockGrid, or RichText block structure`,
|
|
20185
|
+
propertyValue: documentProperty.value
|
|
20186
|
+
}, null, 2)
|
|
20187
|
+
}]
|
|
20188
|
+
};
|
|
20189
|
+
}
|
|
20190
|
+
const results = [];
|
|
20191
|
+
const notFoundBlocks = [];
|
|
20192
|
+
const elementTypePropertiesCache = /* @__PURE__ */ new Map();
|
|
20193
|
+
const getElementTypeProperties = async (contentTypeKey) => {
|
|
20194
|
+
if (!elementTypePropertiesCache.has(contentTypeKey)) {
|
|
20195
|
+
try {
|
|
20196
|
+
const properties = await getAllDocumentTypeProperties(contentTypeKey);
|
|
20197
|
+
elementTypePropertiesCache.set(contentTypeKey, properties);
|
|
20198
|
+
} catch (error) {
|
|
20199
|
+
console.error(`Failed to fetch Element Type properties for ${contentTypeKey}:`, error);
|
|
20200
|
+
elementTypePropertiesCache.set(contentTypeKey, []);
|
|
20201
|
+
}
|
|
20202
|
+
}
|
|
20203
|
+
return elementTypePropertiesCache.get(contentTypeKey);
|
|
20204
|
+
};
|
|
20205
|
+
for (const update of model.updates) {
|
|
20206
|
+
const foundBlock = findBlockByKey(discoveredArrays, update.contentKey, update.blockType);
|
|
20207
|
+
if (!foundBlock) {
|
|
20208
|
+
notFoundBlocks.push({ contentKey: update.contentKey, blockType: update.blockType });
|
|
20209
|
+
results.push({
|
|
20210
|
+
success: false,
|
|
20211
|
+
contentKey: update.contentKey,
|
|
20212
|
+
message: `Block with contentKey '${update.contentKey}' not found in ${update.blockType}Data`
|
|
20213
|
+
});
|
|
20214
|
+
continue;
|
|
20215
|
+
}
|
|
20216
|
+
const warnings = [];
|
|
20217
|
+
const errors = [];
|
|
20218
|
+
let updatedCount = 0;
|
|
20219
|
+
let addedCount = 0;
|
|
20220
|
+
const elementTypeProperties = await getElementTypeProperties(foundBlock.block.contentTypeKey);
|
|
20221
|
+
if (elementTypeProperties.length > 0) {
|
|
20222
|
+
const propsToValidate = update.properties.map((p) => {
|
|
20223
|
+
const def = elementTypeProperties.find((d) => d.alias === p.alias);
|
|
20224
|
+
return { alias: p.alias, value: p.value, dataTypeId: def?.dataTypeId ?? "" };
|
|
20225
|
+
}).filter((p) => p.dataTypeId);
|
|
20226
|
+
if (propsToValidate.length > 0) {
|
|
20227
|
+
const valueValidation = await validatePropertiesBeforeSave(propsToValidate);
|
|
20228
|
+
if (!valueValidation.isValid) {
|
|
20229
|
+
errors.push(...valueValidation.errors);
|
|
20230
|
+
}
|
|
20231
|
+
}
|
|
20232
|
+
}
|
|
20233
|
+
for (const propUpdate of update.properties) {
|
|
20234
|
+
const blockProperty = foundBlock.block.values.find(
|
|
20235
|
+
(v) => matchesProperty(v, propUpdate.alias, propUpdate.culture, propUpdate.segment)
|
|
20236
|
+
);
|
|
20237
|
+
if (blockProperty) {
|
|
20238
|
+
blockProperty.value = propUpdate.value;
|
|
20239
|
+
updatedCount++;
|
|
20240
|
+
} else {
|
|
20241
|
+
const propertyDef = elementTypeProperties.find((p) => p.alias === propUpdate.alias);
|
|
20242
|
+
if (propertyDef) {
|
|
20243
|
+
const validationError = validateCultureSegment(propUpdate, propertyDef);
|
|
20244
|
+
if (validationError) {
|
|
20245
|
+
errors.push(validationError);
|
|
20246
|
+
} else {
|
|
20247
|
+
foundBlock.block.values.push({
|
|
20248
|
+
alias: propUpdate.alias,
|
|
20249
|
+
culture: propUpdate.culture ?? null,
|
|
20250
|
+
segment: propUpdate.segment ?? null,
|
|
20251
|
+
value: propUpdate.value
|
|
20252
|
+
});
|
|
20253
|
+
addedCount++;
|
|
20254
|
+
}
|
|
20255
|
+
} else if (elementTypeProperties.length > 0) {
|
|
20256
|
+
errors.push(
|
|
20257
|
+
`Property '${getPropertyKey(propUpdate.alias, propUpdate.culture, propUpdate.segment)}' does not exist on Element Type`
|
|
20258
|
+
);
|
|
20259
|
+
} else {
|
|
20260
|
+
warnings.push(
|
|
20261
|
+
`Property '${getPropertyKey(propUpdate.alias, propUpdate.culture, propUpdate.segment)}' not found in block (could not validate against Element Type)`
|
|
20262
|
+
);
|
|
20263
|
+
}
|
|
20264
|
+
}
|
|
20265
|
+
}
|
|
20266
|
+
const totalProcessed = updatedCount + addedCount;
|
|
20267
|
+
let message;
|
|
20268
|
+
if (updatedCount > 0 && addedCount > 0) {
|
|
20269
|
+
message = `Updated ${updatedCount} and added ${addedCount} properties in block at ${foundBlock.path}`;
|
|
20270
|
+
} else if (addedCount > 0) {
|
|
20271
|
+
message = `Added ${addedCount} properties in block at ${foundBlock.path}`;
|
|
20272
|
+
} else if (updatedCount > 0) {
|
|
20273
|
+
message = `Updated ${updatedCount} properties in block at ${foundBlock.path}`;
|
|
20274
|
+
} else {
|
|
20275
|
+
message = `No properties were processed in block at ${foundBlock.path}`;
|
|
20276
|
+
}
|
|
20277
|
+
results.push({
|
|
20278
|
+
success: totalProcessed > 0 || errors.length === 0,
|
|
20279
|
+
contentKey: update.contentKey,
|
|
20280
|
+
message,
|
|
20281
|
+
updatedCount: updatedCount > 0 ? updatedCount : void 0,
|
|
20282
|
+
addedCount: addedCount > 0 ? addedCount : void 0,
|
|
20283
|
+
warnings: warnings.length > 0 ? warnings : void 0,
|
|
20284
|
+
errors: errors.length > 0 ? errors : void 0
|
|
20285
|
+
});
|
|
20286
|
+
}
|
|
20287
|
+
if (notFoundBlocks.length === model.updates.length) {
|
|
20288
|
+
const allBlocks = discoveredArrays.flatMap((d) => [
|
|
20289
|
+
...d.contentData.map((b) => ({ key: b.key, type: "content", path: d.path })),
|
|
20290
|
+
...d.settingsData.map((b) => ({ key: b.key, type: "settings", path: d.path }))
|
|
20291
|
+
]);
|
|
20292
|
+
return {
|
|
20293
|
+
content: [{
|
|
20294
|
+
type: "text",
|
|
20295
|
+
text: JSON.stringify({
|
|
20296
|
+
success: false,
|
|
20297
|
+
error: "Blocks not found",
|
|
20298
|
+
message: "None of the specified blocks were found in the document",
|
|
20299
|
+
notFoundBlocks,
|
|
20300
|
+
availableBlocks: allBlocks
|
|
20301
|
+
}, null, 2)
|
|
20302
|
+
}]
|
|
20303
|
+
};
|
|
20304
|
+
}
|
|
20305
|
+
const updatedValues = currentDocument.values.map((existingValue) => ({
|
|
20306
|
+
alias: existingValue.alias,
|
|
20307
|
+
culture: existingValue.culture,
|
|
20308
|
+
segment: existingValue.segment,
|
|
20309
|
+
value: existingValue.value
|
|
20310
|
+
}));
|
|
20311
|
+
const variants = currentDocument.variants.map((v) => ({
|
|
20312
|
+
culture: v.culture,
|
|
20313
|
+
segment: v.segment,
|
|
20314
|
+
name: v.name
|
|
20315
|
+
}));
|
|
20316
|
+
const updatePayload = {
|
|
20317
|
+
values: updatedValues,
|
|
20318
|
+
variants,
|
|
20319
|
+
template: currentDocument.template
|
|
20320
|
+
};
|
|
20321
|
+
await client.putDocumentById(model.documentId, updatePayload);
|
|
20322
|
+
return {
|
|
20323
|
+
content: [{
|
|
20324
|
+
type: "text",
|
|
20325
|
+
text: JSON.stringify({
|
|
20326
|
+
success: true,
|
|
20327
|
+
message: `Successfully processed ${model.updates.length} block update(s)`,
|
|
20328
|
+
results
|
|
20329
|
+
}, null, 2)
|
|
20330
|
+
}]
|
|
20331
|
+
};
|
|
20332
|
+
},
|
|
20333
|
+
(user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Update)
|
|
20334
|
+
);
|
|
20335
|
+
var update_block_property_default = UpdateBlockPropertyTool;
|
|
20336
|
+
|
|
19570
20337
|
// src/umb-management-api/tools/document/items/get/get-root.ts
|
|
19571
20338
|
var GetDocumentRootTool = CreateUmbracoTool(
|
|
19572
20339
|
"get-document-root",
|
|
@@ -19740,6 +20507,8 @@ var DocumentCollection = {
|
|
|
19740
20507
|
tools.push(sort_document_default());
|
|
19741
20508
|
tools.push(unpublish_document_default());
|
|
19742
20509
|
tools.push(update_document_default());
|
|
20510
|
+
tools.push(update_document_properties_default());
|
|
20511
|
+
tools.push(update_block_property_default());
|
|
19743
20512
|
tools.push(put_document_domains_default());
|
|
19744
20513
|
tools.push(put_document_notifications_default());
|
|
19745
20514
|
tools.push(put_document_public_access_default());
|
|
@@ -19877,7 +20646,7 @@ var DocumentVersionCollection = {
|
|
|
19877
20646
|
};
|
|
19878
20647
|
|
|
19879
20648
|
// src/umb-management-api/tools/media/post/create-media.ts
|
|
19880
|
-
import { z as
|
|
20649
|
+
import { z as z44 } from "zod";
|
|
19881
20650
|
import { v4 as uuidv46 } from "uuid";
|
|
19882
20651
|
|
|
19883
20652
|
// src/umb-management-api/tools/media/post/helpers/media-upload-helpers.ts
|
|
@@ -20351,14 +21120,14 @@ async function uploadMediaFile(client, params) {
|
|
|
20351
21120
|
}
|
|
20352
21121
|
|
|
20353
21122
|
// src/umb-management-api/tools/media/post/create-media.ts
|
|
20354
|
-
var createMediaSchema =
|
|
20355
|
-
sourceType:
|
|
20356
|
-
name:
|
|
20357
|
-
mediaTypeName:
|
|
20358
|
-
filePath:
|
|
20359
|
-
fileUrl:
|
|
20360
|
-
fileAsBase64:
|
|
20361
|
-
parentId:
|
|
21123
|
+
var createMediaSchema = z44.object({
|
|
21124
|
+
sourceType: z44.enum(["filePath", "url", "base64"]).describe("Media source type: 'filePath' for local files (most efficient), 'url' for web files, 'base64' for embedded data (small files only)"),
|
|
21125
|
+
name: z44.string().describe("The name of the media item"),
|
|
21126
|
+
mediaTypeName: z44.string().describe(`Media type: '${MEDIA_TYPE_IMAGE}', '${MEDIA_TYPE_ARTICLE}', '${MEDIA_TYPE_AUDIO}', '${MEDIA_TYPE_VIDEO}', '${MEDIA_TYPE_VECTOR_GRAPHICS}', '${MEDIA_TYPE_FILE}', or custom media type name`),
|
|
21127
|
+
filePath: z44.string().optional().describe("Absolute path to the file (required if sourceType is 'filePath')"),
|
|
21128
|
+
fileUrl: z44.string().url().optional().describe("URL to fetch the file from (required if sourceType is 'url')"),
|
|
21129
|
+
fileAsBase64: z44.string().optional().describe("Base64 encoded file data (required if sourceType is 'base64')"),
|
|
21130
|
+
parentId: z44.string().uuid().optional().describe("Parent folder ID (defaults to root)")
|
|
20362
21131
|
});
|
|
20363
21132
|
var CreateMediaTool = CreateUmbracoTool(
|
|
20364
21133
|
"create-media",
|
|
@@ -20425,17 +21194,17 @@ var CreateMediaTool = CreateUmbracoTool(
|
|
|
20425
21194
|
var create_media_default = CreateMediaTool;
|
|
20426
21195
|
|
|
20427
21196
|
// src/umb-management-api/tools/media/post/create-media-multiple.ts
|
|
20428
|
-
import { z as
|
|
21197
|
+
import { z as z45 } from "zod";
|
|
20429
21198
|
import { v4 as uuidv47 } from "uuid";
|
|
20430
|
-
var createMediaMultipleSchema =
|
|
20431
|
-
sourceType:
|
|
20432
|
-
files:
|
|
20433
|
-
name:
|
|
20434
|
-
filePath:
|
|
20435
|
-
fileUrl:
|
|
20436
|
-
mediaTypeName:
|
|
21199
|
+
var createMediaMultipleSchema = z45.object({
|
|
21200
|
+
sourceType: z45.enum(["filePath", "url"]).describe("Media source type: 'filePath' for local files (most efficient), 'url' for web files. Base64 not supported for batch uploads due to token usage."),
|
|
21201
|
+
files: z45.array(z45.object({
|
|
21202
|
+
name: z45.string().describe("The name of the media item"),
|
|
21203
|
+
filePath: z45.string().optional().describe("Absolute path to the file (required if sourceType is 'filePath')"),
|
|
21204
|
+
fileUrl: z45.string().url().optional().describe("URL to fetch the file from (required if sourceType is 'url')"),
|
|
21205
|
+
mediaTypeName: z45.string().optional().describe(`Optional override: '${MEDIA_TYPE_IMAGE}', '${MEDIA_TYPE_ARTICLE}', '${MEDIA_TYPE_AUDIO}', '${MEDIA_TYPE_VIDEO}', '${MEDIA_TYPE_VECTOR_GRAPHICS}', '${MEDIA_TYPE_FILE}', or custom media type name. If not specified, defaults to '${MEDIA_TYPE_FILE}'`)
|
|
20437
21206
|
})).describe("Array of files to upload (maximum 20 files per batch)"),
|
|
20438
|
-
parentId:
|
|
21207
|
+
parentId: z45.string().uuid().optional().describe("Parent folder ID (defaults to root)")
|
|
20439
21208
|
});
|
|
20440
21209
|
var CreateMediaMultipleTool = CreateUmbracoTool(
|
|
20441
21210
|
"create-media-multiple",
|
|
@@ -20552,7 +21321,7 @@ var GetMediaByIdTool = CreateUmbracoTool(
|
|
|
20552
21321
|
var get_media_by_id_default = GetMediaByIdTool;
|
|
20553
21322
|
|
|
20554
21323
|
// src/umb-management-api/tools/media/put/update-media.ts
|
|
20555
|
-
import { z as
|
|
21324
|
+
import { z as z46 } from "zod";
|
|
20556
21325
|
var UpdateMediaTool = CreateUmbracoTool(
|
|
20557
21326
|
"update-media",
|
|
20558
21327
|
`Updates a media item by Id
|
|
@@ -20561,7 +21330,7 @@ var UpdateMediaTool = CreateUmbracoTool(
|
|
|
20561
21330
|
This cannot be used for moving media to a new folder. Use the move endpoint to do that`,
|
|
20562
21331
|
{
|
|
20563
21332
|
id: putMediaByIdParams.shape.id,
|
|
20564
|
-
data:
|
|
21333
|
+
data: z46.object(putMediaByIdBody.shape)
|
|
20565
21334
|
},
|
|
20566
21335
|
async (model) => {
|
|
20567
21336
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -20640,13 +21409,13 @@ var ValidateMediaTool = CreateUmbracoTool(
|
|
|
20640
21409
|
var validate_media_default = ValidateMediaTool;
|
|
20641
21410
|
|
|
20642
21411
|
// src/umb-management-api/tools/media/put/validate-media.ts
|
|
20643
|
-
import { z as
|
|
21412
|
+
import { z as z47 } from "zod";
|
|
20644
21413
|
var ValidateMediaUpdateTool = CreateUmbracoTool(
|
|
20645
21414
|
"validate-media-update",
|
|
20646
21415
|
"Validates media data before updating an existing media item by Id",
|
|
20647
21416
|
{
|
|
20648
21417
|
id: putMediaByIdValidateParams.shape.id,
|
|
20649
|
-
data:
|
|
21418
|
+
data: z47.object(putMediaByIdValidateBody.shape)
|
|
20650
21419
|
},
|
|
20651
21420
|
async (model) => {
|
|
20652
21421
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -20705,13 +21474,13 @@ var GetMediaByIdArrayTool = CreateUmbracoTool(
|
|
|
20705
21474
|
var get_media_by_id_array_default = GetMediaByIdArrayTool;
|
|
20706
21475
|
|
|
20707
21476
|
// src/umb-management-api/tools/media/put/move-media.ts
|
|
20708
|
-
import { z as
|
|
21477
|
+
import { z as z48 } from "zod";
|
|
20709
21478
|
var MoveMediaTool = CreateUmbracoTool(
|
|
20710
21479
|
"move-media",
|
|
20711
21480
|
"Move a media item to a new location",
|
|
20712
21481
|
{
|
|
20713
|
-
id:
|
|
20714
|
-
data:
|
|
21482
|
+
id: z48.string().uuid(),
|
|
21483
|
+
data: z48.object(putMediaByIdMoveBody.shape)
|
|
20715
21484
|
},
|
|
20716
21485
|
async (model) => {
|
|
20717
21486
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -20809,13 +21578,13 @@ var GetMediaRootTool = CreateUmbracoTool(
|
|
|
20809
21578
|
var get_root_default6 = GetMediaRootTool;
|
|
20810
21579
|
|
|
20811
21580
|
// src/umb-management-api/tools/media/get/get-media-audit-log.ts
|
|
20812
|
-
import { z as
|
|
21581
|
+
import { z as z49 } from "zod";
|
|
20813
21582
|
var GetMediaAuditLogTool = CreateUmbracoTool(
|
|
20814
21583
|
"get-media-audit-log",
|
|
20815
21584
|
"Fetches the audit log for a media item by Id.",
|
|
20816
21585
|
{
|
|
20817
21586
|
id: getMediaByIdAuditLogParams.shape.id,
|
|
20818
|
-
data:
|
|
21587
|
+
data: z49.object(getMediaByIdAuditLogQueryParams.shape)
|
|
20819
21588
|
},
|
|
20820
21589
|
async (model) => {
|
|
20821
21590
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -21016,12 +21785,12 @@ var GetMediaAreReferencedTool = CreateUmbracoTool(
|
|
|
21016
21785
|
var get_media_are_referenced_default = GetMediaAreReferencedTool;
|
|
21017
21786
|
|
|
21018
21787
|
// src/umb-management-api/tools/media/get/get-media-by-id-referenced-by.ts
|
|
21019
|
-
import { z as
|
|
21788
|
+
import { z as z50 } from "zod";
|
|
21020
21789
|
var GetMediaByIdReferencedByTool = CreateUmbracoTool(
|
|
21021
21790
|
"get-media-by-id-referenced-by",
|
|
21022
21791
|
`Get items that reference a specific media item
|
|
21023
21792
|
Use this to find all content, documents, or other items that are currently referencing a specific media item.`,
|
|
21024
|
-
|
|
21793
|
+
z50.object({
|
|
21025
21794
|
...getMediaByIdReferencedByParams.shape,
|
|
21026
21795
|
...getMediaByIdReferencedByQueryParams.shape
|
|
21027
21796
|
}).shape,
|
|
@@ -21041,7 +21810,7 @@ var GetMediaByIdReferencedByTool = CreateUmbracoTool(
|
|
|
21041
21810
|
var get_media_by_id_referenced_by_default = GetMediaByIdReferencedByTool;
|
|
21042
21811
|
|
|
21043
21812
|
// src/umb-management-api/tools/media/get/get-media-by-id-referenced-descendants.ts
|
|
21044
|
-
import { z as
|
|
21813
|
+
import { z as z51 } from "zod";
|
|
21045
21814
|
var GetMediaByIdReferencedDescendantsTool = CreateUmbracoTool(
|
|
21046
21815
|
"get-media-by-id-referenced-descendants",
|
|
21047
21816
|
`Get descendant references for a media item
|
|
@@ -21051,7 +21820,7 @@ var GetMediaByIdReferencedDescendantsTool = CreateUmbracoTool(
|
|
|
21051
21820
|
\u2022 Impact analysis: Before deleting a media folder, see what content would be affected
|
|
21052
21821
|
\u2022 Dependency tracking: Find all content using media from a specific folder hierarchy
|
|
21053
21822
|
\u2022 Content auditing: Identify which descendant media items are actually being used`,
|
|
21054
|
-
|
|
21823
|
+
z51.object({
|
|
21055
21824
|
...getMediaByIdReferencedDescendantsParams.shape,
|
|
21056
21825
|
...getMediaByIdReferencedDescendantsQueryParams.shape
|
|
21057
21826
|
}).shape,
|
|
@@ -21231,12 +22000,12 @@ var GetMediaTypeByIdTool = CreateUmbracoTool(
|
|
|
21231
22000
|
var get_media_type_by_id_default = GetMediaTypeByIdTool;
|
|
21232
22001
|
|
|
21233
22002
|
// src/umb-management-api/tools/media-type/get/get-media-type-by-ids.ts
|
|
21234
|
-
import { z as
|
|
22003
|
+
import { z as z52 } from "zod";
|
|
21235
22004
|
var GetMediaTypeByIdsTool = CreateUmbracoTool(
|
|
21236
22005
|
"get-media-type-by-ids",
|
|
21237
22006
|
"Gets media types by ids",
|
|
21238
22007
|
{
|
|
21239
|
-
ids:
|
|
22008
|
+
ids: z52.array(z52.string())
|
|
21240
22009
|
},
|
|
21241
22010
|
async ({ ids }) => {
|
|
21242
22011
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -21522,13 +22291,13 @@ var DeleteMediaTypeFolderTool = CreateUmbracoTool(
|
|
|
21522
22291
|
var delete_folder_default4 = DeleteMediaTypeFolderTool;
|
|
21523
22292
|
|
|
21524
22293
|
// src/umb-management-api/tools/media-type/folders/put/update-folder.ts
|
|
21525
|
-
import { z as
|
|
22294
|
+
import { z as z53 } from "zod";
|
|
21526
22295
|
var UpdateMediaTypeFolderTool = CreateUmbracoTool(
|
|
21527
22296
|
"update-media-type-folder",
|
|
21528
22297
|
"Updates a media type folder by Id",
|
|
21529
22298
|
{
|
|
21530
22299
|
id: putMediaTypeFolderByIdParams.shape.id,
|
|
21531
|
-
data:
|
|
22300
|
+
data: z53.object(putMediaTypeFolderByIdBody.shape)
|
|
21532
22301
|
},
|
|
21533
22302
|
async (model) => {
|
|
21534
22303
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -21546,25 +22315,25 @@ var UpdateMediaTypeFolderTool = CreateUmbracoTool(
|
|
|
21546
22315
|
var update_folder_default4 = UpdateMediaTypeFolderTool;
|
|
21547
22316
|
|
|
21548
22317
|
// src/umb-management-api/tools/media-type/post/create-media-type.ts
|
|
21549
|
-
import { z as
|
|
21550
|
-
var
|
|
22318
|
+
import { z as z54 } from "zod";
|
|
22319
|
+
var propertySchema3 = postMediaTypeBody.shape.properties;
|
|
21551
22320
|
var containerSchema = postMediaTypeBody.shape.containers;
|
|
21552
22321
|
var allowedMediaTypeSchema = postMediaTypeBody.shape.allowedMediaTypes;
|
|
21553
22322
|
var compositionSchema = postMediaTypeBody.shape.compositions;
|
|
21554
22323
|
var collectionSchema = postMediaTypeBody.shape.collection;
|
|
21555
|
-
var createMediaTypeSchema =
|
|
21556
|
-
alias:
|
|
21557
|
-
name:
|
|
21558
|
-
description:
|
|
21559
|
-
icon:
|
|
21560
|
-
allowedAsRoot:
|
|
21561
|
-
variesByCulture:
|
|
21562
|
-
variesBySegment:
|
|
21563
|
-
isElement:
|
|
21564
|
-
properties:
|
|
22324
|
+
var createMediaTypeSchema = z54.object({
|
|
22325
|
+
alias: z54.string().min(1),
|
|
22326
|
+
name: z54.string().min(1),
|
|
22327
|
+
description: z54.string().nullish(),
|
|
22328
|
+
icon: z54.string().min(1),
|
|
22329
|
+
allowedAsRoot: z54.boolean(),
|
|
22330
|
+
variesByCulture: z54.boolean(),
|
|
22331
|
+
variesBySegment: z54.boolean(),
|
|
22332
|
+
isElement: z54.boolean(),
|
|
22333
|
+
properties: propertySchema3,
|
|
21565
22334
|
containers: containerSchema,
|
|
21566
|
-
id:
|
|
21567
|
-
parentId:
|
|
22335
|
+
id: z54.string().uuid().nullish(),
|
|
22336
|
+
parentId: z54.string().uuid().optional(),
|
|
21568
22337
|
// Flattened parent ID
|
|
21569
22338
|
allowedMediaTypes: allowedMediaTypeSchema,
|
|
21570
22339
|
compositions: compositionSchema,
|
|
@@ -21607,13 +22376,13 @@ var CreateMediaTypeTool = CreateUmbracoTool(
|
|
|
21607
22376
|
var create_media_type_default = CreateMediaTypeTool;
|
|
21608
22377
|
|
|
21609
22378
|
// src/umb-management-api/tools/media-type/post/copy-media-type.ts
|
|
21610
|
-
import { z as
|
|
22379
|
+
import { z as z55 } from "zod";
|
|
21611
22380
|
var CopyMediaTypeTool = CreateUmbracoTool(
|
|
21612
22381
|
"copy-media-type",
|
|
21613
22382
|
"Copy a media type to a new location",
|
|
21614
22383
|
{
|
|
21615
|
-
id:
|
|
21616
|
-
data:
|
|
22384
|
+
id: z55.string().uuid(),
|
|
22385
|
+
data: z55.object(postMediaTypeByIdCopyBody.shape)
|
|
21617
22386
|
},
|
|
21618
22387
|
async (model) => {
|
|
21619
22388
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -21651,13 +22420,13 @@ var GetMediaTypeAvailableCompositionsTool = CreateUmbracoTool(
|
|
|
21651
22420
|
var get_media_type_available_compositions_default = GetMediaTypeAvailableCompositionsTool;
|
|
21652
22421
|
|
|
21653
22422
|
// src/umb-management-api/tools/media-type/put/update-media-type.ts
|
|
21654
|
-
import { z as
|
|
22423
|
+
import { z as z56 } from "zod";
|
|
21655
22424
|
var UpdateMediaTypeTool = CreateUmbracoTool(
|
|
21656
22425
|
"update-media-type",
|
|
21657
22426
|
"Updates a media type by Id",
|
|
21658
22427
|
{
|
|
21659
22428
|
id: putMediaTypeByIdParams.shape.id,
|
|
21660
|
-
data:
|
|
22429
|
+
data: z56.object(putMediaTypeByIdBody.shape)
|
|
21661
22430
|
},
|
|
21662
22431
|
async (model) => {
|
|
21663
22432
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -21675,13 +22444,13 @@ var UpdateMediaTypeTool = CreateUmbracoTool(
|
|
|
21675
22444
|
var update_media_type_default = UpdateMediaTypeTool;
|
|
21676
22445
|
|
|
21677
22446
|
// src/umb-management-api/tools/media-type/put/move-media-type.ts
|
|
21678
|
-
import { z as
|
|
22447
|
+
import { z as z57 } from "zod";
|
|
21679
22448
|
var MoveMediaTypeTool = CreateUmbracoTool(
|
|
21680
22449
|
"move-media-type",
|
|
21681
22450
|
"Move a media type to a new location",
|
|
21682
22451
|
{
|
|
21683
|
-
id:
|
|
21684
|
-
data:
|
|
22452
|
+
id: z57.string().uuid(),
|
|
22453
|
+
data: z57.object(putMediaTypeByIdMoveBody.shape)
|
|
21685
22454
|
},
|
|
21686
22455
|
async (model) => {
|
|
21687
22456
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -21842,13 +22611,13 @@ var DeleteMemberTool = CreateUmbracoTool(
|
|
|
21842
22611
|
var delete_member_default = DeleteMemberTool;
|
|
21843
22612
|
|
|
21844
22613
|
// src/umb-management-api/tools/member/put/update-member.ts
|
|
21845
|
-
import { z as
|
|
22614
|
+
import { z as z58 } from "zod";
|
|
21846
22615
|
var UpdateMemberTool = CreateUmbracoTool(
|
|
21847
22616
|
"update-member",
|
|
21848
22617
|
"Updates a member by Id",
|
|
21849
22618
|
{
|
|
21850
22619
|
id: putMemberByIdParams.shape.id,
|
|
21851
|
-
data:
|
|
22620
|
+
data: z58.object(putMemberByIdBody.shape)
|
|
21852
22621
|
},
|
|
21853
22622
|
async (model) => {
|
|
21854
22623
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -21866,14 +22635,14 @@ var UpdateMemberTool = CreateUmbracoTool(
|
|
|
21866
22635
|
var update_member_default = UpdateMemberTool;
|
|
21867
22636
|
|
|
21868
22637
|
// src/umb-management-api/tools/member/put/validate-member-update.ts
|
|
21869
|
-
import { z as
|
|
22638
|
+
import { z as z59 } from "zod";
|
|
21870
22639
|
var ValidateMemberUpdateTool = CreateUmbracoTool(
|
|
21871
22640
|
"validate-member-update",
|
|
21872
22641
|
`Validates member data before updating using the Umbraco API.
|
|
21873
22642
|
Use this endpoint to validate member data structure, properties, and business rules before attempting to update an existing member.`,
|
|
21874
22643
|
{
|
|
21875
22644
|
id: putMemberByIdValidateParams.shape.id,
|
|
21876
|
-
data:
|
|
22645
|
+
data: z59.object(putMemberByIdValidateBody.shape)
|
|
21877
22646
|
},
|
|
21878
22647
|
async (model) => {
|
|
21879
22648
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -21932,12 +22701,12 @@ var GetMemberAreReferencedTool = CreateUmbracoTool(
|
|
|
21932
22701
|
var get_member_are_referenced_default = GetMemberAreReferencedTool;
|
|
21933
22702
|
|
|
21934
22703
|
// src/umb-management-api/tools/member/get/get-member-by-id-referenced-by.ts
|
|
21935
|
-
import { z as
|
|
22704
|
+
import { z as z60 } from "zod";
|
|
21936
22705
|
var GetMemberByIdReferencedByTool = CreateUmbracoTool(
|
|
21937
22706
|
"get-member-by-id-referenced-by",
|
|
21938
22707
|
`Get items that reference a specific member
|
|
21939
22708
|
Use this to find all content, documents, or other items that are currently referencing a specific member account.`,
|
|
21940
|
-
|
|
22709
|
+
z60.object({
|
|
21941
22710
|
...getMemberByIdReferencedByParams.shape,
|
|
21942
22711
|
...getMemberByIdReferencedByQueryParams.shape
|
|
21943
22712
|
}).shape,
|
|
@@ -21957,12 +22726,12 @@ var GetMemberByIdReferencedByTool = CreateUmbracoTool(
|
|
|
21957
22726
|
var get_member_by_id_referenced_by_default = GetMemberByIdReferencedByTool;
|
|
21958
22727
|
|
|
21959
22728
|
// src/umb-management-api/tools/member/get/get-member-by-id-referenced-descendants.ts
|
|
21960
|
-
import { z as
|
|
22729
|
+
import { z as z61 } from "zod";
|
|
21961
22730
|
var GetMemberByIdReferencedDescendantsTool = CreateUmbracoTool(
|
|
21962
22731
|
"get-member-by-id-referenced-descendants",
|
|
21963
22732
|
`Get descendant references for a member
|
|
21964
22733
|
Use this to find all descendant references that are being referenced for a specific member account.`,
|
|
21965
|
-
|
|
22734
|
+
z61.object({
|
|
21966
22735
|
...getMemberByIdReferencedDescendantsParams.shape,
|
|
21967
22736
|
...getMemberByIdReferencedDescendantsQueryParams.shape
|
|
21968
22737
|
}).shape,
|
|
@@ -22130,13 +22899,13 @@ var CreateMemberGroupTool = CreateUmbracoTool(
|
|
|
22130
22899
|
var create_member_group_default = CreateMemberGroupTool;
|
|
22131
22900
|
|
|
22132
22901
|
// src/umb-management-api/tools/member-group/put/update-member-group.ts
|
|
22133
|
-
import { z as
|
|
22902
|
+
import { z as z62 } from "zod";
|
|
22134
22903
|
var UpdateMemberGroupTool = CreateUmbracoTool(
|
|
22135
22904
|
"update-member-group",
|
|
22136
22905
|
"Updates a member group by Id",
|
|
22137
22906
|
{
|
|
22138
22907
|
id: putMemberGroupByIdParams.shape.id,
|
|
22139
|
-
data:
|
|
22908
|
+
data: z62.object(putMemberGroupByIdBody.shape)
|
|
22140
22909
|
},
|
|
22141
22910
|
async (model) => {
|
|
22142
22911
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -22279,13 +23048,13 @@ var DeleteMemberTypeTool = CreateUmbracoTool(
|
|
|
22279
23048
|
var delete_member_type_default = DeleteMemberTypeTool;
|
|
22280
23049
|
|
|
22281
23050
|
// src/umb-management-api/tools/member-type/put/update-member-type.ts
|
|
22282
|
-
import { z as
|
|
23051
|
+
import { z as z63 } from "zod";
|
|
22283
23052
|
var UpdateMemberTypeTool = CreateUmbracoTool(
|
|
22284
23053
|
"update-member-type",
|
|
22285
23054
|
"Updates a member type by id",
|
|
22286
23055
|
{
|
|
22287
23056
|
id: putMemberTypeByIdParams.shape.id,
|
|
22288
|
-
data:
|
|
23057
|
+
data: z63.object(putMemberTypeByIdBody.shape)
|
|
22289
23058
|
},
|
|
22290
23059
|
async (model) => {
|
|
22291
23060
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -22303,12 +23072,12 @@ var UpdateMemberTypeTool = CreateUmbracoTool(
|
|
|
22303
23072
|
var update_member_type_default = UpdateMemberTypeTool;
|
|
22304
23073
|
|
|
22305
23074
|
// src/umb-management-api/tools/member-type/post/copy-member-type.ts
|
|
22306
|
-
import { z as
|
|
23075
|
+
import { z as z64 } from "zod";
|
|
22307
23076
|
var CopyMemberTypeTool = CreateUmbracoTool(
|
|
22308
23077
|
"copy-member-type",
|
|
22309
23078
|
"Copy a member type to a new location",
|
|
22310
23079
|
{
|
|
22311
|
-
id:
|
|
23080
|
+
id: z64.string().uuid()
|
|
22312
23081
|
},
|
|
22313
23082
|
async (model) => {
|
|
22314
23083
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -22679,11 +23448,11 @@ var LogViewerCollection = {
|
|
|
22679
23448
|
};
|
|
22680
23449
|
|
|
22681
23450
|
// src/umb-management-api/tools/partial-view/post/create-partial-view.ts
|
|
22682
|
-
import
|
|
22683
|
-
var createPartialViewSchema =
|
|
22684
|
-
name:
|
|
22685
|
-
path:
|
|
22686
|
-
content:
|
|
23451
|
+
import z65 from "zod";
|
|
23452
|
+
var createPartialViewSchema = z65.object({
|
|
23453
|
+
name: z65.string().min(1, "Name is required"),
|
|
23454
|
+
path: z65.string().optional(),
|
|
23455
|
+
content: z65.string().min(1, "Content is required")
|
|
22687
23456
|
});
|
|
22688
23457
|
var CreatePartialViewTool = CreateUmbracoTool(
|
|
22689
23458
|
"create-partial-view",
|
|
@@ -22773,11 +23542,11 @@ var GetPartialViewFolderByPathTool = CreateUmbracoTool(
|
|
|
22773
23542
|
var get_partial_view_folder_by_path_default = GetPartialViewFolderByPathTool;
|
|
22774
23543
|
|
|
22775
23544
|
// src/umb-management-api/tools/partial-view/put/update-partial-view.ts
|
|
22776
|
-
import { z as
|
|
23545
|
+
import { z as z66 } from "zod";
|
|
22777
23546
|
var UpdatePartialViewTool = CreateUmbracoTool(
|
|
22778
23547
|
"update-partial-view",
|
|
22779
23548
|
"Updates a partial view",
|
|
22780
|
-
|
|
23549
|
+
z66.object({
|
|
22781
23550
|
...putPartialViewByPathParams.shape,
|
|
22782
23551
|
...putPartialViewByPathBody.shape
|
|
22783
23552
|
}).shape,
|
|
@@ -22798,11 +23567,11 @@ var UpdatePartialViewTool = CreateUmbracoTool(
|
|
|
22798
23567
|
var update_partial_view_default = UpdatePartialViewTool;
|
|
22799
23568
|
|
|
22800
23569
|
// src/umb-management-api/tools/partial-view/put/rename-partial-view.ts
|
|
22801
|
-
import { z as
|
|
23570
|
+
import { z as z67 } from "zod";
|
|
22802
23571
|
var RenamePartialViewTool = CreateUmbracoTool(
|
|
22803
23572
|
"rename-partial-view",
|
|
22804
23573
|
`Renames a partial view`,
|
|
22805
|
-
|
|
23574
|
+
z67.object({
|
|
22806
23575
|
...putPartialViewByPathRenameParams.shape,
|
|
22807
23576
|
...putPartialViewByPathRenameBody.shape
|
|
22808
23577
|
}).shape,
|
|
@@ -23152,13 +23921,13 @@ var GetTemplatesByIdArrayTool = CreateUmbracoTool(
|
|
|
23152
23921
|
var get_template_by_id_array_default = GetTemplatesByIdArrayTool;
|
|
23153
23922
|
|
|
23154
23923
|
// src/umb-management-api/tools/template/put/update-template.ts
|
|
23155
|
-
import { z as
|
|
23924
|
+
import { z as z68 } from "zod";
|
|
23156
23925
|
var UpdateTemplateTool = CreateUmbracoTool(
|
|
23157
23926
|
"update-template",
|
|
23158
23927
|
"Updates a template by Id",
|
|
23159
23928
|
{
|
|
23160
23929
|
id: putTemplateByIdParams.shape.id,
|
|
23161
|
-
data:
|
|
23930
|
+
data: z68.object(putTemplateByIdBody.shape)
|
|
23162
23931
|
},
|
|
23163
23932
|
async (model) => {
|
|
23164
23933
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -23454,13 +24223,13 @@ var DeleteWebhookTool = CreateUmbracoTool(
|
|
|
23454
24223
|
var delete_webhook_default = DeleteWebhookTool;
|
|
23455
24224
|
|
|
23456
24225
|
// src/umb-management-api/tools/webhook/put/update-webhook.ts
|
|
23457
|
-
import { z as
|
|
24226
|
+
import { z as z69 } from "zod";
|
|
23458
24227
|
var UpdateWebhookTool = CreateUmbracoTool(
|
|
23459
24228
|
"update-webhook",
|
|
23460
24229
|
"Updates a webhook by id",
|
|
23461
24230
|
{
|
|
23462
24231
|
id: putWebhookByIdParams.shape.id,
|
|
23463
|
-
data:
|
|
24232
|
+
data: z69.object(putWebhookByIdBody.shape)
|
|
23464
24233
|
},
|
|
23465
24234
|
async (model) => {
|
|
23466
24235
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -24060,13 +24829,13 @@ var CreateUserGroupTool = CreateUmbracoTool(
|
|
|
24060
24829
|
var create_user_group_default = CreateUserGroupTool;
|
|
24061
24830
|
|
|
24062
24831
|
// src/umb-management-api/tools/user-group/put/update-user-group.ts
|
|
24063
|
-
import { z as
|
|
24832
|
+
import { z as z70 } from "zod";
|
|
24064
24833
|
var UpdateUserGroupTool = CreateUmbracoTool(
|
|
24065
24834
|
"update-user-group",
|
|
24066
24835
|
"Updates a user group by Id",
|
|
24067
24836
|
{
|
|
24068
24837
|
id: putUserGroupByIdParams.shape.id,
|
|
24069
|
-
data:
|
|
24838
|
+
data: z70.object(putUserGroupByIdBody.shape)
|
|
24070
24839
|
},
|
|
24071
24840
|
async (model) => {
|
|
24072
24841
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -24148,14 +24917,14 @@ var UserGroupCollection = {
|
|
|
24148
24917
|
};
|
|
24149
24918
|
|
|
24150
24919
|
// src/umb-management-api/tools/temporary-file/post/create-temporary-file.ts
|
|
24151
|
-
import { z as
|
|
24920
|
+
import { z as z71 } from "zod";
|
|
24152
24921
|
import * as fs3 from "fs";
|
|
24153
24922
|
import * as os2 from "os";
|
|
24154
24923
|
import * as path3 from "path";
|
|
24155
|
-
var createTemporaryFileSchema =
|
|
24156
|
-
id:
|
|
24157
|
-
fileName:
|
|
24158
|
-
fileAsBase64:
|
|
24924
|
+
var createTemporaryFileSchema = z71.object({
|
|
24925
|
+
id: z71.string().uuid().describe("Unique identifier for the temporary file"),
|
|
24926
|
+
fileName: z71.string().describe("Name of the file"),
|
|
24927
|
+
fileAsBase64: z71.string().describe("File content encoded as base64 string")
|
|
24159
24928
|
});
|
|
24160
24929
|
var CreateTemporaryFileTool = CreateUmbracoTool(
|
|
24161
24930
|
"create-temporary-file",
|
|
@@ -24460,11 +25229,11 @@ var GetScriptTreeSiblingsTool = CreateUmbracoTool(
|
|
|
24460
25229
|
var get_script_tree_siblings_default = GetScriptTreeSiblingsTool;
|
|
24461
25230
|
|
|
24462
25231
|
// src/umb-management-api/tools/script/post/create-script.ts
|
|
24463
|
-
import
|
|
24464
|
-
var createScriptSchema =
|
|
24465
|
-
name:
|
|
24466
|
-
path:
|
|
24467
|
-
content:
|
|
25232
|
+
import z72 from "zod";
|
|
25233
|
+
var createScriptSchema = z72.object({
|
|
25234
|
+
name: z72.string().min(1, "Name is required"),
|
|
25235
|
+
path: z72.string().optional(),
|
|
25236
|
+
content: z72.string().min(1, "Content is required")
|
|
24468
25237
|
});
|
|
24469
25238
|
var CreateScriptTool = CreateUmbracoTool(
|
|
24470
25239
|
"create-script",
|
|
@@ -24513,13 +25282,13 @@ var CreateScriptFolderTool = CreateUmbracoTool(
|
|
|
24513
25282
|
var create_script_folder_default = CreateScriptFolderTool;
|
|
24514
25283
|
|
|
24515
25284
|
// src/umb-management-api/tools/script/put/update-script.ts
|
|
24516
|
-
import { z as
|
|
25285
|
+
import { z as z73 } from "zod";
|
|
24517
25286
|
var UpdateScriptTool = CreateUmbracoTool(
|
|
24518
25287
|
"update-script",
|
|
24519
25288
|
"Updates a script by path",
|
|
24520
25289
|
{
|
|
24521
25290
|
path: putScriptByPathParams.shape.path,
|
|
24522
|
-
data:
|
|
25291
|
+
data: z73.object(putScriptByPathBody.shape)
|
|
24523
25292
|
},
|
|
24524
25293
|
async (model) => {
|
|
24525
25294
|
const client = UmbracoManagementClient2.getClient();
|
|
@@ -24537,11 +25306,11 @@ var UpdateScriptTool = CreateUmbracoTool(
|
|
|
24537
25306
|
var update_script_default = UpdateScriptTool;
|
|
24538
25307
|
|
|
24539
25308
|
// src/umb-management-api/tools/script/put/rename-script.ts
|
|
24540
|
-
import { z as
|
|
24541
|
-
var renameScriptSchema =
|
|
24542
|
-
name:
|
|
24543
|
-
folderPath:
|
|
24544
|
-
newName:
|
|
25309
|
+
import { z as z74 } from "zod";
|
|
25310
|
+
var renameScriptSchema = z74.object({
|
|
25311
|
+
name: z74.string().min(1, "Current script name is required"),
|
|
25312
|
+
folderPath: z74.string().optional().describe("Path to the folder containing the script (optional, leave empty for root)"),
|
|
25313
|
+
newName: z74.string().min(1, "New script name is required")
|
|
24545
25314
|
});
|
|
24546
25315
|
var RenameScriptTool = CreateUmbracoTool(
|
|
24547
25316
|
"rename-script",
|
|
@@ -24640,11 +25409,11 @@ var ScriptCollection = {
|
|
|
24640
25409
|
};
|
|
24641
25410
|
|
|
24642
25411
|
// src/umb-management-api/tools/stylesheet/post/create-stylesheet.ts
|
|
24643
|
-
import { z as
|
|
24644
|
-
var createStylesheetSchema =
|
|
24645
|
-
name:
|
|
24646
|
-
path:
|
|
24647
|
-
content:
|
|
25412
|
+
import { z as z75 } from "zod";
|
|
25413
|
+
var createStylesheetSchema = z75.object({
|
|
25414
|
+
name: z75.string().min(1, "Name is required"),
|
|
25415
|
+
path: z75.string().optional(),
|
|
25416
|
+
content: z75.string().min(1, "Content is required")
|
|
24648
25417
|
});
|
|
24649
25418
|
var CreateStylesheetTool = CreateUmbracoTool(
|
|
24650
25419
|
"create-stylesheet",
|
|
@@ -24733,11 +25502,11 @@ var GetStylesheetFolderByPathTool = CreateUmbracoTool(
|
|
|
24733
25502
|
var get_stylesheet_folder_by_path_default = GetStylesheetFolderByPathTool;
|
|
24734
25503
|
|
|
24735
25504
|
// src/umb-management-api/tools/stylesheet/put/update-stylesheet.ts
|
|
24736
|
-
import { z as
|
|
25505
|
+
import { z as z76 } from "zod";
|
|
24737
25506
|
var UpdateStylesheetTool = CreateUmbracoTool(
|
|
24738
25507
|
"update-stylesheet",
|
|
24739
25508
|
"Updates a stylesheet by path",
|
|
24740
|
-
|
|
25509
|
+
z76.object({
|
|
24741
25510
|
...putStylesheetByPathParams.shape,
|
|
24742
25511
|
...putStylesheetByPathBody.shape
|
|
24743
25512
|
}).shape,
|
|
@@ -24758,11 +25527,11 @@ var UpdateStylesheetTool = CreateUmbracoTool(
|
|
|
24758
25527
|
var update_stylesheet_default = UpdateStylesheetTool;
|
|
24759
25528
|
|
|
24760
25529
|
// src/umb-management-api/tools/stylesheet/put/rename-stylesheet.ts
|
|
24761
|
-
import { z as
|
|
25530
|
+
import { z as z77 } from "zod";
|
|
24762
25531
|
var RenameStylesheetTool = CreateUmbracoTool(
|
|
24763
25532
|
"rename-stylesheet",
|
|
24764
25533
|
`Renames a stylesheet`,
|
|
24765
|
-
|
|
25534
|
+
z77.object({
|
|
24766
25535
|
...putStylesheetByPathRenameParams.shape,
|
|
24767
25536
|
...putStylesheetByPathRenameBody.shape
|
|
24768
25537
|
}).shape,
|
|
@@ -25518,11 +26287,11 @@ var RelationTypeCollection = {
|
|
|
25518
26287
|
};
|
|
25519
26288
|
|
|
25520
26289
|
// src/umb-management-api/tools/relation/get/get-relation-by-relation-type-id.ts
|
|
25521
|
-
import { z as
|
|
26290
|
+
import { z as z78 } from "zod";
|
|
25522
26291
|
var GetRelationByRelationTypeIdTool = CreateUmbracoTool(
|
|
25523
26292
|
"get-relation-by-relation-type-id",
|
|
25524
26293
|
"Gets relations by relation type ID",
|
|
25525
|
-
|
|
26294
|
+
z78.object({
|
|
25526
26295
|
...getRelationByRelationTypeIdParams.shape,
|
|
25527
26296
|
...getRelationByRelationTypeIdQueryParams.shape
|
|
25528
26297
|
}).shape,
|