@umbraco-cms/mcp-dev 17.6.12 → 17.6.13

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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;var __create = Object.create;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -14589,6 +14589,32 @@ var GetDocumentPublishTool = {
14589
14589
  };
14590
14590
  var get_document_publish_default = _mcpserversdk.withStandardDecorators.call(void 0, GetDocumentPublishTool);
14591
14591
 
14592
+ // src/umbraco-api/tools/document/get/get-document-publish-with-descendants-result.ts
14593
+
14594
+
14595
+
14596
+
14597
+
14598
+ var GetDocumentPublishWithDescendantsResultTool = {
14599
+ name: "get-document-publish-with-descendants-result",
14600
+ description: `Gets the status/result of an in-progress or previously-polled publish-with-descendants operation by Id and taskId.
14601
+ Use this to follow up after publish-document-with-descendants reports the publish is still running, or returned an error.
14602
+ Returns isComplete: true once the publish has finished. If some descendants failed to publish, this returns an error result carrying the failed branch items.`,
14603
+ inputSchema: getDocumentByIdPublishWithDescendantsResultByTaskIdParams.shape,
14604
+ outputSchema: getDocumentByIdPublishWithDescendantsResultByTaskIdResponse.shape,
14605
+ annotations: {
14606
+ readOnlyHint: true
14607
+ },
14608
+ slices: ["publish"],
14609
+ enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Publish),
14610
+ handler: (async ({ id, taskId }) => {
14611
+ return _mcpserversdk.executeGetApiCall.call(void 0,
14612
+ (client) => client.getDocumentByIdPublishWithDescendantsResultByTaskId(id, taskId, _mcpserversdk.CAPTURE_RAW_HTTP_RESPONSE)
14613
+ );
14614
+ })
14615
+ };
14616
+ var get_document_publish_with_descendants_result_default = _mcpserversdk.withStandardDecorators.call(void 0, GetDocumentPublishWithDescendantsResultTool);
14617
+
14592
14618
  // src/umbraco-api/tools/document/get/get-document-configuration.ts
14593
14619
 
14594
14620
 
@@ -15530,6 +15556,9 @@ var put_document_notifications_default = _mcpserversdk.withStandardDecorators.ca
15530
15556
 
15531
15557
 
15532
15558
 
