V16: Chore: Deprecate getManifest() methods (#19056)

* Deprecates `getManifest()` methods

Resolution is to use the `.manifest` property instead.

* Revised the deprecation message to improve clarity
This commit is contained in:
Lee Kelleher
2025-04-16 13:35:50 +01:00
committed by GitHub
parent 0eac3952a6
commit 2b6f9fb9c4
5 changed files with 23 additions and 8 deletions

View File

@@ -11,7 +11,7 @@ export class UmbCollectionAliasCondition
constructor(host: UmbControllerHost, args: UmbConditionControllerArguments<CollectionAliasConditionConfig>) {
super(host, args);
this.consumeContext(UMB_COLLECTION_CONTEXT, (context) => {
this.permitted = context.getManifest()?.alias === this.config.match;
this.permitted = context.manifest?.alias === this.config.match;
});
}
}

View File

@@ -15,7 +15,7 @@ import { UmbArrayState, UmbBasicState, UmbNumberState, UmbObjectState } from '@u
import { UmbChangeEvent } from '@umbraco-cms/backoffice/event';
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
import { UmbExtensionApiInitializer } from '@umbraco-cms/backoffice/extension-api';
import { UmbSelectionManager, UmbPaginationManager } from '@umbraco-cms/backoffice/utils';
import { UmbSelectionManager, UmbPaginationManager, UmbDeprecation } from '@umbraco-cms/backoffice/utils';
import type { ManifestRepository } from '@umbraco-cms/backoffice/extension-registry';
import type { UmbApi } from '@umbraco-cms/backoffice/extension-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
@@ -333,9 +333,14 @@ export class UmbDefaultCollectionContext<
* Returns the manifest for the collection.
* @returns {ManifestCollection}
* @memberof UmbCollectionContext
* @deprecated Use get the `.manifest` property instead.
* @deprecated Use the `.manifest` property instead.
*/
public getManifest() {
new UmbDeprecation({
removeInVersion: '18.0.0',
deprecated: 'getManifest',
solution: 'Use .manifest property instead',
}).warn();
return this._manifest;
}

View File

@@ -32,7 +32,7 @@ export class UmbRecycleBinTreeItemContext<
const entityType = event.getEntityType();
if (!entityType) throw new Error('Entity type is required');
const supportedEntityTypes = this.getManifest()?.meta.supportedEntityTypes;
const supportedEntityTypes = this.manifest?.meta.supportedEntityTypes;
if (!supportedEntityTypes) {
throw new Error('Entity types are missing from the manifest (manifest.meta.supportedEntityTypes).');

View File

@@ -11,7 +11,7 @@ import { type ManifestRepository, umbExtensionsRegistry } from '@umbraco-cms/bac
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbExtensionApiInitializer } from '@umbraco-cms/backoffice/extension-api';
import { UmbPaginationManager, UmbSelectionManager, debounce } from '@umbraco-cms/backoffice/utils';
import { UmbDeprecation, UmbPaginationManager, UmbSelectionManager, debounce } from '@umbraco-cms/backoffice/utils';
import {
UmbRequestReloadChildrenOfEntityEvent,
type UmbEntityActionEvent,
@@ -110,13 +110,18 @@ export class UmbDefaultTreeContext<
return this.#manifest;
}
// TODO: getManifest, could be refactored to use the getter method [NL]
/**
* Returns the manifest.
* @returns {ManifestTree}
* @memberof UmbDefaultTreeContext
* @deprecated Use the `.manifest` property instead.
*/
public getManifest() {
new UmbDeprecation({
removeInVersion: '18.0.0',
deprecated: 'getManifest',
solution: 'Use .manifest property instead',
}).warn();
return this.#manifest;
}

View File

@@ -17,7 +17,7 @@ import {
UmbRequestReloadStructureForEntityEvent,
} from '@umbraco-cms/backoffice/entity-action';
import type { UmbEntityActionEvent } from '@umbraco-cms/backoffice/entity-action';
import { UmbPaginationManager, debounce } from '@umbraco-cms/backoffice/utils';
import { UmbDeprecation, UmbPaginationManager, debounce } from '@umbraco-cms/backoffice/utils';
import { UmbChangeEvent } from '@umbraco-cms/backoffice/event';
import type { UmbEntityUnique } from '@umbraco-cms/backoffice/entity';
@@ -112,13 +112,18 @@ export abstract class UmbTreeItemContextBase<
return this.#manifest;
}
// TODO: Be aware that this method, could be removed and we can use the getter method instead [NL]
/**
* Returns the manifest.
* @returns {ManifestCollection}
* @memberof UmbCollectionContext
* @deprecated Use the `.manifest` property instead.
*/
public getManifest() {
new UmbDeprecation({
removeInVersion: '18.0.0',
deprecated: 'getManifest',
solution: 'Use .manifest property instead',
}).warn();
return this.#manifest;
}