remove UDI utils

This commit is contained in:
Niels Lyngsø
2024-02-22 15:24:05 +01:00
parent a6f4793de6
commit ff75d89e3f
3 changed files with 4 additions and 25 deletions

View File

@@ -3,7 +3,6 @@ import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbArrayState, UmbClassState, UmbStringState } from '@umbraco-cms/backoffice/observable-api';
import { UmbDocumentTypeDetailRepository } from '@umbraco-cms/backoffice/document-type';
import { buildUdi, getKeyFromUdi } from '@umbraco-cms/backoffice/utils';
import type { UmbBlockTypeBaseModel, UmbBlockWorkspaceData } from '@umbraco-cms/backoffice/block';
import { UMB_BLOCK_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/block';
import type { UmbContentTypeModel } from '@umbraco-cms/backoffice/content-type';
@@ -12,6 +11,10 @@ import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/
import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property';
import type { UmbVariantId } from '@umbraco-cms/backoffice/variant';
function buildUdi(entityType: string, guid: string) {
return `umb://${entityType}/${guid.replace(/-/g, '')}`;
}
export type UmbBlockDataObjectModel<LayoutEntryType extends UmbBlockLayoutBaseModel> = {
layout: LayoutEntryType;
content: UmbBlockDataType;

View File

@@ -9,7 +9,6 @@ export * from './path-decode.function.js';
export * from './path-encode.function.js';
export * from './path-folder-name.function.js';
export * from './selection-manager/selection.manager.js';
export * from './udi.js';
export * from './umbraco-path.function.js';
export * from './math.js';
export * from './split-string-to-array.js';

View File

@@ -1,23 +0,0 @@
export function buildUdi(entityType: string, guid: string) {
return `umb://${entityType}/${guid.replace(/-/g, '')}`;
}
export function getKeyFromUdi(udi: string) {
if (typeof udi !== 'string') {
throw 'udi is not a string';
}
if (!udi.startsWith('umb://')) {
throw 'udi does not start with umb://';
}
const withoutScheme = udi.substring('umb://'.length);
const withoutHost = withoutScheme.substring(withoutScheme.indexOf('/') + 1).trim();
if (withoutHost.length !== 32) {
throw 'udi is not 32 chars';
}
return `${withoutHost.substring(0, 8)}-${withoutHost.substring(8, 12)}-${withoutHost.substring(
12,
16,
)}-${withoutHost.substring(16, 20)}-${withoutHost.substring(20)}`;
}