remove UDI utils
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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)}`;
|
||||
}
|
||||
Reference in New Issue
Block a user