@umbraco/json-models-builders
Advanced tools
Comparing version
import { DocumentTypePropertyBuilder } from "./documentTypePropertyBuilder"; | ||
import { DocumentTypeContainerBuilder } from "./documentTypeContainerBuilder"; | ||
import { DocumentTypeAllowedContentTypeBuilder } from "./documentTypeAllowedContentTypeBuilder"; | ||
import { DocumentTypeAllowedDocumentTypeBuilder } from "./documentTypeAllowedDocumentTypeBuilder"; | ||
import { DocumentTypeCompositionBuilder } from "./documentTypeCompositionBuilder"; | ||
import { DocumentTypeAllowedTemplateIdBuilder } from "./documentTypeAllowedTemplateIdBuilder"; | ||
import { DocumentTypeAllowedTemplateBuilder } from "./documentTypeAllowedTemplateBuilder"; | ||
export declare class DocumentTypeBuilder { | ||
@@ -14,11 +14,12 @@ alias: string; | ||
variesBySegment: boolean; | ||
collectionId: string; | ||
isElement: boolean; | ||
documentTypePropertyBuilder: DocumentTypePropertyBuilder[]; | ||
documentTypeAllowedContentTypeBuilder: DocumentTypeAllowedContentTypeBuilder[]; | ||
documentTypeAllowedTemplateIdBuilder: DocumentTypeAllowedTemplateIdBuilder[]; | ||
documentTypeAllowedDocumentTypeBuilder: DocumentTypeAllowedDocumentTypeBuilder[]; | ||
documentTypeAllowedTemplateBuilder: DocumentTypeAllowedTemplateBuilder[]; | ||
documentTypeCompositionBuilder: DocumentTypeCompositionBuilder[]; | ||
documentTypeContainerBuilder: DocumentTypeContainerBuilder[]; | ||
id: string; | ||
containerId: string; | ||
defaultTemplateId: string[]; | ||
folderId: string; | ||
defaultTemplateId: string; | ||
preventCleanup: boolean; | ||
@@ -36,11 +37,9 @@ keepAllVersionsNewerThanDays: number; | ||
withIsElement(isElement: boolean): this; | ||
addProperties(): DocumentTypePropertyBuilder; | ||
addContainers(): DocumentTypeContainerBuilder; | ||
addAllowedContentTypes(): DocumentTypeAllowedContentTypeBuilder; | ||
addAllowedTemplateIds(templateId: any): this; | ||
addCompositions(): DocumentTypeCompositionBuilder; | ||
withContainerId(containerId: string): this; | ||
addProperty(): DocumentTypePropertyBuilder; | ||
addContainer(): DocumentTypeContainerBuilder; | ||
addAllowedDocumentType(): DocumentTypeAllowedDocumentTypeBuilder; | ||
addAllowedTemplateId(): DocumentTypeAllowedTemplateBuilder; | ||
addComposition(): DocumentTypeCompositionBuilder; | ||
withId(id: string): this; | ||
addTemplateIds(): DocumentTypeAllowedTemplateIdBuilder; | ||
withDefaultTemplateId(defaultTemplateId: string[]): this; | ||
withDefaultTemplateId(defaultTemplateId: string): this; | ||
withPreventCleanup(preventCleanup: boolean): this; | ||
@@ -57,6 +56,11 @@ withKeepAllVersionsNewerThanDays(keepAllVersionsNewerThanDays: number): this; | ||
variesBySegment: boolean; | ||
collection: { | ||
id: string; | ||
} | null; | ||
isElement: boolean; | ||
properties: { | ||
id: string | null; | ||
containerId: string | null; | ||
id: string; | ||
container: { | ||
id: string | null; | ||
}; | ||
sortOrder: number; | ||
@@ -66,10 +70,12 @@ alias: string; | ||
description: string; | ||
dataTypeId: string | null; | ||
dataType: { | ||
id: string | null; | ||
}; | ||
variesByCulture: boolean; | ||
variesBySegment: boolean; | ||
mandatory: boolean; | ||
validation: { | ||
mandatoryMessage: string; | ||
regEx: string; | ||
regExMessage: string; | ||
mandatory: boolean; | ||
mandatoryMessage: string | null; | ||
regEx: string | null; | ||
regExMessage: string | null; | ||
}; | ||
@@ -82,3 +88,5 @@ appearance: { | ||
id: string | null; | ||
parentId: string | null; | ||
parent: { | ||
id: string; | ||
} | null; | ||
name: string; | ||
@@ -88,16 +96,24 @@ type: string; | ||
}[]; | ||
allowedContentTypes: { | ||
id: string | null; | ||
allowedDocumentTypes: { | ||
documentType: { | ||
id: string | null; | ||
}; | ||
sortOrder: number; | ||
}[]; | ||
compositions: { | ||
id: string | null; | ||
documentType: { | ||
id: string | null; | ||
}; | ||
compositionType: string; | ||
}[]; | ||
id: string; | ||
containerId: string | null; | ||
allowedTemplatesIds: { | ||
folder: { | ||
id: string; | ||
} | null; | ||
allowedTemplates: { | ||
id: string | null; | ||
}[]; | ||
defaultTemplateId: string[]; | ||
defaultTemplate: { | ||
id: string; | ||
} | null; | ||
cleanup: { | ||
@@ -104,0 +120,0 @@ preventCleanup: boolean; |
@@ -6,5 +6,5 @@ "use strict"; | ||
const documentTypeContainerBuilder_1 = require("./documentTypeContainerBuilder"); | ||
const documentTypeAllowedContentTypeBuilder_1 = require("./documentTypeAllowedContentTypeBuilder"); | ||
const documentTypeAllowedDocumentTypeBuilder_1 = require("./documentTypeAllowedDocumentTypeBuilder"); | ||
const documentTypeCompositionBuilder_1 = require("./documentTypeCompositionBuilder"); | ||
const documentTypeAllowedTemplateIdBuilder_1 = require("./documentTypeAllowedTemplateIdBuilder"); | ||
const documentTypeAllowedTemplateBuilder_1 = require("./documentTypeAllowedTemplateBuilder"); | ||
class DocumentTypeBuilder { | ||
@@ -18,10 +18,11 @@ alias; | ||
variesBySegment; | ||
collectionId; | ||
isElement; | ||
documentTypePropertyBuilder; | ||
documentTypeAllowedContentTypeBuilder; | ||
documentTypeAllowedTemplateIdBuilder; | ||
documentTypeAllowedDocumentTypeBuilder; | ||
documentTypeAllowedTemplateBuilder; | ||
documentTypeCompositionBuilder; | ||
documentTypeContainerBuilder; | ||
id; | ||
containerId; | ||
folderId; | ||
defaultTemplateId; | ||
@@ -33,4 +34,4 @@ preventCleanup; | ||
this.documentTypePropertyBuilder = []; | ||
this.documentTypeAllowedContentTypeBuilder = []; | ||
this.documentTypeAllowedTemplateIdBuilder = []; | ||
this.documentTypeAllowedDocumentTypeBuilder = []; | ||
this.documentTypeAllowedTemplateBuilder = []; | ||
this.documentTypeCompositionBuilder = []; | ||
@@ -71,3 +72,3 @@ this.documentTypeContainerBuilder = []; | ||
} | ||
addProperties() { | ||
addProperty() { | ||
const builder = new documentTypePropertyBuilder_1.DocumentTypePropertyBuilder(this); | ||
@@ -77,3 +78,3 @@ this.documentTypePropertyBuilder.push(builder); | ||
} | ||
addContainers() { | ||
addContainer() { | ||
const builder = new documentTypeContainerBuilder_1.DocumentTypeContainerBuilder(this); | ||
@@ -83,12 +84,13 @@ this.documentTypeContainerBuilder.push(builder); | ||
} | ||
addAllowedContentTypes() { | ||
const builder = new documentTypeAllowedContentTypeBuilder_1.DocumentTypeAllowedContentTypeBuilder(this); | ||
this.documentTypeAllowedContentTypeBuilder.push(builder); | ||
addAllowedDocumentType() { | ||
const builder = new documentTypeAllowedDocumentTypeBuilder_1.DocumentTypeAllowedDocumentTypeBuilder(this); | ||
this.documentTypeAllowedDocumentTypeBuilder.push(builder); | ||
return builder; | ||
} | ||
addAllowedTemplateIds(templateId) { | ||
this.documentTypeAllowedTemplateIdBuilder.push(templateId); | ||
return this; | ||
addAllowedTemplateId() { | ||
const builder = new documentTypeAllowedTemplateBuilder_1.DocumentTypeAllowedTemplateBuilder(this); | ||
this.documentTypeAllowedTemplateBuilder.push(builder); | ||
return builder; | ||
} | ||
addCompositions() { | ||
addComposition() { | ||
const builder = new documentTypeCompositionBuilder_1.DocumentTypeCompositionBuilder(this); | ||
@@ -98,6 +100,2 @@ this.documentTypeCompositionBuilder.push(builder); | ||
} | ||
withContainerId(containerId) { | ||
this.containerId = containerId; | ||
return this; | ||
} | ||
withId(id) { | ||
@@ -107,7 +105,2 @@ this.id = id; | ||
} | ||
addTemplateIds() { | ||
const builder = new documentTypeAllowedTemplateIdBuilder_1.DocumentTypeAllowedTemplateIdBuilder(this); | ||
this.documentTypeAllowedTemplateIdBuilder.push(builder); | ||
return builder; | ||
} | ||
withDefaultTemplateId(defaultTemplateId) { | ||
@@ -130,3 +123,3 @@ this.defaultTemplateId = defaultTemplateId; | ||
build() { | ||
if (this.id == null) { | ||
if (!this.id) { | ||
const crypto = require('crypto'); | ||
@@ -136,4 +129,4 @@ this.id = crypto.randomUUID(); | ||
return { | ||
alias: this.alias, | ||
name: this.name, | ||
alias: this.alias || "", | ||
name: this.name || "", | ||
description: this.description || "", | ||
@@ -144,2 +137,3 @@ icon: this.icon || "icon-document", | ||
variesBySegment: this.variesBySegment || false, | ||
collection: this.collectionId ? { id: this.collectionId } : null, | ||
isElement: this.isElement || false, | ||
@@ -152,3 +146,3 @@ properties: this.documentTypePropertyBuilder.map((builder) => { | ||
}) || [], | ||
allowedContentTypes: this.documentTypeAllowedContentTypeBuilder.map((builder) => { | ||
allowedDocumentTypes: this.documentTypeAllowedDocumentTypeBuilder.map((builder) => { | ||
return builder.build(); | ||
@@ -160,7 +154,7 @@ }) || [], | ||
id: this.id, | ||
containerId: this.containerId || null, | ||
allowedTemplatesIds: this.documentTypeAllowedTemplateIdBuilder.map((builder) => { | ||
folder: this.folderId ? { id: this.folderId } : null, | ||
allowedTemplates: this.documentTypeAllowedTemplateBuilder.map((builder) => { | ||
return builder.build(); | ||
}) || [], | ||
defaultTemplateId: this.defaultTemplateId || null, | ||
defaultTemplate: this.defaultTemplateId ? { id: this.defaultTemplateId } : null, | ||
cleanup: { | ||
@@ -167,0 +161,0 @@ preventCleanup: this.preventCleanup || false, |
import { DocumentTypeBuilder } from "./documentTypeBuilder"; | ||
export declare class DocumentTypeCompositionBuilder { | ||
parentBuilder: DocumentTypeBuilder; | ||
id: string; | ||
documentTypeId: string; | ||
compositionType: string; | ||
constructor(parentBuilder: DocumentTypeBuilder); | ||
withId(id: string): this; | ||
withDocumentTypeId(documentTypeId: string): this; | ||
withCompositionType(compositionType: string): this; | ||
done(): DocumentTypeBuilder; | ||
build(): { | ||
id: string | null; | ||
documentType: { | ||
id: string | null; | ||
}; | ||
compositionType: string; | ||
}; | ||
} |
@@ -6,3 +6,3 @@ "use strict"; | ||
parentBuilder; | ||
id; | ||
documentTypeId; | ||
compositionType; | ||
@@ -12,4 +12,4 @@ constructor(parentBuilder) { | ||
} | ||
withId(id) { | ||
this.id = id; | ||
withDocumentTypeId(documentTypeId) { | ||
this.documentTypeId = documentTypeId; | ||
return this; | ||
@@ -26,3 +26,5 @@ } | ||
return { | ||
id: this.id || null, | ||
documentType: { | ||
id: this.documentTypeId || null | ||
}, | ||
compositionType: this.compositionType || "Composition" | ||
@@ -29,0 +31,0 @@ }; |
@@ -18,3 +18,5 @@ import { DocumentTypeBuilder } from "./documentTypeBuilder"; | ||
id: string | null; | ||
parentId: string | null; | ||
parent: { | ||
id: string; | ||
} | null; | ||
name: string; | ||
@@ -21,0 +23,0 @@ type: string; |
@@ -40,5 +40,5 @@ "use strict"; | ||
id: this.id || null, | ||
parentId: this.parentId || null, | ||
parent: this.parentId ? { id: this.parentId } : null, | ||
name: this.name || "", | ||
type: this.type || "", | ||
type: this.type || "Group", | ||
sortOrder: this.sortOrder || 0 | ||
@@ -45,0 +45,0 @@ }; |
@@ -35,4 +35,6 @@ import { DocumentTypeBuilder } from "./documentTypeBuilder"; | ||
build(): { | ||
id: string | null; | ||
containerId: string | null; | ||
id: string; | ||
container: { | ||
id: string | null; | ||
}; | ||
sortOrder: number; | ||
@@ -42,10 +44,12 @@ alias: string; | ||
description: string; | ||
dataTypeId: string | null; | ||
dataType: { | ||
id: string | null; | ||
}; | ||
variesByCulture: boolean; | ||
variesBySegment: boolean; | ||
mandatory: boolean; | ||
validation: { | ||
mandatoryMessage: string; | ||
regEx: string; | ||
regExMessage: string; | ||
mandatory: boolean; | ||
mandatoryMessage: string | null; | ||
regEx: string | null; | ||
regExMessage: string | null; | ||
}; | ||
@@ -52,0 +56,0 @@ appearance: { |
@@ -83,5 +83,11 @@ "use strict"; | ||
build() { | ||
if (!this.id) { | ||
const crypto = require('crypto'); | ||
this.id = crypto.randomUUID(); | ||
} | ||
return { | ||
id: this.id || null, | ||
containerId: this.containerId || null, | ||
id: this.id, | ||
container: { | ||
id: this.containerId || null | ||
}, | ||
sortOrder: this.sortOrder || 0, | ||
@@ -91,10 +97,12 @@ alias: this.alias || "", | ||
description: this.description || "", | ||
dataTypeId: this.dataTypeId || null, | ||
dataType: { | ||
id: this.dataTypeId || null | ||
}, | ||
variesByCulture: this.variesByCulture || false, | ||
variesBySegment: this.variesBySegment || false, | ||
mandatory: this.mandatory || false, | ||
validation: { | ||
mandatoryMessage: this.mandatoryMessage || "", | ||
regEx: this.regEx || "", | ||
regExMessage: this.regExMessage || "" | ||
mandatory: this.mandatory || false, | ||
mandatoryMessage: this.mandatoryMessage || null, | ||
regEx: this.regEx || null, | ||
regExMessage: this.regExMessage || null | ||
}, | ||
@@ -101,0 +109,0 @@ appearance: { |
export { DocumentTypeBuilder } from './documentTypeBuilder'; | ||
export { DocumentTypeCompositionBuilder } from './documentTypeCompositionBuilder'; | ||
export { DocumentTypeAllowedContentTypeBuilder } from './documentTypeAllowedContentTypeBuilder'; | ||
export { DocumentTypeAllowedTemplateIdBuilder } from './documentTypeAllowedTemplateIdBuilder'; | ||
export { DocumentTypeAllowedDocumentTypeBuilder } from './documentTypeAllowedDocumentTypeBuilder'; | ||
export { DocumentTypeAllowedTemplateBuilder } from './documentTypeAllowedTemplateBuilder'; | ||
export { DocumentTypePropertyBuilder } from './documentTypePropertyBuilder'; | ||
export { DocumentTypeContainerBuilder } from './documentTypeContainerBuilder'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DocumentTypeContainerBuilder = exports.DocumentTypePropertyBuilder = exports.DocumentTypeAllowedTemplateIdBuilder = exports.DocumentTypeAllowedContentTypeBuilder = exports.DocumentTypeCompositionBuilder = exports.DocumentTypeBuilder = void 0; | ||
exports.DocumentTypeContainerBuilder = exports.DocumentTypePropertyBuilder = exports.DocumentTypeAllowedTemplateBuilder = exports.DocumentTypeAllowedDocumentTypeBuilder = exports.DocumentTypeCompositionBuilder = exports.DocumentTypeBuilder = void 0; | ||
var documentTypeBuilder_1 = require("./documentTypeBuilder"); | ||
@@ -8,6 +8,6 @@ Object.defineProperty(exports, "DocumentTypeBuilder", { enumerable: true, get: function () { return documentTypeBuilder_1.DocumentTypeBuilder; } }); | ||
Object.defineProperty(exports, "DocumentTypeCompositionBuilder", { enumerable: true, get: function () { return documentTypeCompositionBuilder_1.DocumentTypeCompositionBuilder; } }); | ||
var documentTypeAllowedContentTypeBuilder_1 = require("./documentTypeAllowedContentTypeBuilder"); | ||
Object.defineProperty(exports, "DocumentTypeAllowedContentTypeBuilder", { enumerable: true, get: function () { return documentTypeAllowedContentTypeBuilder_1.DocumentTypeAllowedContentTypeBuilder; } }); | ||
var documentTypeAllowedTemplateIdBuilder_1 = require("./documentTypeAllowedTemplateIdBuilder"); | ||
Object.defineProperty(exports, "DocumentTypeAllowedTemplateIdBuilder", { enumerable: true, get: function () { return documentTypeAllowedTemplateIdBuilder_1.DocumentTypeAllowedTemplateIdBuilder; } }); | ||
var documentTypeAllowedDocumentTypeBuilder_1 = require("./documentTypeAllowedDocumentTypeBuilder"); | ||
Object.defineProperty(exports, "DocumentTypeAllowedDocumentTypeBuilder", { enumerable: true, get: function () { return documentTypeAllowedDocumentTypeBuilder_1.DocumentTypeAllowedDocumentTypeBuilder; } }); | ||
var documentTypeAllowedTemplateBuilder_1 = require("./documentTypeAllowedTemplateBuilder"); | ||
Object.defineProperty(exports, "DocumentTypeAllowedTemplateBuilder", { enumerable: true, get: function () { return documentTypeAllowedTemplateBuilder_1.DocumentTypeAllowedTemplateBuilder; } }); | ||
var documentTypePropertyBuilder_1 = require("./documentTypePropertyBuilder"); | ||
@@ -14,0 +14,0 @@ Object.defineProperty(exports, "DocumentTypePropertyBuilder", { enumerable: true, get: function () { return documentTypePropertyBuilder_1.DocumentTypePropertyBuilder; } }); |
{ | ||
"name": "@umbraco/json-models-builders", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Builders and models for Umbraco Sites", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
176222
0.73%2248
1.44%0
-100%