15559
+
15560
+
15561
+
15533
15562
  var inputSchema12 = {
15534
15563
  id: _zod.z.string().uuid(),
15535
15564
  data: _zod.z.object(putDocumentByIdPublishWithDescendantsBody.shape)
@@ -15537,7 +15566,7 @@ var inputSchema12 = {
15537
15566
  var PublishDocumentWithDescendantsTool = {
15538
15567
  name: "publish-document-with-descendants",
15539
15568
  description: `Publishes a document and its descendants by Id. This is an asynchronous operation that may take time for large document trees.
15540
- The tool will poll for completion and return the final result when finished.`,
15569
+ 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.`,
15541
15570
  inputSchema: inputSchema12,
15542
15571
  annotations: {},
15543
15572
  slices: ["publish"],
@@ -15564,12 +15593,25 @@ var PublishDocumentWithDescendantsTool = {
15564
15593
  while (attempts < maxAttempts) {
15565
15594
  attempts++;
15566
15595
  await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
15596
+ let statusResponse;
15567
15597
  try {
15568
- const statusResponse = await client.getDocumentByIdPublishWithDescendantsResultByTaskId(
15598
+ statusResponse = await client.getDocumentByIdPublishWithDescendantsResultByTaskId(
15569
15599
  model.id,
15570
- initialResponse.taskId
15600
+ initialResponse.taskId,
15601
+ _mcpserversdk.CAPTURE_RAW_HTTP_RESPONSE
15571
15602
  );
15572
- if (statusResponse.isComplete) {
15603
+ } catch (error) {
15604
+ return _mcpserversdk.createToolResultError.call(void 0, {
15605
+ type: "Error",
15606
+ title: "Failed to poll publish-with-descendants status",
15607
+ detail: error instanceof Error ? error.message : String(error),
15608
+ status: 500,
15609
+ taskId: initialResponse.taskId
15610
+ });
15611
+ }
15612
+ if (statusResponse.status >= 200 && statusResponse.status < 300) {
15613
+ const data = statusResponse.data;
15614
+ if (_optionalChain([data, 'optionalAccess', _23 => _23.isComplete])) {
15573
15615
  return {
15574
15616
  content: [
15575
15617
  {
@@ -15579,29 +15621,22 @@ var PublishDocumentWithDescendantsTool = {
15579
15621
  ]
15580
15622
  };
15581
15623
  }
15582
- } catch (error) {
15583
- return {
15584
- content: [
15585
- {
15586
- type: "text",
15587
- text: JSON.stringify({
15588
- status: "error",
15589
- taskId: initialResponse.taskId,
15590
- message: `Failed to poll status: ${error}. You can manually check status using taskId.`
15591
- })
15592
- }
15593
- ]
15594
- };
15624
+ continue;
15595
15625
  }
15626
+ return _mcpserversdk.createToolResultError.call(void 0, {
15627
+ ..._mcpserversdk.toProblemDetails.call(void 0, statusResponse),
15628
+ documentId: model.id,
15629
+ taskId: initialResponse.taskId
15630
+ });
15596
15631
  }
15597
15632
  return {
15598
15633
  content: [
15599
15634
  {
15600
15635
  type: "text",
15601
15636
  text: JSON.stringify({
15602
- status: "timeout",
15637
+ status: "in-progress",
15603
15638
  taskId: initialResponse.taskId,
15604
- message: "Publish operation timed out after 1 minute. The operation may still be running. Use the taskId to check status manually."
15639
+ message: `Publishing is still in progress after 60 seconds. Use get-document-publish-with-descendants-result with id "${model.id}" and taskId "${initialResponse.taskId}" to check whether it has finished.`
15605
15640
  })
15606
15641
  }
15607
15642
  ]
@@ -15878,14 +15913,14 @@ var UpdateDocumentTool = {
15878
15913
  slices: ["update"],
15879
15914
  enabled: (user) => user.fallbackPermissions.includes(UmbracoDocumentPermissions.Update),
15880
15915
  handler: (async (model) => {
15881
- const incomingValues = _optionalChain([model, 'access', _23 => _23.data, 'optionalAccess', _24 => _24.values]);
15916
+ const incomingValues = _optionalChain([model, 'access', _24 => _24.data, 'optionalAccess', _25 => _25.values]);
15882
15917
  if (Array.isArray(incomingValues) && incomingValues.length === 0 && !model.confirmClearValues) {
15883
15918
  const client = UmbracoManagementClient3.getClient();
15884
15919
  let currentDocument;
15885
15920
  try {
15886
15921
  currentDocument = await client.getDocumentById(model.id);
15887
15922
  } catch (error) {
15888
- const status = _optionalChain([error, 'optionalAccess', _25 => _25.response, 'optionalAccess', _26 => _26.status]);
15923
+ const status = _optionalChain([error, 'optionalAccess', _26 => _26.response, 'optionalAccess', _27 => _27.status]);
15889
15924
  if (status !== 404) {
15890
15925
  throw error;
15891
15926
  }
@@ -15954,20 +15989,25 @@ async function getAllDocumentTypeProperties(documentTypeId) {
15954
15989
  const client = UmbracoManagementClient3.getClient();
15955
15990
  const visitedIds = /* @__PURE__ */ new Set();
15956
15991
  const properties = [];
15957
- async function resolveDocumentType(docTypeId) {
15992
+ const rootDocType = await client.getDocumentTypeById(documentTypeId);
15993
+ const rootVariesByCulture = rootDocType.variesByCulture;
15994
+ const rootVariesBySegment = rootDocType.variesBySegment;
15995
+ async function resolveDocumentType(docTypeId, preloaded) {
15958
15996
  if (visitedIds.has(docTypeId)) {
15959
15997
  return;
15960
15998
  }
15961
15999
  visitedIds.add(docTypeId);
15962
- const docType = await client.getDocumentTypeById(docTypeId);
16000
+ const docType = await _asyncNullishCoalesce(preloaded, async () => ( await client.getDocumentTypeById(docTypeId)));
15963
16001
  for (const prop of docType.properties) {
15964
16002
  if (!properties.some((p) => p.alias === prop.alias)) {
15965
16003
  properties.push({
15966
16004
  alias: prop.alias,
15967
16005
  name: prop.name,
15968
16006
  dataTypeId: prop.dataType.id,
15969
- variesByCulture: prop.variesByCulture,
15970
- variesBySegment: prop.variesBySegment
16007
+ // AND with the root document type's own flag: a composition's property can't
16008
+ // vary more than the document type it's actually used on.
16009
+ variesByCulture: prop.variesByCulture && rootVariesByCulture,
16010
+ variesBySegment: prop.variesBySegment && rootVariesBySegment
15971
16011
  });
15972
16012
  }
15973
16013
  }
@@ -15975,7 +16015,7 @@ async function getAllDocumentTypeProperties(documentTypeId) {
15975
16015
  await resolveDocumentType(composition.documentType.id);
15976
16016
  }
15977
16017
  }
15978
- await resolveDocumentType(documentTypeId);
16018
+ await resolveDocumentType(documentTypeId, rootDocType);
15979
16019
  return properties;
15980
16020
  }
15981
16021
  function validateCultureSegment(prop, def) {
@@ -16315,7 +16355,7 @@ var UpdateDocumentPropertiesTool = {
16315
16355
  const docTypeProps = await getDocumentTypeProperties();
16316
16356
  const propsToValidate = allPropertiesToValidate.map((p) => {
16317
16357
  const def = docTypeProps.find((d) => d.alias === p.alias);
16318
- return { alias: p.alias, value: p.value, dataTypeId: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _27 => _27.dataTypeId]), () => ( "")) };
16358
+ return { alias: p.alias, value: p.value, dataTypeId: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _28 => _28.dataTypeId]), () => ( "")) };
16319
16359
  }).filter((p) => p.dataTypeId);
16320
16360
  if (propsToValidate.length > 0) {
16321
16361
  const valueValidation = await validatePropertiesBeforeSave(propsToValidate);
@@ -16717,7 +16757,7 @@ var UpdateBlockPropertyTool = {
16717
16757
  if (!isUmbracoAtLeast(17, 4) && elementTypeProperties.length > 0) {
16718
16758
  const propsToValidate = update.properties.map((p) => {
16719
16759
  const def = elementTypeProperties.find((d) => d.alias === p.alias);
16720
- return { alias: p.alias, value: p.value, dataTypeId: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _28 => _28.dataTypeId]), () => ( "")) };
16760
+ return { alias: p.alias, value: p.value, dataTypeId: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _29 => _29.dataTypeId]), () => ( "")) };
16721
16761
  }).filter((p) => p.dataTypeId);
16722
16762
  if (propsToValidate.length > 0) {
16723
16763
  const valueValidation = await validatePropertiesBeforeSave(propsToValidate);
@@ -17049,14 +17089,14 @@ function removeRteBlockElement(markup, contentKey) {
17049
17089
  return markup.slice(0, start) + markup.slice(end);
17050
17090
  }
17051
17091
  function getBlockTypeConfigurations(dataTypeValues) {
17052
- const blocks = _optionalChain([dataTypeValues, 'optionalAccess', _29 => _29.find, 'call', _30 => _30((v) => v.alias === "blocks"), 'optionalAccess', _31 => _31.value]);
17092
+ const blocks = _optionalChain([dataTypeValues, 'optionalAccess', _30 => _30.find, 'call', _31 => _31((v) => v.alias === "blocks"), 'optionalAccess', _32 => _32.value]);
17053
17093
  return Array.isArray(blocks) ? blocks : [];
17054
17094
  }
17055
17095
  function findBlockTypeConfiguration(configs, contentElementTypeKey) {
17056
17096
  return configs.find((c) => c.contentElementTypeKey === contentElementTypeKey);
17057
17097
  }
17058
17098
  function findAreaConfiguration(configs, parentContentTypeKey, areaKey) {
17059
- return _optionalChain([findBlockTypeConfiguration, 'call', _32 => _32(configs, parentContentTypeKey), 'optionalAccess', _33 => _33.areas, 'optionalAccess', _34 => _34.find, 'call', _35 => _35((a) => a.key === areaKey)]);
17099
+ return _optionalChain([findBlockTypeConfiguration, 'call', _33 => _33(configs, parentContentTypeKey), 'optionalAccess', _34 => _34.areas, 'optionalAccess', _35 => _35.find, 'call', _36 => _36((a) => a.key === areaKey)]);
17060
17100
  }
17061
17101
  function checkAllowedInArea(blockConfig, area) {
17062
17102
  if (blockConfig.allowInAreas === false) {
@@ -17222,7 +17262,7 @@ async function validateBlockProperties(elementTypeKey, properties, label) {
17222
17262
  if (!isUmbracoAtLeast(17, 4) && definitions.length > 0) {
17223
17263
  const propsToValidate = properties.map((p) => {
17224
17264
  const def = definitions.find((d) => d.alias === p.alias);
17225
- return { alias: p.alias, value: p.value, dataTypeId: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _36 => _36.dataTypeId]), () => ( "")) };
17265
+ return { alias: p.alias, value: p.value, dataTypeId: _nullishCoalesce(_optionalChain([def, 'optionalAccess', _37 => _37.dataTypeId]), () => ( "")) };
17226
17266
  }).filter((p) => p.dataTypeId);
17227
17267
  if (propsToValidate.length > 0) {
17228
17268
  const valueValidation = await validatePropertiesBeforeSave(propsToValidate);
@@ -17265,15 +17305,15 @@ var CreateDocumentBlockTool = {
17265
17305
  const { kind, container, blockConfigs } = ctx;
17266
17306
  const placement = _nullishCoalesce(model.placement, () => ( { position: "append" }));
17267
17307
  const contentProperties = _nullishCoalesce(model.properties, () => ( []));
17268
- const settingsProperties = _nullishCoalesce(_optionalChain([model, 'access', _37 => _37.settings, 'optionalAccess', _38 => _38.properties]), () => ( []));
17308
+ const settingsProperties = _nullishCoalesce(_optionalChain([model, 'access', _38 => _38.settings, 'optionalAccess', _39 => _39.properties]), () => ( []));
17269
17309
  if (model.grid && kind !== "BlockGrid") {
17270
17310
  throw new (0, _mcpserversdk.ToolValidationError)({
17271
17311
  title: "grid options not supported",
17272
17312
  detail: `'grid' only applies to BlockGrid properties; '${model.propertyAlias}' is a ${kind} property`
17273
17313
  });
17274
17314
  }
17275
- const areaKey = _optionalChain([model, 'access', _39 => _39.grid, 'optionalAccess', _40 => _40.areaKey]);
17276
- const parentContentKey = _optionalChain([model, 'access', _41 => _41.grid, 'optionalAccess', _42 => _42.parentContentKey]);
17315
+ const areaKey = _optionalChain([model, 'access', _40 => _40.grid, 'optionalAccess', _41 => _41.areaKey]);
17316
+ const parentContentKey = _optionalChain([model, 'access', _42 => _42.grid, 'optionalAccess', _43 => _43.parentContentKey]);
17277
17317
  if (!!areaKey !== !!parentContentKey) {
17278
17318
  throw new (0, _mcpserversdk.ToolValidationError)({
17279
17319
  title: "Incomplete area target",
@@ -17323,7 +17363,7 @@ var CreateDocumentBlockTool = {
17323
17363
  title: "Area not found",
17324
17364
  detail: `Area '${key}' is not configured for block type '${parentBlock.contentTypeKey}'`,
17325
17365
  extensions: {
17326
- availableAreas: (_nullishCoalesce(_optionalChain([findBlockTypeConfiguration, 'call', _43 => _43(blockConfigs, parentBlock.contentTypeKey), 'optionalAccess', _44 => _44.areas]), () => ( []))).map((a) => ({ key: a.key, alias: _nullishCoalesce(a.alias, () => ( null)) }))
17366
+ availableAreas: (_nullishCoalesce(_optionalChain([findBlockTypeConfiguration, 'call', _44 => _44(blockConfigs, parentBlock.contentTypeKey), 'optionalAccess', _45 => _45.areas]), () => ( []))).map((a) => ({ key: a.key, alias: _nullishCoalesce(a.alias, () => ( null)) }))
17327
17367
  }
17328
17368
  });
17329
17369
  }
@@ -17345,7 +17385,7 @@ var CreateDocumentBlockTool = {
17345
17385
  detail: `No block with contentKey '${placement.contentKey}' exists in property '${model.propertyAlias}'`
17346
17386
  });
17347
17387
  }
17348
- if (areaKey && (sibling.areaKey !== areaKey || _optionalChain([sibling, 'access', _45 => _45.parent, 'optionalAccess', _46 => _46.contentKey]) !== parentContentKey)) {
17388
+ if (areaKey && (sibling.areaKey !== areaKey || _optionalChain([sibling, 'access', _46 => _46.parent, 'optionalAccess', _47 => _47.contentKey]) !== parentContentKey)) {
17349
17389
  throw new (0, _mcpserversdk.ToolValidationError)({
17350
17390
  title: "Sibling not in target area",
17351
17391
  detail: `Block '${placement.contentKey}' is not in area '${areaKey}' of block '${parentContentKey}'`
@@ -17390,8 +17430,8 @@ var CreateDocumentBlockTool = {
17390
17430
  const layoutEntry = buildLayoutEntry(kind, {
17391
17431
  contentKey,
17392
17432
  settingsKey,
17393
- columnSpan: _optionalChain([model, 'access', _47 => _47.grid, 'optionalAccess', _48 => _48.columnSpan]),
17394
- rowSpan: _optionalChain([model, 'access', _49 => _49.grid, 'optionalAccess', _50 => _50.rowSpan]),
17433
+ columnSpan: _optionalChain([model, 'access', _48 => _48.grid, 'optionalAccess', _49 => _49.columnSpan]),
17434
+ rowSpan: _optionalChain([model, 'access', _50 => _50.grid, 'optionalAccess', _51 => _51.rowSpan]),
17395
17435
  areaKeys: (_nullishCoalesce(blockConfig.areas, () => ( []))).map((a) => a.key)
17396
17436
  });
17397
17437
  const elementType = await client.getDocumentTypeById(model.contentTypeKey);
@@ -17747,11 +17787,12 @@ var DocumentCollection = {
17747
17787
  if (AuthorizationPolicies.TreeAccessDocuments(user)) {
17748
17788
  tools.push(get_document_by_id_default);
17749
17789
  tools.push(get_document_publish_default);
17790
+ tools.push(get_document_publish_with_descendants_result_default);
17750
17791
  tools.push(get_document_configuration_default);
17751
17792
  tools.push(get_document_type_schema_default);
17752
17793
  tools.push(copy_document_default);
17753
17794
  tools.push(create_document_default);
17754
- if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _51 => _51.umbracoVersion]))) {
17795
+ if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _52 => _52.umbracoVersion]))) {
17755
17796
  tools.push(create_and_publish_document_default);
17756
17797
  }
17757
17798
  tools.push(post_document_public_access_default);
@@ -17768,13 +17809,13 @@ var DocumentCollection = {
17768
17809
  tools.push(publish_document_default);
17769
17810
  tools.push(publish_document_with_descendants_default);
17770
17811
  tools.push(sort_document_default);
17771
- if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _52 => _52.umbracoVersion]))) {
17812
+ if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _53 => _53.umbracoVersion]))) {
17772
17813
  tools.push(sort_document_children_default);
17773
17814
  tools.push(sort_document_root_children_default);
17774
17815
  }
17775
17816
  tools.push(unpublish_document_default);
17776
17817
  tools.push(update_document_default);
17777
- if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _53 => _53.umbracoVersion]))) {
17818
+ if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _54 => _54.umbracoVersion]))) {
17778
17819
  tools.push(update_and_publish_document_default);
17779
17820
  }
17780
17821
  tools.push(update_document_properties_default);
@@ -18110,7 +18151,7 @@ var CopyDocumentTypeTool = {
18110
18151
  validateStatus: () => true
18111
18152
  });
18112
18153
  if (response.status === 201) {
18113
- const location = _optionalChain([response, 'access', _54 => _54.headers, 'optionalAccess', _55 => _55.location]) || "";
18154
+ const location = _optionalChain([response, 'access', _55 => _55.headers, 'optionalAccess', _56 => _56.location]) || "";
18114
18155
  const newId = location.split("/").pop() || "";
18115
18156
  const output = { id: newId };
18116
18157
  return _mcpserversdk.createToolResult.call(void 0, output);
@@ -20308,6 +20349,11 @@ async function validateFilePath(filePath, allowedPaths) {
20308
20349
 
20309
20350
 
20310
20351
 
20352
+
20353
+
20354
+
20355
+
20356
+
20311
20357
  var BASE64_MAX_BYTES = 10 * 1024;
20312
20358
  function getExtensionFromMimeType(mimeType) {
20313
20359
  if (!mimeType) return void 0;
@@ -20316,19 +20362,47 @@ function getExtensionFromMimeType(mimeType) {
20316
20362
  return extension ? `.${extension}` : void 0;
20317
20363
  }
20318
20364
  function validateMediaTypeForSvg(filePath, fileUrl, fileName, mediaTypeName) {
20319
- const isSvg = _optionalChain([filePath, 'optionalAccess', _56 => _56.toLowerCase, 'call', _57 => _57(), 'access', _58 => _58.endsWith, 'call', _59 => _59(".svg")]) || _optionalChain([fileUrl, 'optionalAccess', _60 => _60.toLowerCase, 'call', _61 => _61(), 'access', _62 => _62.endsWith, 'call', _63 => _63(".svg")]) || fileName.toLowerCase().endsWith(".svg");
20320
- if (isSvg && mediaTypeName === _mcpserversdk.MEDIA_TYPE_IMAGE) {
20365
+ const isSvg = _optionalChain([filePath, 'optionalAccess', _57 => _57.toLowerCase, 'call', _58 => _58(), 'access', _59 => _59.endsWith, 'call', _60 => _60(".svg")]) || _optionalChain([fileUrl, 'optionalAccess', _61 => _61.toLowerCase, 'call', _62 => _62(), 'access', _63 => _63.endsWith, 'call', _64 => _64(".svg")]) || fileName.toLowerCase().endsWith(".svg");
20366
+ if (isSvg && mediaTypeName.toLowerCase() === _mcpserversdk.MEDIA_TYPE_IMAGE.toLowerCase()) {
20321
20367
  console.warn(`SVG detected - using ${_mcpserversdk.MEDIA_TYPE_VECTOR_GRAPHICS} media type instead of ${_mcpserversdk.MEDIA_TYPE_IMAGE}`);
20322
20368
  return _mcpserversdk.MEDIA_TYPE_VECTOR_GRAPHICS;
20323
20369
  }
20324
20370
  return mediaTypeName;
20325
20371
  }
20372
+ var BUILT_IN_MEDIA_TYPES = {
20373
+ [_mcpserversdk.MEDIA_TYPE_IMAGE.toLowerCase()]: { name: _mcpserversdk.MEDIA_TYPE_IMAGE, alias: _mcpserversdk.MEDIA_TYPE_ALIASES.Image, fallbackToFile: false },
20374
+ [_mcpserversdk.MEDIA_TYPE_FILE.toLowerCase()]: { name: _mcpserversdk.MEDIA_TYPE_FILE, alias: _mcpserversdk.MEDIA_TYPE_ALIASES.File, fallbackToFile: false },
20375
+ [_mcpserversdk.MEDIA_TYPE_VIDEO.toLowerCase()]: { name: _mcpserversdk.MEDIA_TYPE_VIDEO, alias: _mcpserversdk.MEDIA_TYPE_ALIASES.Video, fallbackToFile: true },
20376
+ [_mcpserversdk.MEDIA_TYPE_AUDIO.toLowerCase()]: { name: _mcpserversdk.MEDIA_TYPE_AUDIO, alias: _mcpserversdk.MEDIA_TYPE_ALIASES.Audio, fallbackToFile: true },
20377
+ [_mcpserversdk.MEDIA_TYPE_ARTICLE.toLowerCase()]: { name: _mcpserversdk.MEDIA_TYPE_ARTICLE, alias: _mcpserversdk.MEDIA_TYPE_ALIASES.Article, fallbackToFile: true },
20378
+ [_mcpserversdk.MEDIA_TYPE_VECTOR_GRAPHICS.toLowerCase()]: { name: _mcpserversdk.MEDIA_TYPE_VECTOR_GRAPHICS, alias: _mcpserversdk.MEDIA_TYPE_ALIASES.VectorGraphics, fallbackToFile: true }
20379
+ };
20380
+ function getSubstitutedMediaType(requestedName, resolved) {
20381
+ return requestedName.toLowerCase() === resolved.name.toLowerCase() ? void 0 : requestedName;
20382
+ }
20383
+ function getMediaTypeWarning(result) {
20384
+ return result.substitutedFor ? `This site has no '${result.substitutedFor}' media type, so '${result.mediaTypeName}' was used instead.` : void 0;
20385
+ }
20386
+ function formatMediaCreatedMessage(result) {
20387
+ return result.substitutedFor ? `Media "${result.name}" created as '${result.mediaTypeName}' \u2014 this site has no '${result.substitutedFor}' media type.` : `Media "${result.name}" created successfully`;
20388
+ }
20326
20389
  async function fetchMediaTypeId(client, mediaTypeName) {
20327
- const standardTypeKey = Object.keys(_mcpserversdk.STANDARD_MEDIA_TYPES).find(
20328
- (key) => key.toLowerCase() === mediaTypeName.toLowerCase()
20329
- );
20330
- if (standardTypeKey) {
20331
- return _mcpserversdk.STANDARD_MEDIA_TYPES[standardTypeKey];
20390
+ const builtIn = BUILT_IN_MEDIA_TYPES[mediaTypeName.toLowerCase()];
20391
+ if (builtIn) {
20392
+ const id = await _mcpserversdk.resolveMediaTypeId.call(void 0, builtIn.alias);
20393
+ if (id) {
20394
+ return { id, name: builtIn.name };
20395
+ }
20396
+ if (builtIn.fallbackToFile) {
20397
+ const fileId = await _mcpserversdk.resolveMediaTypeId.call(void 0, _mcpserversdk.MEDIA_TYPE_ALIASES.File);
20398
+ if (fileId) {
20399
+ console.warn(`Media type '${builtIn.name}' not found on this site - using ${_mcpserversdk.MEDIA_TYPE_FILE} instead`);
20400
+ return { id: fileId, name: _mcpserversdk.MEDIA_TYPE_FILE };
20401
+ }
20402
+ }
20403
+ throw new Error(
20404
+ `Media type '${builtIn.name}' (alias '${builtIn.alias}') not found on this site` + (builtIn.fallbackToFile ? `, and no '${_mcpserversdk.MEDIA_TYPE_FILE}' media type to fall back to` : "")
20405
+ );
20332
20406
  }
20333
20407
  const response = await client.getItemMediaTypeSearch({ query: mediaTypeName });
20334
20408
  const mediaType = response.items.find(
@@ -20340,7 +20414,7 @@ async function fetchMediaTypeId(client, mediaTypeName) {
20340
20414
  `Media type '${mediaTypeName}' not found. Available types: ${availableTypes || "None found"}`
20341
20415
  );
20342
20416
  }
20343
- return mediaType.id;
20417
+ return { id: mediaType.id, name: mediaType.name };
20344
20418
  }
20345
20419
  function getEditorAlias(mediaTypeName) {
20346
20420
  return mediaTypeName === _mcpserversdk.MEDIA_TYPE_IMAGE ? "Umbraco.ImageCropper" : "Umbraco.UploadField";
@@ -20454,7 +20528,7 @@ async function uploadMediaFile(client, params) {
20454
20528
  params.name,
20455
20529
  params.mediaTypeName
20456
20530
  );
20457
- const mediaTypeId = await fetchMediaTypeId(client, validatedMediaTypeName);
20531
+ const mediaType = await fetchMediaTypeId(client, validatedMediaTypeName);
20458
20532
  const { data, filename } = await createFilePayload(
20459
20533
  params.sourceType,
20460
20534
  params.filePath,
@@ -20470,14 +20544,14 @@ async function uploadMediaFile(client, params) {
20470
20544
  });
20471
20545
  } catch (error) {
20472
20546
  const err = error;
20473
- const errorData = _optionalChain([err, 'access', _64 => _64.response, 'optionalAccess', _65 => _65.data]) ? typeof err.response.data === "string" ? err.response.data : JSON.stringify(err.response.data) : err.message;
20474
- throw new Error(`Failed to upload temporary file: ${_optionalChain([err, 'access', _66 => _66.response, 'optionalAccess', _67 => _67.status]) || "Unknown error"} - ${errorData}`);
20547
+ const errorData = _optionalChain([err, 'access', _65 => _65.response, 'optionalAccess', _66 => _66.data]) ? typeof err.response.data === "string" ? err.response.data : JSON.stringify(err.response.data) : err.message;
20548
+ throw new Error(`Failed to upload temporary file: ${_optionalChain([err, 'access', _67 => _67.response, 'optionalAccess', _68 => _68.status]) || "Unknown error"} - ${errorData}`);
20475
20549
  }
20476
- const valueStructure = buildValueStructure(validatedMediaTypeName, params.temporaryFileId);
20550
+ const valueStructure = buildValueStructure(mediaType.name, params.temporaryFileId);
20477
20551
  let response;
20478
20552
  try {
20479
20553
  response = await client.postMedia({
20480
- mediaType: { id: mediaTypeId },
20554
+ mediaType: { id: mediaType.id },
20481
20555
  variants: [
20482
20556
  {
20483
20557
  culture: null,
@@ -20491,12 +20565,12 @@ async function uploadMediaFile(client, params) {
20491
20565
  }, _mcpserversdk.CAPTURE_RAW_HTTP_RESPONSE);
20492
20566
  } catch (error) {
20493
20567
  const err = error;
20494
- throw new Error(`Failed to create media item: ${_optionalChain([err, 'access', _68 => _68.response, 'optionalAccess', _69 => _69.status]) || "Unknown error"} - ${JSON.stringify(_optionalChain([err, 'access', _70 => _70.response, 'optionalAccess', _71 => _71.data])) || err.message}`);
20568
+ throw new Error(`Failed to create media item: ${_optionalChain([err, 'access', _69 => _69.response, 'optionalAccess', _70 => _70.status]) || "Unknown error"} - ${JSON.stringify(_optionalChain([err, 'access', _71 => _71.response, 'optionalAccess', _72 => _72.data])) || err.message}`);
20495
20569
  }
20496
20570
  if (response.status < 200 || response.status >= 300) {
20497
20571
  throw new Error(`Request failed with status code ${response.status}`);
20498
20572
  }
20499
- const locationHeader = _optionalChain([response, 'access', _72 => _72.headers, 'optionalAccess', _73 => _73.location]) || _optionalChain([response, 'access', _74 => _74.headers, 'optionalAccess', _75 => _75.Location]);
20573
+ const locationHeader = _optionalChain([response, 'access', _73 => _73.headers, 'optionalAccess', _74 => _74.location]) || _optionalChain([response, 'access', _75 => _75.headers, 'optionalAccess', _76 => _76.Location]);
20500
20574
  if (!locationHeader) {
20501
20575
  throw new Error("No Location header in response - cannot determine created media ID");
20502
20576
  }
@@ -20505,7 +20579,12 @@ async function uploadMediaFile(client, params) {
20505
20579
  throw new Error(`Could not extract ID from Location header: ${locationHeader}`);
20506
20580
  }
20507
20581
  const mediaId = idMatch[1];
20508
- return { name: params.name, id: mediaId };
20582
+ return {
20583
+ name: params.name,
20584
+ id: mediaId,
20585
+ mediaTypeName: mediaType.name,
20586
+ substitutedFor: getSubstitutedMediaType(validatedMediaTypeName, mediaType)
20587
+ };
20509
20588
  }
20510
20589
 
20511
20590
  // src/umbraco-api/tools/media/post/helpers/source-type-helpers.ts
@@ -20528,7 +20607,7 @@ function buildSourceTypeSection(allowFilePath, otherSources) {
20528
20607
 
20529
20608
 
20530
20609
  function isStreamingUploadAvailable() {
20531
- return _optionalChain([_mcpserversdk.getActiveRequestContext.call(void 0, ), 'optionalAccess', _76 => _76.umbracoAuth]) !== void 0;
20610
+ return _optionalChain([_mcpserversdk.getActiveRequestContext.call(void 0, ), 'optionalAccess', _77 => _77.umbracoAuth]) !== void 0;
20532
20611
  }
20533
20612
  async function resolveAuth() {
20534
20613
  const { accessToken, baseUrl } = await _mcpserversdk.getSessionUmbracoAuth.call(void 0, );
@@ -20536,7 +20615,7 @@ async function resolveAuth() {
20536
20615
  }
20537
20616
  function ensureExtension(name, contentType, urlPath) {
20538
20617
  if (name.includes(".")) return name;
20539
- const fromUrl = _optionalChain([urlPath, 'access', _77 => _77.match, 'call', _78 => _78(/\.([a-z0-9]{1,8})$/i), 'optionalAccess', _79 => _79[0]]);
20618
+ const fromUrl = _optionalChain([urlPath, 'access', _78 => _78.match, 'call', _79 => _79(/\.([a-z0-9]{1,8})$/i), 'optionalAccess', _80 => _80[0]]);
20540
20619
  if (fromUrl) return `${name}${fromUrl}`;
20541
20620
  if (contentType) {
20542
20621
  const subtype = contentType.split(";")[0].split("/")[1];
@@ -20554,7 +20633,7 @@ async function streamingUploadFromUrl(params) {
20554
20633
  params.name,
20555
20634
  params.mediaTypeName
20556
20635
  );
20557
- const [mediaTypeId, auth] = await Promise.all([
20636
+ const [mediaType, auth] = await Promise.all([
20558
20637
  fetchMediaTypeId(client, validatedMediaTypeName),
20559
20638
  resolveAuth()
20560
20639
  ]);
@@ -20629,10 +20708,10 @@ Content-Type: ${sourceContentType}\r
20629
20708
  `Umbraco temporary-file POST failed: HTTP ${tempResp.status} ${tempResp.statusText} - ${errBody}`
20630
20709
  );
20631
20710
  }
20632
- const valueStructure = buildValueStructure(validatedMediaTypeName, temporaryFileId);
20711
+ const valueStructure = buildValueStructure(mediaType.name, temporaryFileId);
20633
20712
  const response = await client.postMedia(
20634
20713
  {
20635
- mediaType: { id: mediaTypeId },
20714
+ mediaType: { id: mediaType.id },
20636
20715
  variants: [{ culture: null, segment: null, name: params.name }],
20637
20716
  values: [valueStructure],
20638
20717
  parent: params.parentId ? { id: params.parentId } : null
@@ -20642,25 +20721,32 @@ Content-Type: ${sourceContentType}\r
20642
20721
  if (response.status < 200 || response.status >= 300) {
20643
20722
  throw new Error(`postMedia failed with status ${response.status}`);
20644
20723
  }
20645
- const locationHeader = _nullishCoalesce(_optionalChain([response, 'access', _80 => _80.headers, 'optionalAccess', _81 => _81.location]), () => ( _optionalChain([response, 'access', _82 => _82.headers, 'optionalAccess', _83 => _83.Location])));
20646
- const idMatch = _optionalChain([locationHeader, 'optionalAccess', _84 => _84.match, 'call', _85 => _85(/\/([a-f0-9-]{36})$/i)]);
20724
+ const locationHeader = _nullishCoalesce(_optionalChain([response, 'access', _81 => _81.headers, 'optionalAccess', _82 => _82.location]), () => ( _optionalChain([response, 'access', _83 => _83.headers, 'optionalAccess', _84 => _84.Location])));
20725
+ const idMatch = _optionalChain([locationHeader, 'optionalAccess', _85 => _85.match, 'call', _86 => _86(/\/([a-f0-9-]{36})$/i)]);
20647
20726
  if (!idMatch) {
20648
20727
  throw new Error(
20649
20728
  `Could not extract media id from Location header: ${_nullishCoalesce(locationHeader, () => ( "(missing)"))}`
20650
20729
  );
20651
20730
  }
20652
- return { name: params.name, id: idMatch[1] };
20731
+ return {
20732
+ name: params.name,
20733
+ id: idMatch[1],
20734
+ mediaTypeName: mediaType.name,
20735
+ substitutedFor: getSubstitutedMediaType(validatedMediaTypeName, mediaType)
20736
+ };
20653
20737
  } finally {
20654
20738
  clearTimeout(overallTimeout);
20655
20739
  }
20656
20740
  }
20657
20741
  async function streamingUploadToToolResult(params) {
20658
20742
  try {
20659
- const { name, id } = await streamingUploadFromUrl(params);
20743
+ const result = await streamingUploadFromUrl(params);
20744
+ const warning = getMediaTypeWarning(result);
20660
20745
  return _mcpserversdk.createToolResult.call(void 0, {
20661
- message: `Media "${name}" created successfully`,
20662
- name,
20663
- id
20746
+ message: formatMediaCreatedMessage(result),
20747
+ name: result.name,
20748
+ id: result.id,
20749
+ ...warning ? { warning } : {}
20664
20750
  });
20665
20751
  } catch (error) {
20666
20752
  return _mcpserversdk.createToolResultError.call(void 0, {
@@ -20690,7 +20776,9 @@ var fileObjectSchema = _zod.z.object({
20690
20776
  var createMediaOutputSchema = _zod.z.object({
20691
20777
  message: _zod.z.string(),
20692
20778
  name: _zod.z.string(),
20693
- id: _zod.z.string().guid()
20779
+ id: _zod.z.string().guid(),
20780
+ /** Set only when the site lacks the requested media type and another was used (e.g. Video → File). */
20781
+ warning: _zod.z.string().optional()
20694
20782
  });
20695
20783
  function createCreateMediaTool(options) {
20696
20784
  const sourceTypeValues = options.allowFilePath ? ["filePath", "url", "file", "base64"] : ["url", "file", "base64"];
@@ -20748,7 +20836,7 @@ ${filePathSection}
20748
20836
  let effectiveSourceType;
20749
20837
  let effectiveFileUrl = model.fileUrl;
20750
20838
  if (model.sourceType === "file") {
20751
- if (!_optionalChain([model, 'access', _86 => _86.file, 'optionalAccess', _87 => _87.download_url])) {
20839
+ if (!_optionalChain([model, 'access', _87 => _87.file, 'optionalAccess', _88 => _88.download_url])) {
20752
20840
  return _mcpserversdk.createToolResultError.call(void 0, {
20753
20841
  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."
20754
20842
  });
@@ -20774,7 +20862,7 @@ ${filePathSection}
20774
20862
  try {
20775
20863
  const client = UmbracoManagementClient3.getClient();
20776
20864
  const temporaryFileId = _uuid.v4.call(void 0, );
20777
- const { name: actualName, id } = await uploadMediaFile(client, {
20865
+ const result = await uploadMediaFile(client, {
20778
20866
  sourceType: effectiveSourceType,
20779
20867
  name: model.name,
20780
20868
  mediaTypeName: model.mediaTypeName,
@@ -20784,10 +20872,12 @@ ${filePathSection}
20784
20872
  parentId: model.parentId,
20785
20873
  temporaryFileId
20786
20874
  });
20875
+ const warning = getMediaTypeWarning(result);
20787
20876
  return _mcpserversdk.createToolResult.call(void 0, {
20788
- message: `Media "${actualName}" created successfully`,
20789
- name: actualName,
20790
- id
20877
+ message: formatMediaCreatedMessage(result),
20878
+ name: result.name,
20879
+ id: result.id,
20880
+ ...warning ? { warning } : {}
20791
20881
  });
20792
20882
  } catch (error) {
20793
20883
  return _mcpserversdk.createToolResultError.call(void 0, {
@@ -20820,9 +20910,15 @@ var createMediaMultipleOutputSchema = _zod.z.object({
20820
20910
  success: _zod.z.boolean(),
20821
20911
  name: _zod.z.string(),
20822
20912
  id: _zod.z.string().guid().optional(),
20823
- error: _zod.z.string().optional()
20913
+ error: _zod.z.string().optional(),
20914
+ /** Set only when the site lacks the requested media type and another was used (e.g. Video → File). */
20915
+ warning: _zod.z.string().optional()
20824
20916
  }))
20825
20917
  });
20918
+ function toSuccessResult(upload) {
20919
+ const warning = getMediaTypeWarning(upload);
20920
+ return { success: true, name: upload.name, id: upload.id, ...warning ? { warning } : {} };
20921
+ }
20826
20922
  var fileObjectSchema2 = _zod.z.object({
20827
20923
  download_url: _zod.z.string().describe("Temporary URL the host provides to fetch the file bytes"),
20828
20924
  file_id: _zod.z.string().describe("Persistent file identifier from the host"),
@@ -20897,7 +20993,7 @@ ${filePathSection}
20897
20993
  let effectiveSourceType;
20898
20994
  let effectiveFileUrl = file.fileUrl;
20899
20995
  if (model.sourceType === "file") {
20900
- if (!_optionalChain([file, 'access', _88 => _88.file, 'optionalAccess', _89 => _89.download_url])) {
20996
+ if (!_optionalChain([file, 'access', _89 => _89.file, 'optionalAccess', _90 => _90.download_url])) {
20901
20997
  return {
20902
20998
  success: false,
20903
20999
  name: file.name,
@@ -20917,16 +21013,16 @@ ${filePathSection}
20917
21013
  error: "fileUrl is required when sourceType is 'url'."
20918
21014
  };
20919
21015
  }
20920
- const { name: actualName2, id: mediaId2 } = await streamingUploadFromUrl({
21016
+ const upload2 = await streamingUploadFromUrl({
20921
21017
  sourceUrl: effectiveFileUrl,
20922
21018
  name: file.name,
20923
21019
  mediaTypeName,
20924
21020
  parentId: model.parentId
20925
21021
  });
20926
- return { success: true, name: actualName2, id: mediaId2 };
21022
+ return toSuccessResult(upload2);
20927
21023
  }
20928
21024
  const temporaryFileId = _uuid.v4.call(void 0, );
20929
- const { name: actualName, id: mediaId } = await uploadMediaFile(client, {
21025
+ const upload = await uploadMediaFile(client, {
20930
21026
  sourceType: effectiveSourceType,
20931
21027
  name: file.name,
20932
21028
  mediaTypeName,
@@ -20936,7 +21032,7 @@ ${filePathSection}
20936
21032
  parentId: model.parentId,
20937
21033
  temporaryFileId
20938
21034
  });
20939
- return { success: true, name: actualName, id: mediaId };
21035
+ return toSuccessResult(upload);
20940
21036
  } catch (error) {
20941
21037
  return { success: false, name: file.name, error: error.message };
20942
21038
  }
@@ -20963,6 +21059,7 @@ var create_media_multiple_default = createCreateMediaMultipleTool({ allowFilePat
20963
21059
 
20964
21060
 
20965
21061
 
21062
+
20966
21063
  var createMediaFolderSchema = _zod.z.object({
20967
21064
  name: _zod.z.string().describe("The name of the folder"),
20968
21065
  parentId: _zod.z.string().uuid().optional().describe("Parent folder ID. If not provided, the folder will be created at the root of the media library.")
@@ -20981,6 +21078,12 @@ var CreateMediaFolderTool = {
20981
21078
  handler: (async (model) => {
20982
21079
  try {
20983
21080
  const client = UmbracoManagementClient3.getClient();
21081
+ const folderMediaTypeId = await _mcpserversdk.resolveMediaTypeId.call(void 0, _mcpserversdk.MEDIA_TYPE_ALIASES.Folder);
21082
+ if (!folderMediaTypeId) {
21083
+ return _mcpserversdk.createToolResultError.call(void 0, {
21084
+ detail: `Error creating media folder: no media type with alias '${_mcpserversdk.MEDIA_TYPE_ALIASES.Folder}' was found on this Umbraco site.`
21085
+ });
21086
+ }
20984
21087
  const response = await client.postMedia({
20985
21088
  values: [],
20986
21089
  variants: [
@@ -20991,12 +21094,12 @@ var CreateMediaFolderTool = {
20991
21094
  }
20992
21095
  ],
20993
21096
  parent: model.parentId ? { id: model.parentId } : null,
20994
- mediaType: { id: _mcpserversdk.FOLDER_MEDIA_TYPE_ID }
21097
+ mediaType: { id: folderMediaTypeId }
20995
21098
  }, _mcpserversdk.CAPTURE_RAW_HTTP_RESPONSE);
20996
21099
  if (response.status < 200 || response.status >= 300) {
20997
21100
  throw new Error(`Request failed with status code ${response.status}`);
20998
21101
  }
20999
- const locationHeader = _optionalChain([response, 'access', _90 => _90.headers, 'optionalAccess', _91 => _91.location]) || _optionalChain([response, 'access', _92 => _92.headers, 'optionalAccess', _93 => _93.Location]);
21102
+ const locationHeader = _optionalChain([response, 'access', _91 => _91.headers, 'optionalAccess', _92 => _92.location]) || _optionalChain([response, 'access', _93 => _93.headers, 'optionalAccess', _94 => _94.Location]);
21000
21103
  if (!locationHeader) {
21001
21104
  throw new Error("No Location header in response - cannot determine created folder ID");
21002
21105
  }
@@ -21831,7 +21934,7 @@ var MediaCollection = {
21831
21934
  tools.push(validate_media_default);
21832
21935
  tools.push(validate_media_default2);
21833
21936
  tools.push(sort_media_default);
21834
- if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _94 => _94.umbracoVersion]))) {
21937
+ if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _95 => _95.umbracoVersion]))) {
21835
21938
  tools.push(sort_media_children_default);
21836
21939
  tools.push(sort_media_root_children_default);
21837
21940
  }
@@ -21852,7 +21955,7 @@ var MediaCollection = {
21852
21955
  tools.push(get_collection_media_default);
21853
21956
  tools.push(get_recycle_bin_media_referenced_by_default);
21854
21957
  tools.push(get_recycle_bin_media_original_parent_default);
21855
- if (isUmbracoAtLeast(17, 4, _optionalChain([options, 'optionalAccess', _95 => _95.umbracoVersion]))) {
21958
+ if (isUmbracoAtLeast(17, 4, _optionalChain([options, 'optionalAccess', _96 => _96.umbracoVersion]))) {
21856
21959
  tools.push(get_media_type_schema_default);
21857
21960
  }
21858
21961
  }
@@ -22286,7 +22389,7 @@ var CreateMediaTypeFolderTool = {
22286
22389
  validateStatus: () => true
22287
22390
  });
22288
22391
  if (response.status === 201) {
22289
- const locationHeader = _optionalChain([response, 'access', _96 => _96.headers, 'optionalAccess', _97 => _97["location"]]) || _optionalChain([response, 'access', _98 => _98.headers, 'optionalAccess', _99 => _99["Location"]]);
22392
+ const locationHeader = _optionalChain([response, 'access', _97 => _97.headers, 'optionalAccess', _98 => _98["location"]]) || _optionalChain([response, 'access', _99 => _99.headers, 'optionalAccess', _100 => _100["Location"]]);
22290
22393
  let createdId = model.id || "";
22291
22394
  if (locationHeader) {
22292
22395
  const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
@@ -22420,7 +22523,7 @@ var CreateMediaTypeTool = {
22420
22523
  validateStatus: () => true
22421
22524
  });
22422
22525
  if (response.status === 201) {
22423
- const locationHeader = _optionalChain([response, 'access', _100 => _100.headers, 'optionalAccess', _101 => _101["location"]]) || _optionalChain([response, 'access', _102 => _102.headers, 'optionalAccess', _103 => _103["Location"]]);
22526
+ const locationHeader = _optionalChain([response, 'access', _101 => _101.headers, 'optionalAccess', _102 => _102["location"]]) || _optionalChain([response, 'access', _103 => _103.headers, 'optionalAccess', _104 => _104["Location"]]);
22424
22527
  let createdId = model.id || "";
22425
22528
  if (locationHeader) {
22426
22529
  const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
@@ -22471,7 +22574,7 @@ var CopyMediaTypeTool = {
22471
22574
  validateStatus: () => true
22472
22575
  });
22473
22576
  if (response.status === 201) {
22474
- const locationHeader = _optionalChain([response, 'access', _104 => _104.headers, 'optionalAccess', _105 => _105["location"]]) || _optionalChain([response, 'access', _106 => _106.headers, 'optionalAccess', _107 => _107["Location"]]);
22577
+ const locationHeader = _optionalChain([response, 'access', _105 => _105.headers, 'optionalAccess', _106 => _106["location"]]) || _optionalChain([response, 'access', _107 => _107.headers, 'optionalAccess', _108 => _108["Location"]]);
22475
22578
  let createdId = "";
22476
22579
  if (locationHeader) {
22477
22580
  const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
@@ -22681,7 +22784,7 @@ var CreateMemberTool = {
22681
22784
  validateStatus: () => true
22682
22785
  });
22683
22786
  if (response.status === 201) {
22684
- const locationHeader = _optionalChain([response, 'access', _108 => _108.headers, 'optionalAccess', _109 => _109["location"]]) || _optionalChain([response, 'access', _110 => _110.headers, 'optionalAccess', _111 => _111["Location"]]);
22787
+ const locationHeader = _optionalChain([response, 'access', _109 => _109.headers, 'optionalAccess', _110 => _110["location"]]) || _optionalChain([response, 'access', _111 => _111.headers, 'optionalAccess', _112 => _112["Location"]]);
22685
22788
  let createdId = model.id || "";
22686
22789
  if (locationHeader) {
22687
22790
  const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
@@ -22988,7 +23091,7 @@ var MemberCollection = {
22988
23091
  tools.push(get_member_are_referenced_default);
22989
23092
  tools.push(get_member_by_id_referenced_by_default);
22990
23093
  tools.push(get_member_by_id_referenced_descendants_default);
22991
- if (isUmbracoAtLeast(17, 4, _optionalChain([options, 'optionalAccess', _112 => _112.umbracoVersion]))) {
23094
+ if (isUmbracoAtLeast(17, 4, _optionalChain([options, 'optionalAccess', _113 => _113.umbracoVersion]))) {
22992
23095
  tools.push(get_member_type_schema_default);
22993
23096
  }
22994
23097
  }
@@ -23232,7 +23335,7 @@ var CreateMemberTypeTool = {
23232
23335
  validateStatus: () => true
23233
23336
  });
23234
23337
  if (response.status === 201) {
23235
- const locationHeader = _optionalChain([response, 'access', _113 => _113.headers, 'optionalAccess', _114 => _114["location"]]) || _optionalChain([response, 'access', _115 => _115.headers, 'optionalAccess', _116 => _116["Location"]]);
23338
+ const locationHeader = _optionalChain([response, 'access', _114 => _114.headers, 'optionalAccess', _115 => _115["location"]]) || _optionalChain([response, 'access', _116 => _116.headers, 'optionalAccess', _117 => _117["Location"]]);
23236
23339
  let createdId = model.id || "";
23237
23340
  if (locationHeader) {
23238
23341
  const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
@@ -23402,7 +23505,7 @@ var CopyMemberTypeTool = {
23402
23505
  validateStatus: () => true
23403
23506
  });
23404
23507
  if (response.status === 201) {
23405
- const locationHeader = _optionalChain([response, 'access', _117 => _117.headers, 'optionalAccess', _118 => _118["location"]]) || _optionalChain([response, 'access', _119 => _119.headers, 'optionalAccess', _120 => _120["Location"]]);
23508
+ const locationHeader = _optionalChain([response, 'access', _118 => _118.headers, 'optionalAccess', _119 => _119["location"]]) || _optionalChain([response, 'access', _120 => _120.headers, 'optionalAccess', _121 => _121["Location"]]);
23406
23509
  let createdId = "";
23407
23510
  if (locationHeader) {
23408
23511
  const idMatch = locationHeader.match(/([0-9a-f-]{36})$/i);
@@ -23762,7 +23865,7 @@ var CreatePartialViewTool = {
23762
23865
  validateStatus: () => true
23763
23866
  });
23764
23867
  if (response.status === 201) {
23765
- const locationHeader = _optionalChain([response, 'access', _121 => _121.headers, 'optionalAccess', _122 => _122["location"]]) || _optionalChain([response, 'access', _123 => _123.headers, 'optionalAccess', _124 => _124["Location"]]);
23868
+ const locationHeader = _optionalChain([response, 'access', _122 => _122.headers, 'optionalAccess', _123 => _123["location"]]) || _optionalChain([response, 'access', _124 => _124.headers, 'optionalAccess', _125 => _125["Location"]]);
23766
23869
  let createdPath = "";
23767
23870
  if (locationHeader) {
23768
23871
  const pathMatch = locationHeader.match(/partial-view\/(.+)$/);
@@ -23809,7 +23912,7 @@ var CreatePartialViewFolderTool = {
23809
23912
  validateStatus: () => true
23810
23913
  });
23811
23914
  if (response.status === 201) {
23812
- const locationHeader = _optionalChain([response, 'access', _125 => _125.headers, 'optionalAccess', _126 => _126["location"]]) || _optionalChain([response, 'access', _127 => _127.headers, 'optionalAccess', _128 => _128["Location"]]);
23915
+ const locationHeader = _optionalChain([response, 'access', _126 => _126.headers, 'optionalAccess', _127 => _127["location"]]) || _optionalChain([response, 'access', _128 => _128.headers, 'optionalAccess', _129 => _129["Location"]]);
23813
23916
  let createdPath = "";
23814
23917
  if (locationHeader) {
23815
23918
  const pathMatch = locationHeader.match(/partial-view\/folder\/(.+)$/);
@@ -24642,7 +24745,7 @@ var CreateScriptTool = {
24642
24745
  validateStatus: () => true
24643
24746
  });
24644
24747
  if (response.status === 201) {
24645
- const locationHeader = _optionalChain([response, 'access', _129 => _129.headers, 'optionalAccess', _130 => _130["location"]]) || _optionalChain([response, 'access', _131 => _131.headers, 'optionalAccess', _132 => _132["Location"]]);
24748
+ const locationHeader = _optionalChain([response, 'access', _130 => _130.headers, 'optionalAccess', _131 => _131["location"]]) || _optionalChain([response, 'access', _132 => _132.headers, 'optionalAccess', _133 => _133["Location"]]);
24646
24749
  let createdPath = "";
24647
24750
  if (locationHeader) {
24648
24751
  const pathMatch = locationHeader.match(/script\/(.+)$/);
@@ -24689,7 +24792,7 @@ var CreateScriptFolderTool = {
24689
24792
  validateStatus: () => true
24690
24793
  });
24691
24794
  if (response.status === 201) {
24692
- const locationHeader = _optionalChain([response, 'access', _133 => _133.headers, 'optionalAccess', _134 => _134["location"]]) || _optionalChain([response, 'access', _135 => _135.headers, 'optionalAccess', _136 => _136["Location"]]);
24795
+ const locationHeader = _optionalChain([response, 'access', _134 => _134.headers, 'optionalAccess', _135 => _135["location"]]) || _optionalChain([response, 'access', _136 => _136.headers, 'optionalAccess', _137 => _137["Location"]]);
24693
24796
  let createdPath = "";
24694
24797
  if (locationHeader) {
24695
24798
  const pathMatch = locationHeader.match(/script\/folder\/(.+)$/);
@@ -25286,7 +25389,7 @@ var CreateStylesheetTool = {
25286
25389
  validateStatus: () => true
25287
25390
  });
25288
25391
  if (response.status === 201) {
25289
- const locationHeader = _optionalChain([response, 'access', _137 => _137.headers, 'optionalAccess', _138 => _138["location"]]) || _optionalChain([response, 'access', _139 => _139.headers, 'optionalAccess', _140 => _140["Location"]]);
25392
+ const locationHeader = _optionalChain([response, 'access', _138 => _138.headers, 'optionalAccess', _139 => _139["location"]]) || _optionalChain([response, 'access', _140 => _140.headers, 'optionalAccess', _141 => _141["Location"]]);
25290
25393
  let createdPath = "";
25291
25394
  if (locationHeader) {
25292
25395
  const pathMatch = locationHeader.match(/stylesheet\/(.+)$/);
@@ -25333,7 +25436,7 @@ var CreateStylesheetFolderTool = {
25333
25436
  validateStatus: () => true
25334
25437
  });
25335
25438
  if (response.status === 201) {
25336
- const locationHeader = _optionalChain([response, 'access', _141 => _141.headers, 'optionalAccess', _142 => _142["location"]]) || _optionalChain([response, 'access', _143 => _143.headers, 'optionalAccess', _144 => _144["Location"]]);
25439
+ const locationHeader = _optionalChain([response, 'access', _142 => _142.headers, 'optionalAccess', _143 => _143["location"]]) || _optionalChain([response, 'access', _144 => _144.headers, 'optionalAccess', _145 => _145["Location"]]);
25337
25440
  let createdPath = "";
25338
25441
  if (locationHeader) {
25339
25442
  const pathMatch = locationHeader.match(/stylesheet\/folder\/(.+)$/);
@@ -25697,7 +25800,7 @@ var CreateTemplateTool = {
25697
25800
  validateStatus: () => true
25698
25801
  });
25699
25802
  if (response.status === 201) {
25700
- const locationHeader = _optionalChain([response, 'access', _145 => _145.headers, 'optionalAccess', _146 => _146["location"]]) || _optionalChain([response, 'access', _147 => _147.headers, 'optionalAccess', _148 => _148["Location"]]);
25803
+ const locationHeader = _optionalChain([response, 'access', _146 => _146.headers, 'optionalAccess', _147 => _147["location"]]) || _optionalChain([response, 'access', _148 => _148.headers, 'optionalAccess', _149 => _149["Location"]]);
25701
25804
  let createdId = "";
25702
25805
  if (locationHeader) {
25703
25806
  const idMatch = locationHeader.match(/template\/([a-f0-9-]+)$/i);
@@ -26639,7 +26742,7 @@ var UserCollection = {
26639
26742
  tools.push(get_item_user_default);
26640
26743
  tools.push(get_user_configuration_default);
26641
26744
  tools.push(get_user_by_id_calculate_start_nodes_default);
26642
- if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _149 => _149.umbracoVersion]))) {
26745
+ if (isUmbracoAtLeast(17, 6, _optionalChain([options, 'optionalAccess', _150 => _150.umbracoVersion]))) {
26643
26746
  tools.push(get_user_batch_default);
26644
26747
  }
26645
26748
  tools.push(upload_user_avatar_by_id_default);
@@ -26673,7 +26776,7 @@ var CreateUserDataTool = {
26673
26776
  validateStatus: () => true
26674
26777
  });
26675
26778
  if (response.status === 201) {
26676
- const locationHeader = _optionalChain([response, 'access', _150 => _150.headers, 'optionalAccess', _151 => _151["location"]]) || _optionalChain([response, 'access', _152 => _152.headers, 'optionalAccess', _153 => _153["Location"]]);
26779
+ const locationHeader = _optionalChain([response, 'access', _151 => _151.headers, 'optionalAccess', _152 => _152["location"]]) || _optionalChain([response, 'access', _153 => _153.headers, 'optionalAccess', _154 => _154["Location"]]);
26677
26780
  let createdId = "";
26678
26781
  if (locationHeader) {
26679
26782
  const idMatch = locationHeader.match(/user-data\/([a-f0-9-]+)$/i);
@@ -26911,7 +27014,7 @@ var CreateUserGroupTool = {
26911
27014
  validateStatus: () => true
26912
27015
  });
26913
27016
  if (response.status === 201) {
26914
- const locationHeader = _optionalChain([response, 'access', _154 => _154.headers, 'optionalAccess', _155 => _155["location"]]) || _optionalChain([response, 'access', _156 => _156.headers, 'optionalAccess', _157 => _157["Location"]]);
27017
+ const locationHeader = _optionalChain([response, 'access', _155 => _155.headers, 'optionalAccess', _156 => _156["location"]]) || _optionalChain([response, 'access', _157 => _157.headers, 'optionalAccess', _158 => _158["Location"]]);
26915
27018
  let createdId = "";
26916
27019
  if (locationHeader) {
26917
27020
  const idMatch = locationHeader.match(/user-group\/([a-f0-9-]+)$/i);
@@ -27209,7 +27312,7 @@ var CreateWebhookTool = {
27209
27312
  validateStatus: () => true
27210
27313
  });
27211
27314
  if (response.status === 201) {
27212
- const locationHeader = _optionalChain([response, 'access', _158 => _158.headers, 'optionalAccess', _159 => _159["location"]]) || _optionalChain([response, 'access', _160 => _160.headers, 'optionalAccess', _161 => _161["Location"]]);
27315
+ const locationHeader = _optionalChain([response, 'access', _159 => _159.headers, 'optionalAccess', _160 => _160["location"]]) || _optionalChain([response, 'access', _161 => _161.headers, 'optionalAccess', _162 => _162["Location"]]);
27213
27316
  let createdId = "";
27214
27317
  if (locationHeader) {
27215
27318
  const idMatch = locationHeader.match(/webhook\/([a-f0-9-]+)$/i);
@@ -27454,4 +27557,4 @@ var allSliceNames = [...toolSliceNames, "other"];
27454
27557
 
27455
27558
 
27456
27559
  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;
27457
- //# sourceMappingURL=chunk-7BJSON54.cjs.map
27560
+ //# sourceMappingURL=chunk-KGS2P7IA.cjs.map