@umbraco/playwright-testhelpers 2.0.0-beta.9 → 15.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/helpers/ApiHelpers.d.ts +44 -4
- package/dist/lib/helpers/ApiHelpers.js +212 -7
- package/dist/lib/helpers/ApiHelpers.js.map +1 -1
- package/dist/lib/helpers/ContentUiHelper.d.ts +186 -0
- package/dist/lib/helpers/ContentUiHelper.js +559 -0
- package/dist/lib/helpers/ContentUiHelper.js.map +1 -0
- package/dist/lib/helpers/DataTypeApiHelper.d.ts +95 -14
- package/dist/lib/helpers/DataTypeApiHelper.js +829 -130
- package/dist/lib/helpers/DataTypeApiHelper.js.map +1 -1
- package/dist/lib/helpers/DataTypeUiHelper.d.ts +266 -0
- package/dist/lib/helpers/DataTypeUiHelper.js +850 -0
- package/dist/lib/helpers/DataTypeUiHelper.js.map +1 -0
- package/dist/lib/helpers/DictionaryApiHelper.d.ts +2 -1
- package/dist/lib/helpers/DictionaryApiHelper.js +17 -4
- package/dist/lib/helpers/DictionaryApiHelper.js.map +1 -1
- package/dist/lib/helpers/DictionaryUiHelper.d.ts +7 -9
- package/dist/lib/helpers/DictionaryUiHelper.js +33 -33
- package/dist/lib/helpers/DictionaryUiHelper.js.map +1 -1
- package/dist/lib/helpers/DocumentApiHelper.d.ts +38 -0
- package/dist/lib/helpers/DocumentApiHelper.js +365 -0
- package/dist/lib/helpers/DocumentApiHelper.js.map +1 -1
- package/dist/lib/helpers/DocumentBlueprintApiHelper.d.ts +18 -0
- package/dist/lib/helpers/DocumentBlueprintApiHelper.js +126 -0
- package/dist/lib/helpers/DocumentBlueprintApiHelper.js.map +1 -0
- package/dist/lib/helpers/DocumentBlueprintUiHelper.d.ts +17 -0
- package/dist/lib/helpers/DocumentBlueprintUiHelper.js +52 -0
- package/dist/lib/helpers/DocumentBlueprintUiHelper.js.map +1 -0
- package/dist/lib/helpers/DocumentTypeApiHelper.d.ts +42 -0
- package/dist/lib/helpers/DocumentTypeApiHelper.js +551 -0
- package/dist/lib/helpers/DocumentTypeApiHelper.js.map +1 -0
- package/dist/lib/helpers/DocumentTypeUiHelper.d.ts +35 -0
- package/dist/lib/helpers/DocumentTypeUiHelper.js +98 -0
- package/dist/lib/helpers/DocumentTypeUiHelper.js.map +1 -0
- package/dist/lib/helpers/ExamineManagementUiHelper.d.ts +15 -0
- package/dist/lib/helpers/ExamineManagementUiHelper.js +38 -0
- package/dist/lib/helpers/ExamineManagementUiHelper.js.map +1 -0
- package/dist/lib/helpers/HealthCheckApiHelper.d.ts +13 -0
- package/dist/lib/helpers/HealthCheckApiHelper.js +47 -0
- package/dist/lib/helpers/HealthCheckApiHelper.js.map +1 -0
- package/dist/lib/helpers/HealthCheckUiHelper.d.ts +23 -0
- package/dist/lib/helpers/HealthCheckUiHelper.js +59 -0
- package/dist/lib/helpers/HealthCheckUiHelper.js.map +1 -0
- package/dist/lib/helpers/IndexerApiHelper.d.ts +7 -0
- package/dist/lib/helpers/IndexerApiHelper.js +19 -0
- package/dist/lib/helpers/IndexerApiHelper.js.map +1 -0
- package/dist/lib/helpers/LanguageApiHelper.d.ts +8 -4
- package/dist/lib/helpers/LanguageApiHelper.js +46 -26
- package/dist/lib/helpers/LanguageApiHelper.js.map +1 -1
- package/dist/lib/helpers/LanguageUiHelper.d.ts +23 -0
- package/dist/lib/helpers/LanguageUiHelper.js +68 -0
- package/dist/lib/helpers/LanguageUiHelper.js.map +1 -0
- package/dist/lib/helpers/LogViewerUiHelper.d.ts +37 -0
- package/dist/lib/helpers/LogViewerUiHelper.js +102 -0
- package/dist/lib/helpers/LogViewerUiHelper.js.map +1 -0
- package/dist/lib/helpers/LoginApiHelper.d.ts +16 -0
- package/dist/lib/helpers/LoginApiHelper.js +107 -0
- package/dist/lib/helpers/LoginApiHelper.js.map +1 -0
- package/dist/lib/helpers/LoginUiHelper.d.ts +11 -0
- package/dist/lib/helpers/LoginUiHelper.js +30 -0
- package/dist/lib/helpers/LoginUiHelper.js.map +1 -0
- package/dist/lib/helpers/MediaApiHelper.d.ts +32 -0
- package/dist/lib/helpers/MediaApiHelper.js +245 -0
- package/dist/lib/helpers/MediaApiHelper.js.map +1 -0
- package/dist/lib/helpers/MediaTypeApiHelper.d.ts +32 -0
- package/dist/lib/helpers/MediaTypeApiHelper.js +390 -0
- package/dist/lib/helpers/MediaTypeApiHelper.js.map +1 -0
- package/dist/lib/helpers/MediaTypeUiHelper.d.ts +14 -0
- package/dist/lib/helpers/MediaTypeUiHelper.js +38 -0
- package/dist/lib/helpers/MediaTypeUiHelper.js.map +1 -0
- package/dist/lib/helpers/MediaUiHelper.d.ts +49 -0
- package/dist/lib/helpers/MediaUiHelper.js +144 -0
- package/dist/lib/helpers/MediaUiHelper.js.map +1 -0
- package/dist/lib/helpers/MemberApiHelper.d.ts +16 -0
- package/dist/lib/helpers/MemberApiHelper.js +88 -0
- package/dist/lib/helpers/MemberApiHelper.js.map +1 -0
- package/dist/lib/helpers/MemberGroupApiHelper.d.ts +14 -0
- package/dist/lib/helpers/MemberGroupApiHelper.js +62 -0
- package/dist/lib/helpers/MemberGroupApiHelper.js.map +1 -0
- package/dist/lib/helpers/MemberGroupUiHelper.d.ts +20 -0
- package/dist/lib/helpers/MemberGroupUiHelper.js +57 -0
- package/dist/lib/helpers/MemberGroupUiHelper.js.map +1 -0
- package/dist/lib/helpers/MemberTypeApiHelper.d.ts +17 -0
- package/dist/lib/helpers/MemberTypeApiHelper.js +121 -0
- package/dist/lib/helpers/MemberTypeApiHelper.js.map +1 -0
- package/dist/lib/helpers/MemberTypeUiHelper.d.ts +13 -0
- package/dist/lib/helpers/MemberTypeUiHelper.js +35 -0
- package/dist/lib/helpers/MemberTypeUiHelper.js.map +1 -0
- package/dist/lib/helpers/MemberUiHelper.d.ts +45 -0
- package/dist/lib/helpers/MemberUiHelper.js +130 -0
- package/dist/lib/helpers/MemberUiHelper.js.map +1 -0
- package/dist/lib/helpers/ModelsBuilderApiHelper.d.ts +6 -0
- package/dist/lib/helpers/ModelsBuilderApiHelper.js +15 -0
- package/dist/lib/helpers/ModelsBuilderApiHelper.js.map +1 -0
- package/dist/lib/helpers/ModelsBuilderUiHelper.d.ts +9 -0
- package/dist/lib/helpers/ModelsBuilderUiHelper.js +22 -0
- package/dist/lib/helpers/ModelsBuilderUiHelper.js.map +1 -0
- package/dist/lib/helpers/ObjectTypesApiHelper.d.ts +7 -0
- package/dist/lib/helpers/ObjectTypesApiHelper.js +25 -0
- package/dist/lib/helpers/ObjectTypesApiHelper.js.map +1 -0
- package/dist/lib/helpers/PackageApiHelper.d.ts +3 -2
- package/dist/lib/helpers/PackageApiHelper.js +6 -3
- package/dist/lib/helpers/PackageApiHelper.js.map +1 -1
- package/dist/lib/helpers/PackageUiHelper.d.ts +49 -0
- package/dist/lib/helpers/PackageUiHelper.js +134 -0
- package/dist/lib/helpers/PackageUiHelper.js.map +1 -0
- package/dist/lib/helpers/PartialViewApiHelper.d.ts +5 -4
- package/dist/lib/helpers/PartialViewApiHelper.js +36 -30
- package/dist/lib/helpers/PartialViewApiHelper.js.map +1 -1
- package/dist/lib/helpers/PartialViewUiHelper.d.ts +7 -11
- package/dist/lib/helpers/PartialViewUiHelper.js +27 -36
- package/dist/lib/helpers/PartialViewUiHelper.js.map +1 -1
- package/dist/lib/helpers/ProfilingUiHelper.d.ts +11 -0
- package/dist/lib/helpers/ProfilingUiHelper.js +27 -0
- package/dist/lib/helpers/ProfilingUiHelper.js.map +1 -0
- package/dist/lib/helpers/PublishedCacheApiHelper.d.ts +6 -0
- package/dist/lib/helpers/PublishedCacheApiHelper.js +15 -0
- package/dist/lib/helpers/PublishedCacheApiHelper.js.map +1 -0
- package/dist/lib/helpers/PublishedStatusUiHelper.d.ts +19 -0
- package/dist/lib/helpers/PublishedStatusUiHelper.js +47 -0
- package/dist/lib/helpers/PublishedStatusUiHelper.js.map +1 -0
- package/dist/lib/helpers/RedirectManagementApiHelper.d.ts +10 -0
- package/dist/lib/helpers/RedirectManagementApiHelper.js +30 -0
- package/dist/lib/helpers/RedirectManagementApiHelper.js.map +1 -0
- package/dist/lib/helpers/RedirectManagementUiHelper.d.ts +17 -0
- package/dist/lib/helpers/RedirectManagementUiHelper.js +45 -0
- package/dist/lib/helpers/RedirectManagementUiHelper.js.map +1 -0
- package/dist/lib/helpers/RelationTypeApiHelper.d.ts +15 -0
- package/dist/lib/helpers/{RelationType.js → RelationTypeApiHelper.js} +45 -58
- package/dist/lib/helpers/RelationTypeApiHelper.js.map +1 -0
- package/dist/lib/helpers/RelationTypeUiHelper.d.ts +21 -0
- package/dist/lib/helpers/RelationTypeUiHelper.js +55 -0
- package/dist/lib/helpers/RelationTypeUiHelper.js.map +1 -0
- package/dist/lib/helpers/ScriptApiHelper.d.ts +5 -3
- package/dist/lib/helpers/ScriptApiHelper.js +44 -26
- package/dist/lib/helpers/ScriptApiHelper.js.map +1 -1
- package/dist/lib/helpers/ScriptUiHelper.d.ts +8 -12
- package/dist/lib/helpers/ScriptUiHelper.js +31 -40
- package/dist/lib/helpers/ScriptUiHelper.js.map +1 -1
- package/dist/lib/helpers/StylesheetApiHelper.d.ts +6 -4
- package/dist/lib/helpers/StylesheetApiHelper.js +47 -41
- package/dist/lib/helpers/StylesheetApiHelper.js.map +1 -1
- package/dist/lib/helpers/StylesheetUiHelper.d.ts +17 -15
- package/dist/lib/helpers/StylesheetUiHelper.js +60 -47
- package/dist/lib/helpers/StylesheetUiHelper.js.map +1 -1
- package/dist/lib/helpers/TelemetryDataUiHelper.d.ts +10 -0
- package/dist/lib/helpers/TelemetryDataUiHelper.js +25 -0
- package/dist/lib/helpers/TelemetryDataUiHelper.js.map +1 -0
- package/dist/lib/helpers/TemplateApiHelper.d.ts +1 -0
- package/dist/lib/helpers/TemplateApiHelper.js +6 -0
- package/dist/lib/helpers/TemplateApiHelper.js.map +1 -1
- package/dist/lib/helpers/TemplateUiHelper.d.ts +14 -18
- package/dist/lib/helpers/TemplateUiHelper.js +65 -59
- package/dist/lib/helpers/TemplateUiHelper.js.map +1 -1
- package/dist/lib/helpers/TemporaryFileApiHelper.d.ts +17 -1
- package/dist/lib/helpers/TemporaryFileApiHelper.js +23 -10
- package/dist/lib/helpers/TemporaryFileApiHelper.js.map +1 -1
- package/dist/lib/helpers/UiBaseLocators.d.ts +213 -9
- package/dist/lib/helpers/UiBaseLocators.js +703 -39
- package/dist/lib/helpers/UiBaseLocators.js.map +1 -1
- package/dist/lib/helpers/UiHelpers.d.ts +49 -7
- package/dist/lib/helpers/UiHelpers.js +75 -21
- package/dist/lib/helpers/UiHelpers.js.map +1 -1
- package/dist/lib/helpers/UserApiHelper.d.ts +19 -10
- package/dist/lib/helpers/UserApiHelper.js +72 -20
- package/dist/lib/helpers/UserApiHelper.js.map +1 -1
- package/dist/lib/helpers/UserGroupApiHelper.d.ts +5 -3
- package/dist/lib/helpers/UserGroupApiHelper.js +20 -19
- package/dist/lib/helpers/UserGroupApiHelper.js.map +1 -1
- package/dist/lib/helpers/UserGroupUiHelper.d.ts +20 -0
- package/dist/lib/helpers/UserGroupUiHelper.js +56 -0
- package/dist/lib/helpers/UserGroupUiHelper.js.map +1 -0
- package/dist/lib/helpers/UserUiHelper.d.ts +80 -0
- package/dist/lib/helpers/UserUiHelper.js +221 -0
- package/dist/lib/helpers/UserUiHelper.js.map +1 -0
- package/dist/lib/helpers/WelcomeDashboardUiHelper.d.ts +9 -0
- package/dist/lib/helpers/WelcomeDashboardUiHelper.js +22 -0
- package/dist/lib/helpers/WelcomeDashboardUiHelper.js.map +1 -0
- package/dist/lib/helpers/testExtension.js +4 -0
- package/dist/lib/helpers/testExtension.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/umbraco.config.js +1 -1
- package/dist/umbraco.config.js.map +1 -1
- package/package.json +9 -11
- package/dist/lib/helpers/RelationType.d.ts +0 -15
- package/dist/lib/helpers/RelationType.js.map +0 -1
|
@@ -1,81 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataTypeApiHelper = void 0;
|
|
4
|
+
const json_models_builders_1 = require("@umbraco/json-models-builders");
|
|
4
5
|
class DataTypeApiHelper {
|
|
5
6
|
api;
|
|
6
7
|
constructor(api) {
|
|
7
8
|
this.api = api;
|
|
8
9
|
}
|
|
9
|
-
async ensureNameNotExistsAtRoot(name) {
|
|
10
|
-
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/tree/data-type/root?skip=0&take=10000&foldersOnly=false');
|
|
11
|
-
const json = await response.json();
|
|
12
|
-
for (const sb of json.items) {
|
|
13
|
-
if (sb.name === name) {
|
|
14
|
-
if (sb.isFolder == false) {
|
|
15
|
-
return await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/data-type/' + sb.id);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
if (sb.hasChildren == true) {
|
|
19
|
-
return await this.recurseFolderChildren(sb.id);
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/data-type/folder/' + sb.id);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
10
|
async get(id) {
|
|
30
11
|
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/data-type/' + id);
|
|
31
|
-
|
|
32
|
-
if (json !== null) {
|
|
33
|
-
return json;
|
|
34
|
-
}
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
async getByNameAtRoot(name) {
|
|
38
|
-
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/tree/data-type/root?skip=0&take=10000&foldersOnly=false');
|
|
39
|
-
const json = await response.json();
|
|
40
|
-
for (const sb of json.items) {
|
|
41
|
-
if (sb.name === name) {
|
|
42
|
-
if (sb.id !== null) {
|
|
43
|
-
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/data-type/' + sb.id);
|
|
44
|
-
return response.json();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
12
|
+
return await response.json();
|
|
49
13
|
}
|
|
50
|
-
async create(name, editorAlias, values, parentId,
|
|
14
|
+
async create(name, editorAlias, editorUiAlias, values, parentId, id) {
|
|
51
15
|
const dataType = {
|
|
52
16
|
"name": name,
|
|
53
17
|
"editorAlias": editorAlias,
|
|
54
18
|
"editorUiAlias": editorUiAlias,
|
|
55
19
|
"values": values,
|
|
56
|
-
"
|
|
20
|
+
"id": id,
|
|
21
|
+
"parent": parentId ? { "id": parentId } : null
|
|
57
22
|
};
|
|
58
23
|
const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/data-type', dataType);
|
|
59
24
|
// Returns the id of the created dataType
|
|
60
|
-
return response.headers().location.split("/").pop();
|
|
25
|
+
return response.headers().location.split("v1/data-type/").pop();
|
|
61
26
|
}
|
|
62
27
|
async update(id, dataType) {
|
|
63
|
-
|
|
28
|
+
const updateDataType = {
|
|
29
|
+
"name": dataType.name,
|
|
30
|
+
"editorAlias": dataType.editorAlias,
|
|
31
|
+
"editorUiAlias": dataType.editorUiAlias,
|
|
32
|
+
"values": dataType.values,
|
|
33
|
+
};
|
|
34
|
+
return await this.api.put(this.api.baseUrl + '/umbraco/management/api/v1/data-type/' + id, updateDataType);
|
|
64
35
|
}
|
|
65
36
|
async delete(id) {
|
|
66
37
|
return await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/data-type/' + id);
|
|
67
38
|
}
|
|
68
|
-
async
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/data-type/' + sb.id);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return null;
|
|
39
|
+
async getAllAtRoot() {
|
|
40
|
+
return await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/tree/data-type/root?skip=0&take=10000&foldersOnly=false');
|
|
41
|
+
}
|
|
42
|
+
async doesExist(id) {
|
|
43
|
+
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/data-type/' + id);
|
|
44
|
+
return response.status() === 200;
|
|
79
45
|
}
|
|
80
46
|
async getItems(ids) {
|
|
81
47
|
let idArray = 'id=' + ids[0];
|
|
@@ -84,124 +50,857 @@ class DataTypeApiHelper {
|
|
|
84
50
|
idArray += '&id=' + ids[i];
|
|
85
51
|
}
|
|
86
52
|
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/tree/data-type/item?' + idArray);
|
|
87
|
-
|
|
88
|
-
if (json !== null) {
|
|
89
|
-
return json;
|
|
90
|
-
}
|
|
91
|
-
return null;
|
|
53
|
+
return await response.json();
|
|
92
54
|
}
|
|
93
|
-
async
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
55
|
+
async getByName(name) {
|
|
56
|
+
const rootDataTypes = await this.getAllAtRoot();
|
|
57
|
+
const jsonDataTypes = await rootDataTypes.json();
|
|
58
|
+
for (const dataType of jsonDataTypes.items) {
|
|
59
|
+
if (dataType.name === name) {
|
|
60
|
+
return this.get(dataType.id);
|
|
61
|
+
}
|
|
62
|
+
else if (dataType.isContainer || dataType.hasChildren) {
|
|
63
|
+
const result = await this.recurseChildren(name, dataType.id, false);
|
|
64
|
+
if (result) {
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
98
68
|
}
|
|
99
|
-
return
|
|
100
|
-
}
|
|
101
|
-
async exists(id) {
|
|
102
|
-
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/data-type/' + id);
|
|
103
|
-
return response.status() === 200;
|
|
69
|
+
return false;
|
|
104
70
|
}
|
|
105
|
-
async
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
for (const
|
|
109
|
-
if (
|
|
110
|
-
|
|
71
|
+
async ensureNameNotExists(name) {
|
|
72
|
+
const rootDataTypes = await this.getAllAtRoot();
|
|
73
|
+
const jsonDataTypes = await rootDataTypes.json();
|
|
74
|
+
for (const dataType of jsonDataTypes.items) {
|
|
75
|
+
if (dataType.name === name) {
|
|
76
|
+
if (dataType.isFolder) {
|
|
77
|
+
return await this.recurseDeleteChildren(dataType);
|
|
78
|
+
}
|
|
79
|
+
return await this.delete(dataType.id);
|
|
80
|
+
}
|
|
81
|
+
else if (dataType.hasChildren) {
|
|
82
|
+
await this.recurseChildren(name, dataType.id, true);
|
|
111
83
|
}
|
|
112
84
|
}
|
|
113
|
-
return
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
async doesNameExist(name) {
|
|
88
|
+
return await this.getByName(name);
|
|
114
89
|
}
|
|
115
90
|
async moveToFolder(dataTypeId, folderId) {
|
|
116
91
|
const folderIdBody = {
|
|
117
|
-
"
|
|
92
|
+
"target": { id: folderId }
|
|
118
93
|
};
|
|
119
|
-
return await this.api.
|
|
94
|
+
return await this.api.put(this.api.baseUrl + '/umbraco/management/api/v1/data-type/' + dataTypeId + '/move', folderIdBody);
|
|
120
95
|
}
|
|
121
96
|
async copyToFolder(dataTypeId, folderId) {
|
|
122
97
|
const folderIdBody = {
|
|
123
|
-
"
|
|
98
|
+
"target": { id: folderId }
|
|
124
99
|
};
|
|
125
100
|
const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/data-type/' + dataTypeId + '/copy', folderIdBody);
|
|
126
101
|
// Returns the id of the copied dataType
|
|
127
|
-
return response.headers().location.split("/").pop();
|
|
102
|
+
return response.headers().location.split("v1/data-type/").pop();
|
|
128
103
|
}
|
|
129
104
|
// FOLDER
|
|
130
105
|
async getFolder(id) {
|
|
131
106
|
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/data-type/folder/' + id);
|
|
132
107
|
return await response.json();
|
|
133
108
|
}
|
|
134
|
-
async
|
|
135
|
-
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/data-type/folder/' + id);
|
|
136
|
-
return response.status() === 200;
|
|
137
|
-
}
|
|
138
|
-
async getFolderByName(name) {
|
|
139
|
-
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/tree/data-type/root?skip=0&take=10000&foldersOnly=true');
|
|
140
|
-
const json = await response.json();
|
|
141
|
-
for (const sb of json.items) {
|
|
142
|
-
if (sb.name === name) {
|
|
143
|
-
if (sb.id !== null) {
|
|
144
|
-
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/data-type/folder/' + sb.id);
|
|
145
|
-
return response.json();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
async createFolder(name, parentId) {
|
|
109
|
+
async createFolder(name, parentId, id) {
|
|
152
110
|
const folderData = {
|
|
153
111
|
"name": name,
|
|
154
|
-
"
|
|
112
|
+
"id": id,
|
|
113
|
+
"parent": parentId ? { "id": parentId } : null
|
|
155
114
|
};
|
|
156
115
|
const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/data-type/folder', folderData);
|
|
157
116
|
// Returns the id of the created dataTypeFolder
|
|
158
|
-
return response.headers().location.split("/").pop();
|
|
117
|
+
return response.headers().location.split("v1/data-type/folder/").pop();
|
|
159
118
|
}
|
|
160
|
-
async
|
|
161
|
-
|
|
119
|
+
async renameFolder(id, name) {
|
|
120
|
+
const folderData = {
|
|
121
|
+
"name": name,
|
|
122
|
+
};
|
|
123
|
+
return await this.api.put(this.api.baseUrl + '/umbraco/management/api/v1/data-type/folder/' + id, folderData);
|
|
162
124
|
}
|
|
163
125
|
async deleteFolder(id) {
|
|
164
126
|
return await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/data-type/folder/' + id);
|
|
165
127
|
}
|
|
166
|
-
async
|
|
167
|
-
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/
|
|
168
|
-
|
|
169
|
-
for (const sb of json.items) {
|
|
170
|
-
if (sb.name === name) {
|
|
171
|
-
if (sb.id !== null) {
|
|
172
|
-
return await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/data-type/folder/' + sb.id);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return null;
|
|
128
|
+
async doesFolderExist(id) {
|
|
129
|
+
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/data-type/folder/' + id);
|
|
130
|
+
return response.status() === 200;
|
|
177
131
|
}
|
|
178
132
|
async getChildren(id) {
|
|
179
133
|
const response = await this.api.get(this.api.baseUrl + '/umbraco/management/api/v1/tree/data-type/children?parentId=' + id + '&skip=0&take=100&foldersOnly=false');
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
134
|
+
const items = await response.json();
|
|
135
|
+
return items.items;
|
|
136
|
+
}
|
|
137
|
+
async recurseDeleteChildren(dataFolder) {
|
|
138
|
+
if (!dataFolder.hasChildren) {
|
|
139
|
+
return await this.deleteFolder(dataFolder.id);
|
|
183
140
|
}
|
|
184
|
-
|
|
141
|
+
const items = await this.getChildren(dataFolder.id);
|
|
142
|
+
for (const child of items) {
|
|
143
|
+
if (child.hasChildren) {
|
|
144
|
+
await this.recurseDeleteChildren(child);
|
|
145
|
+
}
|
|
146
|
+
else if (child.isFolder) {
|
|
147
|
+
await this.deleteFolder(child.id);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
await this.delete(child.id);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return await this.deleteFolder(dataFolder.id);
|
|
185
154
|
}
|
|
186
|
-
async
|
|
187
|
-
const
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
await this.recurseFolderChildren(child.path);
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
await this.api.delete(this.api.baseUrl + '/umbraco/management/api/v1/data-type/folder/' + child.id);
|
|
155
|
+
async recurseChildren(name, id, toDelete) {
|
|
156
|
+
const items = await this.getChildren(id);
|
|
157
|
+
for (const child of items) {
|
|
158
|
+
if (child.name === name) {
|
|
159
|
+
if (!toDelete) {
|
|
160
|
+
if (child.isFolder) {
|
|
161
|
+
return await this.getFolder(child.id);
|
|
197
162
|
}
|
|
163
|
+
return await this.get(child.id);
|
|
198
164
|
}
|
|
199
|
-
|
|
200
|
-
await this.
|
|
165
|
+
if (child.isFolder) {
|
|
166
|
+
return await this.recurseDeleteChildren(child);
|
|
201
167
|
}
|
|
168
|
+
return await this.delete(child.id);
|
|
202
169
|
}
|
|
170
|
+
else if (child.hasChildren) {
|
|
171
|
+
return await this.recurseChildren(name, child.id, toDelete);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
async save(dataType) {
|
|
177
|
+
const response = await this.api.post(this.api.baseUrl + '/umbraco/management/api/v1/data-type', dataType);
|
|
178
|
+
return response.headers().location.split("v1/data-type/").pop();
|
|
179
|
+
}
|
|
180
|
+
async createDateTypeDataType(name) {
|
|
181
|
+
await this.ensureNameNotExists(name);
|
|
182
|
+
const dataType = new json_models_builders_1.DatePickerDataTypeBuilder()
|
|
183
|
+
.withName(name)
|
|
184
|
+
.build();
|
|
185
|
+
return await this.save(dataType);
|
|
186
|
+
}
|
|
187
|
+
async createCheckboxListDataType(name, options) {
|
|
188
|
+
await this.ensureNameNotExists(name);
|
|
189
|
+
const dataType = new json_models_builders_1.CheckboxListDataTypeBuilder()
|
|
190
|
+
.withName(name)
|
|
191
|
+
.withItems(options)
|
|
192
|
+
.build();
|
|
193
|
+
return await this.save(dataType);
|
|
194
|
+
}
|
|
195
|
+
async createContentPickerDataTypeWithStartNode(name, startNodeId) {
|
|
196
|
+
await this.ensureNameNotExists(name);
|
|
197
|
+
const dataType = new json_models_builders_1.ContentPickerDataTypeBuilder()
|
|
198
|
+
.withName(name)
|
|
199
|
+
.withStartNodeId(startNodeId)
|
|
200
|
+
.build();
|
|
201
|
+
return await this.save(dataType);
|
|
202
|
+
}
|
|
203
|
+
async createContentPickerDataTypeWithShowOpenButton(name) {
|
|
204
|
+
await this.ensureNameNotExists(name);
|
|
205
|
+
const dataType = new json_models_builders_1.ContentPickerDataTypeBuilder()
|
|
206
|
+
.withName(name)
|
|
207
|
+
.withShowOpenButton(true)
|
|
208
|
+
.build();
|
|
209
|
+
return await this.save(dataType);
|
|
210
|
+
}
|
|
211
|
+
async createContentPickerDataTypeWithIgnoreUserStartNodes(name, startNodeId) {
|
|
212
|
+
await this.ensureNameNotExists(name);
|
|
213
|
+
const dataType = new json_models_builders_1.ContentPickerDataTypeBuilder()
|
|
214
|
+
.withName(name)
|
|
215
|
+
.withStartNodeId(startNodeId)
|
|
216
|
+
.withIgnoreUserStartNodes(true)
|
|
217
|
+
.build();
|
|
218
|
+
return await this.save(dataType);
|
|
219
|
+
}
|
|
220
|
+
async createDatePickerDataType(name, dateFormat) {
|
|
221
|
+
await this.ensureNameNotExists(name);
|
|
222
|
+
const dataType = new json_models_builders_1.DatePickerDataTypeBuilder()
|
|
223
|
+
.withName(name)
|
|
224
|
+
.withFormat(dateFormat)
|
|
225
|
+
.build();
|
|
226
|
+
return await this.save(dataType);
|
|
227
|
+
}
|
|
228
|
+
async createDropdownDataType(name, isMultiple, options) {
|
|
229
|
+
await this.ensureNameNotExists(name);
|
|
230
|
+
const dataType = new json_models_builders_1.DropdownDataTypeBuilder()
|
|
231
|
+
.withName(name)
|
|
232
|
+
.withMultiple(isMultiple)
|
|
233
|
+
.withItems(options)
|
|
234
|
+
.build();
|
|
235
|
+
return await this.save(dataType);
|
|
236
|
+
}
|
|
237
|
+
// BlockListEditor
|
|
238
|
+
async createEmptyBlockListDataType(name) {
|
|
239
|
+
await this.ensureNameNotExists(name);
|
|
240
|
+
const blockList = new json_models_builders_1.BlockListDataTypeBuilder()
|
|
241
|
+
.withName(name)
|
|
242
|
+
.build();
|
|
243
|
+
return await this.save(blockList);
|
|
244
|
+
}
|
|
245
|
+
async createBlockListDataTypeWithABlock(name, contentElementTypeId) {
|
|
246
|
+
await this.ensureNameNotExists(name);
|
|
247
|
+
const blockList = new json_models_builders_1.BlockListDataTypeBuilder()
|
|
248
|
+
.withName(name)
|
|
249
|
+
.addBlock()
|
|
250
|
+
.withContentElementTypeKey(contentElementTypeId)
|
|
251
|
+
.done()
|
|
252
|
+
.build();
|
|
253
|
+
return await this.save(blockList);
|
|
254
|
+
}
|
|
255
|
+
async createBlockListDataTypeWithContentAndSettingsElementType(name, contentElementTypeId, settingsElementTypeId) {
|
|
256
|
+
await this.ensureNameNotExists(name);
|
|
257
|
+
const blockList = new json_models_builders_1.BlockListDataTypeBuilder()
|
|
258
|
+
.withName(name)
|
|
259
|
+
.addBlock()
|
|
260
|
+
.withContentElementTypeKey(contentElementTypeId)
|
|
261
|
+
.withSettingsElementTypeKey(settingsElementTypeId)
|
|
262
|
+
.done()
|
|
263
|
+
.build();
|
|
264
|
+
return await this.save(blockList);
|
|
265
|
+
}
|
|
266
|
+
async createBlockListDataTypeWithMinAndMaxAmount(name, minAmount = 0, maxAmount = 0) {
|
|
267
|
+
await this.ensureNameNotExists(name);
|
|
268
|
+
const blockList = new json_models_builders_1.BlockListDataTypeBuilder()
|
|
269
|
+
.withName(name)
|
|
270
|
+
.withMinValue(minAmount)
|
|
271
|
+
.withMaxValue(maxAmount)
|
|
272
|
+
.build();
|
|
273
|
+
return await this.save(blockList);
|
|
274
|
+
}
|
|
275
|
+
async createBlockListDataTypeWithSingleBlockMode(name, enabled) {
|
|
276
|
+
await this.ensureNameNotExists(name);
|
|
277
|
+
const blockList = new json_models_builders_1.BlockListDataTypeBuilder()
|
|
278
|
+
.withName(name)
|
|
279
|
+
.withSingleBlockMode(enabled)
|
|
280
|
+
.build();
|
|
281
|
+
return await this.save(blockList);
|
|
282
|
+
}
|
|
283
|
+
async createBlockListDataTypeWithLiveEditingMode(name, enabled) {
|
|
284
|
+
await this.ensureNameNotExists(name);
|
|
285
|
+
const blockList = new json_models_builders_1.BlockListDataTypeBuilder()
|
|
286
|
+
.withName(name)
|
|
287
|
+
.withLiveEditing(enabled)
|
|
288
|
+
.build();
|
|
289
|
+
return await this.save(blockList);
|
|
290
|
+
}
|
|
291
|
+
async createBlockListDataTypeWithInlineEditingMode(name, enabled) {
|
|
292
|
+
await this.ensureNameNotExists(name);
|
|
293
|
+
const blockList = new json_models_builders_1.BlockListDataTypeBuilder()
|
|
294
|
+
.withName(name)
|
|
295
|
+
.withInlineEditingAsDefault(enabled)
|
|
296
|
+
.build();
|
|
297
|
+
return await this.save(blockList);
|
|
298
|
+
}
|
|
299
|
+
async createBlockListDataTypeWithPropertyEditorWidth(name, width) {
|
|
300
|
+
await this.ensureNameNotExists(name);
|
|
301
|
+
const blockList = new json_models_builders_1.BlockListDataTypeBuilder()
|
|
302
|
+
.withName(name)
|
|
303
|
+
.withMaxPropertyWidth(width)
|
|
304
|
+
.build();
|
|
305
|
+
return await this.save(blockList);
|
|
306
|
+
}
|
|
307
|
+
async createBlockListWithBlockWithEditorAppearance(name, elementTypeId, label = '', overlaySize = 'small') {
|
|
308
|
+
await this.ensureNameNotExists(name);
|
|
309
|
+
const blockList = new json_models_builders_1.BlockListDataTypeBuilder()
|
|
310
|
+
.withName(name)
|
|
311
|
+
.addBlock()
|
|
312
|
+
.withContentElementTypeKey(elementTypeId)
|
|
313
|
+
.withLabel(label)
|
|
314
|
+
.withEditorSize(overlaySize)
|
|
315
|
+
.done()
|
|
316
|
+
.build();
|
|
317
|
+
return await this.save(blockList);
|
|
318
|
+
}
|
|
319
|
+
async createBlockListWithBlockWithCatalogueAppearance(name, elementTypeId, backgroundColor = '', iconColor = '', customStylesheet = '') {
|
|
320
|
+
await this.ensureNameNotExists(name);
|
|
321
|
+
const blockList = new json_models_builders_1.BlockListDataTypeBuilder()
|
|
322
|
+
.withName(name)
|
|
323
|
+
.addBlock()
|
|
324
|
+
.withContentElementTypeKey(elementTypeId)
|
|
325
|
+
.withBackgroundColor(backgroundColor)
|
|
326
|
+
.withIconColor(iconColor)
|
|
327
|
+
.withStylesheet(customStylesheet)
|
|
328
|
+
.done()
|
|
329
|
+
.build();
|
|
330
|
+
return await this.save(blockList);
|
|
331
|
+
}
|
|
332
|
+
async createBlockListWithBlockWithHideContentEditor(name, elementTypeId, hideContentEditor) {
|
|
333
|
+
await this.ensureNameNotExists(name);
|
|
334
|
+
const blockList = new json_models_builders_1.BlockListDataTypeBuilder()
|
|
335
|
+
.withName(name)
|
|
336
|
+
.addBlock()
|
|
337
|
+
.withContentElementTypeKey(elementTypeId)
|
|
338
|
+
.withHideContentEditor(hideContentEditor)
|
|
339
|
+
.done()
|
|
340
|
+
.build();
|
|
341
|
+
return await this.save(blockList);
|
|
342
|
+
}
|
|
343
|
+
async isSingleBlockModeEnabledForBlockList(blockListName, enabled) {
|
|
344
|
+
const blockList = await this.getByName(blockListName);
|
|
345
|
+
const singleBlockModeValue = blockList.values.find(value => value.alias === 'useSingleBlockMode');
|
|
346
|
+
return singleBlockModeValue?.value === enabled;
|
|
347
|
+
}
|
|
348
|
+
async isInlineEditingModeEnabledForBlockList(blockListName, enabled) {
|
|
349
|
+
const blockList = await this.getByName(blockListName);
|
|
350
|
+
const inlineEditingModeValue = blockList.values.find(value => value.alias === 'useInlineEditingAsDefault');
|
|
351
|
+
return inlineEditingModeValue?.value === enabled;
|
|
352
|
+
}
|
|
353
|
+
// Block Grid
|
|
354
|
+
async createEmptyBlockGrid(blockGridName) {
|
|
355
|
+
await this.ensureNameNotExists(blockGridName);
|
|
356
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
357
|
+
.withName(blockGridName)
|
|
358
|
+
.build();
|
|
359
|
+
return await this.save(blockGrid);
|
|
360
|
+
}
|
|
361
|
+
async createBlockGridWithABlock(blockGridName, contentElementTypeId) {
|
|
362
|
+
await this.ensureNameNotExists(blockGridName);
|
|
363
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
364
|
+
.withName(blockGridName)
|
|
365
|
+
.addBlock()
|
|
366
|
+
.withContentElementTypeKey(contentElementTypeId)
|
|
367
|
+
.done()
|
|
368
|
+
.build();
|
|
369
|
+
return await this.save(blockGrid);
|
|
370
|
+
}
|
|
371
|
+
async createBlockGridWithABlockInAGroup(blockGridName, contentElementTypeId, groupName) {
|
|
372
|
+
await this.ensureNameNotExists(blockGridName);
|
|
373
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
374
|
+
.withName(blockGridName)
|
|
375
|
+
.addBlockGroup()
|
|
376
|
+
.withName(groupName)
|
|
377
|
+
.done()
|
|
378
|
+
.addBlock()
|
|
379
|
+
.withContentElementTypeKey(contentElementTypeId)
|
|
380
|
+
.withGroupName(groupName)
|
|
381
|
+
.done()
|
|
382
|
+
.build();
|
|
383
|
+
return await this.save(blockGrid);
|
|
384
|
+
}
|
|
385
|
+
async createBlockGridWithMinAndMaxAmount(blockGridName, minAmount = 0, maxAmount = 0) {
|
|
386
|
+
await this.ensureNameNotExists(blockGridName);
|
|
387
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
388
|
+
.withName(blockGridName)
|
|
389
|
+
.withMinValue(minAmount)
|
|
390
|
+
.withMaxValue(maxAmount)
|
|
391
|
+
.build();
|
|
392
|
+
return await this.save(blockGrid);
|
|
393
|
+
}
|
|
394
|
+
async createBlockGridWithLiveEditingMode(blockGridName, enabled) {
|
|
395
|
+
await this.ensureNameNotExists(blockGridName);
|
|
396
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
397
|
+
.withName(blockGridName)
|
|
398
|
+
.withLiveEditing(enabled)
|
|
399
|
+
.build();
|
|
400
|
+
return await this.save(blockGrid);
|
|
401
|
+
}
|
|
402
|
+
async createBlockGridWithPropertyEditorWidth(blockGridName, width) {
|
|
403
|
+
await this.ensureNameNotExists(blockGridName);
|
|
404
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
405
|
+
.withName(blockGridName)
|
|
406
|
+
.withMaxPropertyWidth(width)
|
|
407
|
+
.build();
|
|
408
|
+
return await this.save(blockGrid);
|
|
409
|
+
}
|
|
410
|
+
async createBlockGridWithCreateButtonLabel(blockGridName, label = '') {
|
|
411
|
+
await this.ensureNameNotExists(blockGridName);
|
|
412
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
413
|
+
.withName(blockGridName)
|
|
414
|
+
.withCreateLabel(label)
|
|
415
|
+
.build();
|
|
416
|
+
return await this.save(blockGrid);
|
|
417
|
+
}
|
|
418
|
+
async createBlockGridWithGridColumns(blockGridName, columns = 12) {
|
|
419
|
+
await this.ensureNameNotExists(blockGridName);
|
|
420
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
421
|
+
.withName(blockGridName)
|
|
422
|
+
.withGridColumns(columns)
|
|
423
|
+
.build();
|
|
424
|
+
return await this.save(blockGrid);
|
|
425
|
+
}
|
|
426
|
+
async createBlockGridWithLayoutStylesheet(blockGridName, stylesheet = ['']) {
|
|
427
|
+
await this.ensureNameNotExists(blockGridName);
|
|
428
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
429
|
+
.withName(blockGridName)
|
|
430
|
+
.withLayoutStylesheet(stylesheet)
|
|
431
|
+
.build();
|
|
432
|
+
return await this.save(blockGrid);
|
|
433
|
+
}
|
|
434
|
+
async createBlockGridWithAnAreaInABlock(blockGridName, contentElementTypeId, areaAlias = 'area', createButtonLabel = '', columnSpan = 6, rowSpan = 1, minAllowed = 0, maxAllowed = 2) {
|
|
435
|
+
await this.ensureNameNotExists(blockGridName);
|
|
436
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
437
|
+
.withName(blockGridName)
|
|
438
|
+
.addBlock()
|
|
439
|
+
.withContentElementTypeKey(contentElementTypeId)
|
|
440
|
+
.addArea()
|
|
441
|
+
.withAlias(areaAlias)
|
|
442
|
+
.withCreateLabel(createButtonLabel)
|
|
443
|
+
.withColumnSpan(columnSpan)
|
|
444
|
+
.withRowSpan(rowSpan)
|
|
445
|
+
.withMinAllowed(minAllowed)
|
|
446
|
+
.withMaxAllowed(maxAllowed)
|
|
447
|
+
.done()
|
|
448
|
+
.done()
|
|
449
|
+
.build();
|
|
450
|
+
return await this.save(blockGrid);
|
|
451
|
+
}
|
|
452
|
+
async createBlockGridWithAdvancedSettingsInBlock(blockGridName, contentElementTypeId, customViewPath = '', customStylesheetPath = '', overlaySize = 'small', inlineEditing = false, hideContentEditor = false) {
|
|
453
|
+
await this.ensureNameNotExists(blockGridName);
|
|
454
|
+
const encodedViewPath = await this.api.stylesheet.encodeStylesheetPath(customViewPath);
|
|
455
|
+
const encodedStylesheetPath = await this.api.stylesheet.encodeStylesheetPath(customStylesheetPath);
|
|
456
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
457
|
+
.withName(blockGridName)
|
|
458
|
+
.addBlock()
|
|
459
|
+
.withContentElementTypeKey(contentElementTypeId)
|
|
460
|
+
.withView(encodedViewPath)
|
|
461
|
+
.withStylesheet(encodedStylesheetPath)
|
|
462
|
+
.withEditorSize(overlaySize)
|
|
463
|
+
.withInlineEditing(inlineEditing)
|
|
464
|
+
.withHideContentEditor(hideContentEditor)
|
|
465
|
+
.done()
|
|
466
|
+
.build();
|
|
467
|
+
return await this.save(blockGrid);
|
|
468
|
+
}
|
|
469
|
+
async createBlockGridWithCatalogueAppearanceInBlock(blockGridName, contentElementTypeId, backgroundColor = '', iconColor = '', thumbnail = '') {
|
|
470
|
+
await this.ensureNameNotExists(blockGridName);
|
|
471
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
472
|
+
.withName(blockGridName)
|
|
473
|
+
.addBlock()
|
|
474
|
+
.withContentElementTypeKey(contentElementTypeId)
|
|
475
|
+
.withBackgroundColor(backgroundColor)
|
|
476
|
+
.withIconColor(iconColor)
|
|
477
|
+
.withThumbnail(thumbnail)
|
|
478
|
+
.done()
|
|
479
|
+
.build();
|
|
480
|
+
return await this.save(blockGrid);
|
|
481
|
+
}
|
|
482
|
+
async createBlockGridWithContentAndSettingsElementType(blockGridName, contentElementTypeId, settingsElementTypeId) {
|
|
483
|
+
await this.ensureNameNotExists(blockGridName);
|
|
484
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
485
|
+
.withName(blockGridName)
|
|
486
|
+
.addBlock()
|
|
487
|
+
.withContentElementTypeKey(contentElementTypeId)
|
|
488
|
+
.withSettingsElementTypeKey(settingsElementTypeId)
|
|
489
|
+
.done()
|
|
490
|
+
.build();
|
|
491
|
+
return await this.save(blockGrid);
|
|
492
|
+
}
|
|
493
|
+
async createBlockGridWithLabel(blockGridName, contentElementTypeId, label) {
|
|
494
|
+
await this.ensureNameNotExists(blockGridName);
|
|
495
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
496
|
+
.withName(blockGridName)
|
|
497
|
+
.addBlock()
|
|
498
|
+
.withContentElementTypeKey(contentElementTypeId)
|
|
499
|
+
.withLabel(label)
|
|
500
|
+
.done()
|
|
501
|
+
.build();
|
|
502
|
+
return await this.save(blockGrid);
|
|
503
|
+
}
|
|
504
|
+
async createBlockGridWithPermissions(blockGridName, contentElementTypeId, toAllowInRoot = false, toAllowInAreas = false) {
|
|
505
|
+
await this.ensureNameNotExists(blockGridName);
|
|
506
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
507
|
+
.withName(blockGridName)
|
|
508
|
+
.addBlock()
|
|
509
|
+
.withContentElementTypeKey(contentElementTypeId)
|
|
510
|
+
.withAllowAtRoot(toAllowInRoot)
|
|
511
|
+
.withAllowInAreas(toAllowInAreas)
|
|
512
|
+
.done()
|
|
513
|
+
.build();
|
|
514
|
+
return await this.save(blockGrid);
|
|
515
|
+
}
|
|
516
|
+
async createBlockGridWithSizeOptions(blockGridName, contentElementTypeId, columnSpans = 0, minRowSpan = 0, maxRowSpan = 12) {
|
|
517
|
+
await this.ensureNameNotExists(blockGridName);
|
|
518
|
+
const blockGrid = new json_models_builders_1.BlockGridDataTypeBuilder()
|
|
519
|
+
.withName(blockGridName)
|
|
520
|
+
.addBlock()
|
|
521
|
+
.withContentElementTypeKey(contentElementTypeId)
|
|
522
|
+
.addColumnSpanOptions(columnSpans)
|
|
523
|
+
.withMinRowSpan(minRowSpan)
|
|
524
|
+
.withMaxRowSpan(maxRowSpan)
|
|
525
|
+
.done()
|
|
526
|
+
.build();
|
|
527
|
+
return await this.save(blockGrid);
|
|
528
|
+
}
|
|
529
|
+
async doesBlockEditorContainBlocksWithContentTypeIds(blockEditorName, elementTypeIds) {
|
|
530
|
+
if (!elementTypeIds || elementTypeIds.length === 0) {
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
const blockEditor = await this.getByName(blockEditorName);
|
|
534
|
+
const blocksValue = blockEditor.values.find(value => value.alias === 'blocks');
|
|
535
|
+
if (!blocksValue || blocksValue.value.length === 0) {
|
|
536
|
+
return false;
|
|
537
|
+
}
|
|
538
|
+
const contentElementTypeKeys = blocksValue.value.map(block => block.contentElementTypeKey);
|
|
539
|
+
return elementTypeIds.every(id => contentElementTypeKeys.includes(id));
|
|
540
|
+
}
|
|
541
|
+
async doesBlockEditorContainBlocksWithSettingsTypeIds(blockEditorName, elementTypeIds) {
|
|
542
|
+
if (!elementTypeIds || elementTypeIds.length === 0) {
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
const blockEditor = await this.getByName(blockEditorName);
|
|
546
|
+
const blocksValue = blockEditor.values.find(value => value.alias === 'blocks');
|
|
547
|
+
if (!blocksValue || blocksValue.value.length === 0) {
|
|
548
|
+
return false;
|
|
549
|
+
}
|
|
550
|
+
const settingsElementTypeKeys = blocksValue.value.map(block => block.settingsElementTypeKey);
|
|
551
|
+
return elementTypeIds.every(id => settingsElementTypeKeys.includes(id));
|
|
552
|
+
}
|
|
553
|
+
async isLiveEditingModeEnabledForBlockEditor(blockEditorName, enabled) {
|
|
554
|
+
const blockEditor = await this.getByName(blockEditorName);
|
|
555
|
+
const liveEditingModeValue = blockEditor.values.find(value => value.alias === 'useLiveEditing');
|
|
556
|
+
return liveEditingModeValue?.value === enabled;
|
|
557
|
+
}
|
|
558
|
+
async doesMaxPropertyContainWidthForBlockEditor(blockEditorName, width) {
|
|
559
|
+
const blockEditor = await this.getByName(blockEditorName);
|
|
560
|
+
const maxPropertyWidthValue = blockEditor.values.find(value => value.alias === 'maxPropertyWidth');
|
|
561
|
+
return maxPropertyWidthValue?.value === width;
|
|
562
|
+
}
|
|
563
|
+
async doesBlockEditorBlockContainLabel(blockName, elementTypeKey, label) {
|
|
564
|
+
const block = await this.getBlockWithContentElementTypeId(blockName, elementTypeKey);
|
|
565
|
+
return block.label === label;
|
|
566
|
+
}
|
|
567
|
+
async doesBlockGridGroupContainCorrectBlocks(blockGridName, groupName, elementTypeIds) {
|
|
568
|
+
if (!elementTypeIds || elementTypeIds.length === 0) {
|
|
569
|
+
return false;
|
|
570
|
+
}
|
|
571
|
+
const blockEditor = await this.getByName(blockGridName);
|
|
572
|
+
// We need to get the GroupKey, so we can use it to find the blocks that use the Key.
|
|
573
|
+
const blockGroupsValue = blockEditor.values.find(value => value.alias === 'blockGroups');
|
|
574
|
+
if (!blockGroupsValue || blockGroupsValue.value.length === 0) {
|
|
575
|
+
return false;
|
|
576
|
+
}
|
|
577
|
+
const blockGroupKey = blockGroupsValue.value.find(blockGroup => blockGroup.name === groupName).key;
|
|
578
|
+
const blocksValue = blockEditor.values.find(value => value.alias === 'blocks');
|
|
579
|
+
if (!blocksValue || blocksValue.value.length === 0) {
|
|
580
|
+
return false;
|
|
581
|
+
}
|
|
582
|
+
const blocksWithGroupKey = blocksValue.value.filter(block => block.groupKey === blockGroupKey);
|
|
583
|
+
return elementTypeIds.every(id => blocksWithGroupKey.some(block => block.contentElementTypeKey === id));
|
|
584
|
+
}
|
|
585
|
+
async doesBlockGridContainCreateButtonLabel(blockGridName, label) {
|
|
586
|
+
const blockEditor = await this.getByName(blockGridName);
|
|
587
|
+
const createLabelValue = blockEditor.values.find(value => value.alias === 'createLabel');
|
|
588
|
+
return createLabelValue?.value === label;
|
|
589
|
+
}
|
|
590
|
+
async doesBlockGridContainGridColumns(blockGridName, columns) {
|
|
591
|
+
const blockEditor = await this.getByName(blockGridName);
|
|
592
|
+
const gridColumnsValue = blockEditor.values.find(value => value.alias === 'gridColumns');
|
|
593
|
+
return gridColumnsValue?.value === columns;
|
|
594
|
+
}
|
|
595
|
+
async doesBlockEditorBlockHaveAllowInRootEnabled(blockGridName, elementTypeKey) {
|
|
596
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
597
|
+
return block.allowAtRoot;
|
|
598
|
+
}
|
|
599
|
+
async doesBlockEditorBlockHaveAllowInAreasEnabled(blockGridName, elementTypeKey) {
|
|
600
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
601
|
+
return block.allowInAreas;
|
|
602
|
+
}
|
|
603
|
+
async doesBlockEditorBlockContainColumnSpanOptions(blockGridName, elementTypeKey, expectedColumnSpans) {
|
|
604
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
605
|
+
// If the block does not have any columnSpanOptions, and we are not expecting any, return true
|
|
606
|
+
if (block.columnSpanOptions.length === 0 && expectedColumnSpans.length === 0) {
|
|
607
|
+
return true;
|
|
608
|
+
}
|
|
609
|
+
const columnSpans = block.columnSpanOptions.map(option => option.columnSpan);
|
|
610
|
+
return expectedColumnSpans.every(span => columnSpans.includes(span)) && columnSpans.every(span => expectedColumnSpans.includes(span));
|
|
611
|
+
}
|
|
612
|
+
async doesBlockEditorBlockContainRowSpanOptions(blockGridName, elementTypeKey, minRowSpan, maxRowSpan) {
|
|
613
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
614
|
+
return block.rowMinSpan === minRowSpan && block.rowMaxSpan === maxRowSpan;
|
|
615
|
+
}
|
|
616
|
+
async doesBlockEditorBlockContainAreaGridColumns(blockGridName, elementTypeKey, areaGridColumns) {
|
|
617
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
618
|
+
return block.areaGridColumns === areaGridColumns;
|
|
619
|
+
}
|
|
620
|
+
async doesBlockEditorBlockContainAreaWithAlias(blockGridName, elementTypeKey, areaAlias = 'area') {
|
|
621
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
622
|
+
return block.areas.find(area => area.alias === areaAlias);
|
|
623
|
+
}
|
|
624
|
+
async doesBlockEditorBlockContainAreaCount(blockGridName, elementTypeKey, areaCount) {
|
|
625
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
626
|
+
return block.areas.length === areaCount;
|
|
627
|
+
}
|
|
628
|
+
async doesBlockEditorBlockContainAreaWithCreateButtonLabel(blockGridName, elementTypeKey, areaAlias = 'area', createButtonLabel) {
|
|
629
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
630
|
+
return block.areas.find(area => area.createLabel === createButtonLabel && area.alias === areaAlias);
|
|
631
|
+
}
|
|
632
|
+
async doesBlockEditorBlockContainAreaWithMinAllowed(blockGridName, elementTypeKey, areaAlias = 'area', minAllowed) {
|
|
633
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
634
|
+
return block.areas.find(area => area.minAllowed === minAllowed && area.alias === areaAlias);
|
|
635
|
+
}
|
|
636
|
+
async doesBlockEditorBlockContainAreaWithMaxAllowed(blockGridName, elementTypeKey, areaAlias = 'area', maxAllowed) {
|
|
637
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
638
|
+
return block.areas.find(area => area.maxAllowed === maxAllowed && area.alias === areaAlias);
|
|
639
|
+
}
|
|
640
|
+
async doesBlockEditorBlockContainStylesheet(blockGridName, elementTypeKey, stylesheetPath) {
|
|
641
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
642
|
+
const encodedSecondStylesheetPath = await this.api.stylesheet.encodeStylesheetPath(stylesheetPath);
|
|
643
|
+
return block.stylesheet[0] === encodedSecondStylesheetPath;
|
|
644
|
+
}
|
|
645
|
+
async doesBlockEditorBlockContainOverlaySize(blockGridName, elementTypeKey, overlaySize) {
|
|
646
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
647
|
+
return block.editorSize === overlaySize;
|
|
648
|
+
}
|
|
649
|
+
async doesBlockEditorBlockContainInlineEditing(blockGridName, elementTypeKey, inlineEditing) {
|
|
650
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
651
|
+
return block.inlineEditing === inlineEditing;
|
|
652
|
+
}
|
|
653
|
+
async doesBlockEditorBlockContainHideContentEditor(blockGridName, elementTypeKey, hideContentEditor) {
|
|
654
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
655
|
+
return block.hideContentEditor === hideContentEditor;
|
|
656
|
+
}
|
|
657
|
+
async doesBlockEditorBlockContainBackgroundColor(blockGridName, elementTypeKey, backgroundColor) {
|
|
658
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
659
|
+
return block.backgroundColor === backgroundColor;
|
|
660
|
+
}
|
|
661
|
+
async doesBlockEditorBlockContainIconColor(blockGridName, elementTypeKey, iconColor) {
|
|
662
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
663
|
+
return block.iconColor === iconColor;
|
|
664
|
+
}
|
|
665
|
+
async doesBlockEditorBlockContainThumbnail(blockGridName, elementTypeKey, thumbnail) {
|
|
666
|
+
const block = await this.getBlockWithContentElementTypeId(blockGridName, elementTypeKey);
|
|
667
|
+
return block.thumbnail === thumbnail;
|
|
668
|
+
}
|
|
669
|
+
async getBlockWithContentElementTypeId(blockGridName, contentElementTypeKey) {
|
|
670
|
+
const blockEditor = await this.getByName(blockGridName);
|
|
671
|
+
const blocks = blockEditor.values.find(value => value.alias === 'blocks');
|
|
672
|
+
return blocks.value.find(block => block.contentElementTypeKey === contentElementTypeKey);
|
|
673
|
+
}
|
|
674
|
+
async createImageCropperDataTypeWithOneCrop(name, cropLabel, cropWidth, cropHeight) {
|
|
675
|
+
await this.ensureNameNotExists(name);
|
|
676
|
+
const dataType = new json_models_builders_1.ImageCropperDataTypeBuilder()
|
|
677
|
+
.withName(name)
|
|
678
|
+
.addCrop()
|
|
679
|
+
.withLabel(cropLabel)
|
|
680
|
+
.withAlias(json_models_builders_1.AliasHelper.toAlias(cropLabel))
|
|
681
|
+
.withHeight(cropHeight)
|
|
682
|
+
.withWidth(cropWidth)
|
|
683
|
+
.done()
|
|
684
|
+
.build();
|
|
685
|
+
return await this.save(dataType);
|
|
686
|
+
}
|
|
687
|
+
async createMediaPickerDataTypeWithStartNodeId(name, startNodeId) {
|
|
688
|
+
await this.ensureNameNotExists(name);
|
|
689
|
+
const dataType = new json_models_builders_1.MediaPickerDataTypeBuilder()
|
|
690
|
+
.withName(name)
|
|
691
|
+
.withStartNodeId(startNodeId)
|
|
692
|
+
.withIgnoreUserStartNodes(false)
|
|
693
|
+
.build();
|
|
694
|
+
return await this.save(dataType);
|
|
695
|
+
}
|
|
696
|
+
async createRadioboxDataType(name, options) {
|
|
697
|
+
await this.ensureNameNotExists(name);
|
|
698
|
+
const dataType = new json_models_builders_1.RadioboxDataTypeBuilder()
|
|
699
|
+
.withName(name)
|
|
700
|
+
.withItems(options)
|
|
701
|
+
.build();
|
|
702
|
+
return await this.save(dataType);
|
|
703
|
+
}
|
|
704
|
+
async createImageMediaPickerDataType(name, minValue = 0, maxValue = 1, enableLocalFocalPoint = false, ignoreUserStartNodes = false) {
|
|
705
|
+
await this.ensureNameNotExists(name);
|
|
706
|
+
const mediaType = await this.api.mediaType.getByName('Image');
|
|
707
|
+
const dataType = new json_models_builders_1.MediaPickerDataTypeBuilder()
|
|
708
|
+
.withName(name)
|
|
709
|
+
.withFilter(mediaType.id)
|
|
710
|
+
.withMultiple(false)
|
|
711
|
+
.withMinValue(minValue)
|
|
712
|
+
.withMaxValue(maxValue)
|
|
713
|
+
.withEnableLocalFocalPoint(enableLocalFocalPoint)
|
|
714
|
+
.withIgnoreUserStartNodes(ignoreUserStartNodes)
|
|
715
|
+
.build();
|
|
716
|
+
return await this.save(dataType);
|
|
717
|
+
}
|
|
718
|
+
async createImageMediaPickerDataTypeWithStartNodeId(name, startNodeId) {
|
|
719
|
+
await this.ensureNameNotExists(name);
|
|
720
|
+
const mediaType = await this.api.mediaType.getByName('Image');
|
|
721
|
+
const dataType = new json_models_builders_1.MediaPickerDataTypeBuilder()
|
|
722
|
+
.withName(name)
|
|
723
|
+
.withFilter(mediaType.id)
|
|
724
|
+
.withStartNodeId(startNodeId)
|
|
725
|
+
.build();
|
|
726
|
+
return await this.save(dataType);
|
|
727
|
+
}
|
|
728
|
+
async createImageMediaPickerDataTypeWithCrop(name, label, width, height) {
|
|
729
|
+
await this.ensureNameNotExists(name);
|
|
730
|
+
const mediaType = await this.api.mediaType.getByName('Image');
|
|
731
|
+
const dataType = new json_models_builders_1.MediaPickerDataTypeBuilder()
|
|
732
|
+
.withName(name)
|
|
733
|
+
.withFilter(mediaType.id)
|
|
734
|
+
.addCrop()
|
|
735
|
+
.withLabel(label)
|
|
736
|
+
.withAlias(json_models_builders_1.AliasHelper.toAlias(label))
|
|
737
|
+
.withHeight(height)
|
|
738
|
+
.withWidth(width)
|
|
739
|
+
.done()
|
|
740
|
+
.build();
|
|
741
|
+
return await this.save(dataType);
|
|
742
|
+
}
|
|
743
|
+
async createTextareaDataType(name, maxChars = 0, rows = 0, minHeight = 0, maxHeight = 0) {
|
|
744
|
+
await this.ensureNameNotExists(name);
|
|
745
|
+
const dataType = new json_models_builders_1.TextAreaDataTypeBuilder()
|
|
746
|
+
.withName(name)
|
|
747
|
+
.withMaxChars(maxChars)
|
|
748
|
+
.withRows(rows)
|
|
749
|
+
.withMinHeight(minHeight)
|
|
750
|
+
.withMaxHeight(maxHeight)
|
|
751
|
+
.build();
|
|
752
|
+
return await this.save(dataType);
|
|
753
|
+
}
|
|
754
|
+
async createTextstringDataType(name, maxChars = 0) {
|
|
755
|
+
await this.ensureNameNotExists(name);
|
|
756
|
+
const dataType = new json_models_builders_1.TextStringDataTypeBuilder()
|
|
757
|
+
.withName(name)
|
|
758
|
+
.withMaxChars(maxChars)
|
|
759
|
+
.build();
|
|
760
|
+
return await this.save(dataType);
|
|
761
|
+
}
|
|
762
|
+
async createTrueFalseDataTypeWithInitialState(name) {
|
|
763
|
+
await this.ensureNameNotExists(name);
|
|
764
|
+
const dataType = new json_models_builders_1.TrueFalseDataTypeBuilder()
|
|
765
|
+
.withName(name)
|
|
766
|
+
.withIsDefault(true)
|
|
767
|
+
.build();
|
|
768
|
+
return await this.save(dataType);
|
|
769
|
+
}
|
|
770
|
+
async createTrueFalseDataTypeWithLabelOn(name, labelOn) {
|
|
771
|
+
await this.ensureNameNotExists(name);
|
|
772
|
+
const dataType = new json_models_builders_1.TrueFalseDataTypeBuilder()
|
|
773
|
+
.withName(name)
|
|
774
|
+
.withShowLabels(true)
|
|
775
|
+
.withLabelOn(labelOn)
|
|
776
|
+
.build();
|
|
777
|
+
return await this.save(dataType);
|
|
778
|
+
}
|
|
779
|
+
async createTrueFalseDataTypeWithLabelOff(name, labelOff) {
|
|
780
|
+
await this.ensureNameNotExists(name);
|
|
781
|
+
const dataType = new json_models_builders_1.TrueFalseDataTypeBuilder()
|
|
782
|
+
.withName(name)
|
|
783
|
+
.withShowLabels(true)
|
|
784
|
+
.withLabelOff(labelOff)
|
|
785
|
+
.build();
|
|
786
|
+
return await this.save(dataType);
|
|
787
|
+
}
|
|
788
|
+
async createEmailAddressDataType(name) {
|
|
789
|
+
await this.ensureNameNotExists(name);
|
|
790
|
+
const dataType = new json_models_builders_1.EmailAddressDataTypeBuilder()
|
|
791
|
+
.withName(name)
|
|
792
|
+
.build();
|
|
793
|
+
return await this.save(dataType);
|
|
794
|
+
}
|
|
795
|
+
async createCodeEditorDataType(name) {
|
|
796
|
+
await this.ensureNameNotExists(name);
|
|
797
|
+
const dataType = new json_models_builders_1.CodeEditorDataTypeBuilder()
|
|
798
|
+
.withName(name)
|
|
799
|
+
.build();
|
|
800
|
+
return await this.save(dataType);
|
|
801
|
+
}
|
|
802
|
+
async createMarkdownEditorDataType(name) {
|
|
803
|
+
await this.ensureNameNotExists(name);
|
|
804
|
+
const dataType = new json_models_builders_1.MarkdownEditorDataTypeBuilder()
|
|
805
|
+
.withName(name)
|
|
806
|
+
.build();
|
|
807
|
+
return await this.save(dataType);
|
|
808
|
+
}
|
|
809
|
+
async createDecimalDataType(name) {
|
|
810
|
+
await this.ensureNameNotExists(name);
|
|
811
|
+
const dataType = new json_models_builders_1.DecimalDataTypeBuilder()
|
|
812
|
+
.withName(name)
|
|
813
|
+
.build();
|
|
814
|
+
return await this.save(dataType);
|
|
815
|
+
}
|
|
816
|
+
async createMultipleTextStringDataType(name) {
|
|
817
|
+
await this.ensureNameNotExists(name);
|
|
818
|
+
const dataType = new json_models_builders_1.MultipleTextStringDataTypeBuilder()
|
|
819
|
+
.withName(name)
|
|
820
|
+
.build();
|
|
821
|
+
return await this.save(dataType);
|
|
822
|
+
}
|
|
823
|
+
async createSliderDataTyper(name) {
|
|
824
|
+
await this.ensureNameNotExists(name);
|
|
825
|
+
const dataType = new json_models_builders_1.SliderDataTypeBuilder()
|
|
826
|
+
.withName(name)
|
|
827
|
+
.build();
|
|
828
|
+
return await this.save(dataType);
|
|
829
|
+
}
|
|
830
|
+
// List View - Content data type
|
|
831
|
+
async createListViewContentDataType(name = 'List View - Content Test') {
|
|
832
|
+
await this.ensureNameNotExists(name);
|
|
833
|
+
const dataType = new json_models_builders_1.ListViewDataTypeBuilder()
|
|
834
|
+
.withName(name)
|
|
835
|
+
.withPageSize(100)
|
|
836
|
+
.addLayout()
|
|
837
|
+
.withName('List')
|
|
838
|
+
.withIcon('icon-list')
|
|
839
|
+
.withCollectionView('Umb.CollectionView.Document.Table')
|
|
840
|
+
.done()
|
|
841
|
+
.addLayout()
|
|
842
|
+
.withName('Grid')
|
|
843
|
+
.withIcon('icon-grid')
|
|
844
|
+
.withCollectionView('Umb.CollectionView.Document.Grid')
|
|
845
|
+
.done()
|
|
846
|
+
.addColumnDisplayedProperty()
|
|
847
|
+
.withAlias('updateDate')
|
|
848
|
+
.withHeader('Last edited')
|
|
849
|
+
.done()
|
|
850
|
+
.addColumnDisplayedProperty()
|
|
851
|
+
.withAlias('creator')
|
|
852
|
+
.withHeader('Updated by')
|
|
853
|
+
.done()
|
|
854
|
+
.build();
|
|
855
|
+
return await this.save(dataType);
|
|
856
|
+
}
|
|
857
|
+
async createListViewContentDataTypeWithAllPermissions(name = 'List View - Content Test') {
|
|
858
|
+
await this.ensureNameNotExists(name);
|
|
859
|
+
const dataType = new json_models_builders_1.ListViewDataTypeBuilder()
|
|
860
|
+
.withName(name)
|
|
861
|
+
.withPageSize(100)
|
|
862
|
+
.addLayout()
|
|
863
|
+
.withName('List')
|
|
864
|
+
.withIcon('icon-list')
|
|
865
|
+
.withCollectionView('Umb.CollectionView.Document.Table')
|
|
866
|
+
.done()
|
|
867
|
+
.addLayout()
|
|
868
|
+
.withName('Grid')
|
|
869
|
+
.withIcon('icon-grid')
|
|
870
|
+
.withCollectionView('Umb.CollectionView.Document.Grid')
|
|
871
|
+
.done()
|
|
872
|
+
.addColumnDisplayedProperty()
|
|
873
|
+
.withAlias('updateDate')
|
|
874
|
+
.withHeader('Last edited')
|
|
875
|
+
.done()
|
|
876
|
+
.addColumnDisplayedProperty()
|
|
877
|
+
.withAlias('creator')
|
|
878
|
+
.withHeader('Updated by')
|
|
879
|
+
.done()
|
|
880
|
+
.addBulkActionPermissions()
|
|
881
|
+
.withAllowBulkCopy(true)
|
|
882
|
+
.withAllowBulkDelete(true)
|
|
883
|
+
.withAllowBulkMove(true)
|
|
884
|
+
.withAllowBulkPublish(true)
|
|
885
|
+
.withAllowBulkUnPublish(true)
|
|
886
|
+
.done()
|
|
887
|
+
.build();
|
|
888
|
+
return await this.save(dataType);
|
|
889
|
+
}
|
|
890
|
+
// List View - Media data type
|
|
891
|
+
async updateListViewMediaDataType(alias, newValue) {
|
|
892
|
+
const listViewMediaData = await this.getByName('List View - Media');
|
|
893
|
+
const valueData = listViewMediaData.values.find(value => value.alias === alias);
|
|
894
|
+
if (valueData) {
|
|
895
|
+
valueData.value = newValue;
|
|
896
|
+
}
|
|
897
|
+
else {
|
|
898
|
+
listViewMediaData.values.push({
|
|
899
|
+
"alias": alias,
|
|
900
|
+
"value": newValue
|
|
901
|
+
});
|
|
203
902
|
}
|
|
204
|
-
await this.
|
|
903
|
+
return await this.update(listViewMediaData.id, listViewMediaData);
|
|
205
904
|
}
|
|
206
905
|
}
|
|
207
906
|
exports.DataTypeApiHelper = DataTypeApiHelper;
|