@umbraco/json-models-builders
Advanced tools
Comparing version
@@ -8,3 +8,3 @@ import { DocumentValueBuilder } from "./documentValueBuilder"; | ||
parentId: string; | ||
contentTypeId: string; | ||
documentTypeId: string; | ||
templateId: string; | ||
@@ -16,9 +16,5 @@ constructor(); | ||
withParentId(parentId: string): this; | ||
withContentTypeId(contentTypeId: string): this; | ||
withDocumentTypeId(documentTypeId: string): this; | ||
withTemplateId(templateId: string): this; | ||
build(): { | ||
id: string; | ||
parentId: string | null; | ||
contentTypeId: string | null; | ||
templateId: string | null; | ||
values: { | ||
@@ -35,3 +31,13 @@ culture: string | null; | ||
}[]; | ||
id: string; | ||
parent: { | ||
id: string; | ||
} | null; | ||
documentType: { | ||
id: string; | ||
}; | ||
template: { | ||
id: string; | ||
} | null; | ||
}; | ||
} |
@@ -11,3 +11,3 @@ "use strict"; | ||
parentId; | ||
contentTypeId; | ||
documentTypeId; | ||
templateId; | ||
@@ -36,4 +36,4 @@ constructor() { | ||
} | ||
withContentTypeId(contentTypeId) { | ||
this.contentTypeId = contentTypeId; | ||
withDocumentTypeId(documentTypeId) { | ||
this.documentTypeId = documentTypeId; | ||
return this; | ||
@@ -46,3 +46,3 @@ } | ||
build() { | ||
if (this.id == null) { | ||
if (!this.id) { | ||
const crypto = require('crypto'); | ||
@@ -52,6 +52,2 @@ this.id = crypto.randomUUID(); | ||
return { | ||
id: this.id, | ||
parentId: this.parentId || null, | ||
contentTypeId: this.contentTypeId || null, | ||
templateId: this.templateId || null, | ||
values: this.documentValueBuilder.map((builder) => { | ||
@@ -62,3 +58,7 @@ return builder.build(); | ||
return builder.build(); | ||
}) | ||
}), | ||
id: this.id, | ||
parent: this.parentId ? { id: this.parentId } : null, | ||
documentType: { id: this.documentTypeId }, | ||
template: this.templateId ? { id: this.templateId } : null, | ||
}; | ||
@@ -65,0 +65,0 @@ } |
@@ -7,1 +7,3 @@ export * from './packages'; | ||
export * from './media'; | ||
export * from './users'; | ||
export * from './userGroups'; |
@@ -10,2 +10,4 @@ "use strict"; | ||
tslib_1.__exportStar(require("./media"), exports); | ||
tslib_1.__exportStar(require("./users"), exports); | ||
tslib_1.__exportStar(require("./userGroups"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@umbraco/json-models-builders", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"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
196240
10.49%114
15.15%2545
11.48%