@esri/hub-common 13.37.2 → 13.37.3
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/esm/core/EntityEditor.js +4 -0
- package/dist/esm/core/EntityEditor.js.map +1 -1
- package/dist/esm/core/schemas/getEntityEditorSchemas.js +7 -0
- package/dist/esm/core/schemas/getEntityEditorSchemas.js.map +1 -1
- package/dist/esm/core/schemas/internal/getEditorConfigOptions.js +6 -0
- package/dist/esm/core/schemas/internal/getEditorConfigOptions.js.map +1 -1
- package/dist/esm/core/schemas/internal/getEntityEditorSchemas.js +7 -0
- package/dist/esm/core/schemas/internal/getEntityEditorSchemas.js.map +1 -1
- package/dist/esm/core/schemas/types.js +2 -0
- package/dist/esm/core/schemas/types.js.map +1 -1
- package/dist/esm/groups/HubGroup.js +78 -0
- package/dist/esm/groups/HubGroup.js.map +1 -1
- package/dist/esm/groups/HubGroups.js +2 -36
- package/dist/esm/groups/HubGroups.js.map +1 -1
- package/dist/esm/groups/_internal/GroupSchema.js +17 -0
- package/dist/esm/groups/_internal/GroupSchema.js.map +1 -0
- package/dist/esm/groups/_internal/GroupUiSchemaEdit.js +58 -0
- package/dist/esm/groups/_internal/GroupUiSchemaEdit.js.map +1 -0
- package/dist/esm/groups/_internal/convertGroupToHubGroup.js +14 -0
- package/dist/esm/groups/_internal/convertGroupToHubGroup.js.map +1 -0
- package/dist/esm/groups/_internal/convertHubGroupToGroup.js +26 -0
- package/dist/esm/groups/_internal/convertHubGroupToGroup.js.map +1 -0
- package/dist/esm/groups/deleteGroupThumbnail.js +14 -0
- package/dist/esm/groups/deleteGroupThumbnail.js.map +1 -0
- package/dist/esm/groups/setGroupThumbnail.js +32 -0
- package/dist/esm/groups/setGroupThumbnail.js.map +1 -0
- package/dist/node/core/EntityEditor.js +4 -0
- package/dist/node/core/EntityEditor.js.map +1 -1
- package/dist/node/core/schemas/getEntityEditorSchemas.js +7 -0
- package/dist/node/core/schemas/getEntityEditorSchemas.js.map +1 -1
- package/dist/node/core/schemas/internal/getEditorConfigOptions.js +6 -0
- package/dist/node/core/schemas/internal/getEditorConfigOptions.js.map +1 -1
- package/dist/node/core/schemas/internal/getEntityEditorSchemas.js +7 -0
- package/dist/node/core/schemas/internal/getEntityEditorSchemas.js.map +1 -1
- package/dist/node/core/schemas/types.js +2 -0
- package/dist/node/core/schemas/types.js.map +1 -1
- package/dist/node/groups/HubGroup.js +78 -0
- package/dist/node/groups/HubGroup.js.map +1 -1
- package/dist/node/groups/HubGroups.js +6 -40
- package/dist/node/groups/HubGroups.js.map +1 -1
- package/dist/node/groups/_internal/GroupSchema.js +20 -0
- package/dist/node/groups/_internal/GroupSchema.js.map +1 -0
- package/dist/node/groups/_internal/GroupUiSchemaEdit.js +61 -0
- package/dist/node/groups/_internal/GroupUiSchemaEdit.js.map +1 -0
- package/dist/node/groups/_internal/convertGroupToHubGroup.js +18 -0
- package/dist/node/groups/_internal/convertGroupToHubGroup.js.map +1 -0
- package/dist/node/groups/_internal/convertHubGroupToGroup.js +30 -0
- package/dist/node/groups/_internal/convertHubGroupToGroup.js.map +1 -0
- package/dist/node/groups/deleteGroupThumbnail.js +18 -0
- package/dist/node/groups/deleteGroupThumbnail.js.map +1 -0
- package/dist/node/groups/setGroupThumbnail.js +36 -0
- package/dist/node/groups/setGroupThumbnail.js.map +1 -0
- package/dist/types/core/schemas/types.d.ts +1 -1
- package/dist/types/core/types/IHubGroup.d.ts +16 -2
- package/dist/types/groups/HubGroup.d.ts +20 -2
- package/dist/types/groups/_internal/GroupSchema.d.ts +7 -0
- package/dist/types/groups/_internal/GroupUiSchemaEdit.d.ts +7 -0
- package/dist/types/groups/_internal/convertGroupToHubGroup.d.ts +9 -0
- package/dist/types/groups/_internal/convertHubGroupToGroup.d.ts +7 -0
- package/dist/types/groups/deleteGroupThumbnail.d.ts +9 -0
- package/dist/types/groups/setGroupThumbnail.d.ts +9 -0
- package/package.json +1 -1
|
@@ -72,6 +72,13 @@ async function getEntityEditorSchemas(i18nScope, type, options = []) {
|
|
|
72
72
|
"hub:content:edit": () => Promise.resolve().then(() => require("../../../content/_internal/ContentUiSchemaEdit")),
|
|
73
73
|
}[type]());
|
|
74
74
|
break;
|
|
75
|
+
case "group":
|
|
76
|
+
const { GroupSchema } = await Promise.resolve().then(() => require("../../../groups/_internal/GroupSchema"));
|
|
77
|
+
schema = util_1.cloneObject(GroupSchema);
|
|
78
|
+
({ uiSchema } = await {
|
|
79
|
+
"hub:group:edit": () => Promise.resolve().then(() => require("../../../groups/_internal/GroupUiSchemaEdit")),
|
|
80
|
+
}[type]());
|
|
81
|
+
break;
|
|
75
82
|
}
|
|
76
83
|
// filter out properties not used in the UI schema
|
|
77
84
|
schema = filterSchemaToUiSchema_1.filterSchemaToUiSchema(schema, uiSchema);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEntityEditorSchemas.js","sourceRoot":"","sources":["../../../../../src/core/schemas/internal/getEntityEditorSchemas.ts"],"names":[],"mappings":";;;AAAA,wCAA4C;AAG5C,+EAA4E;AAC5E,qEAAkE;AAOlE,4DAAyD;
|
|
1
|
+
{"version":3,"file":"getEntityEditorSchemas.js","sourceRoot":"","sources":["../../../../../src/core/schemas/internal/getEntityEditorSchemas.ts"],"names":[],"mappings":";;;AAAA,wCAA4C;AAG5C,+EAA4E;AAC5E,qEAAkE;AAOlE,4DAAyD;AAGzD;;;;;;;;;GASG;AACI,KAAK,UAAU,sBAAsB,CAC1C,SAAiB,EACjB,IAAgB,EAChB,UAAoC,EAAE;IAEtC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtC,wDAAwD;IACxD,+CAA+C;IAC/C,IAAI,MAAM,CAAC;IACX,IAAI,QAAQ,CAAC;IACb,QAAQ,UAAU,EAAE;QAClB,KAAK,MAAM;YACT,MAAM,EAAE,UAAU,EAAE,GAAG,2CACrB,qCAAqC,EACtC,CAAC;YAC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AAC;QACpC,CAAC;KACF,CACF,CAAC;IAEF,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;AAC/C,CAAC;AAvHD,wDAuHC"}
|
|
@@ -7,6 +7,7 @@ const SiteSchema_1 = require("../../sites/_internal/SiteSchema");
|
|
|
7
7
|
const DiscussionSchema_1 = require("../../discussions/_internal/DiscussionSchema");
|
|
8
8
|
const PageSchema_1 = require("../../pages/_internal/PageSchema");
|
|
9
9
|
const ContentSchema_1 = require("../../content/_internal/ContentSchema");
|
|
10
|
+
const GroupSchema_1 = require("../../groups/_internal/GroupSchema");
|
|
10
11
|
exports.validEditorTypes = [
|
|
11
12
|
...ProjectSchema_1.ProjectEditorTypes,
|
|
12
13
|
...ContentSchema_1.ContentEditorTypes,
|
|
@@ -14,6 +15,7 @@ exports.validEditorTypes = [
|
|
|
14
15
|
...SiteSchema_1.SiteEditorTypes,
|
|
15
16
|
...DiscussionSchema_1.DiscussionEditorTypes,
|
|
16
17
|
...PageSchema_1.PageEditorTypes,
|
|
18
|
+
...GroupSchema_1.GroupEditorTypes,
|
|
17
19
|
];
|
|
18
20
|
var UiSchemaRuleEffects;
|
|
19
21
|
(function (UiSchemaRuleEffects) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/schemas/types.ts"],"names":[],"mappings":";;;AAGA,0EAA4E;AAC5E,mFAAqF;AACrF,iEAAmE;AACnE,mFAAqF;AACrF,iEAAmE;AACnE,yEAA2E;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/schemas/types.ts"],"names":[],"mappings":";;;AAGA,0EAA4E;AAC5E,mFAAqF;AACrF,iEAAmE;AACnE,mFAAqF;AACrF,iEAAmE;AACnE,yEAA2E;AAC3E,oEAAsE;AAOzD,QAAA,gBAAgB,GAAG;IAC9B,GAAG,kCAAkB;IACrB,GAAG,kCAAkB;IACrB,GAAG,wCAAqB;IACxB,GAAG,4BAAe;IAClB,GAAG,wCAAqB;IACxB,GAAG,4BAAe;IAClB,GAAG,8BAAgB;CACX,CAAC;AAEX,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,oCAAa,CAAA;IACb,0CAAmB,CAAA;IACnB,gCAAS,CAAA;AACX,CAAC,EALW,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAK9B;AAED,IAAY,oBAOX;AAPD,WAAY,oBAAoB;IAC9B,uDAA+B,CAAA;IAC/B,2CAAmB,CAAA;IACnB,qCAAa,CAAA;IACb,2CAAmB,CAAA;IACnB,yCAAiB,CAAA;IACjB,qCAAa,CAAA;AACf,CAAC,EAPW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAO/B;AAED,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC9B,+CAAuB,CAAA;IACvB,uCAAe,CAAA;IACf,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;IACrB,qCAAa,CAAA;AACf,CAAC,EANW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAM/B;AAED,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,uCAAe,CAAA;IACf,2CAAmB,CAAA;IACnB,yCAAiB,CAAA;AACnB,CAAC,EAJW,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAI/B"}
|
|
@@ -2,15 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HubGroup = void 0;
|
|
4
4
|
const HubGroups_1 = require("./HubGroups");
|
|
5
|
+
const convertHubGroupToGroup_1 = require("./_internal/convertHubGroupToGroup");
|
|
5
6
|
const defaults_1 = require("./defaults");
|
|
6
7
|
const permissions_1 = require("../permissions");
|
|
7
8
|
const util_1 = require("../util");
|
|
9
|
+
const getEditorConfig_1 = require("../core/schemas/getEditorConfig");
|
|
10
|
+
const setGroupThumbnail_1 = require("./setGroupThumbnail");
|
|
11
|
+
const utils_1 = require("../search/utils");
|
|
12
|
+
const deleteGroupThumbnail_1 = require("./deleteGroupThumbnail");
|
|
8
13
|
/**
|
|
9
14
|
* Hub Group Class
|
|
10
15
|
*/
|
|
11
16
|
class HubGroup {
|
|
12
17
|
constructor(group, context) {
|
|
13
18
|
this.isDestroyed = false;
|
|
19
|
+
this.thumbnailCache = null;
|
|
14
20
|
this.entity = group;
|
|
15
21
|
this.context = context;
|
|
16
22
|
}
|
|
@@ -177,6 +183,78 @@ class HubGroup {
|
|
|
177
183
|
removePermissionPolicy(permission, id) {
|
|
178
184
|
this.entity.permissions = permissions_1.removePermissionPolicy(this.entity.permissions, permission, id);
|
|
179
185
|
}
|
|
186
|
+
/*
|
|
187
|
+
* Get the editor config for the HubGroup entity.
|
|
188
|
+
* @param i18nScope translation scope to be interpolated into the uiSchema
|
|
189
|
+
* @param type editor type - corresonds to the returned uiSchema
|
|
190
|
+
* @param options optional hash of dynamic uiSchema element options
|
|
191
|
+
*/
|
|
192
|
+
async getEditorConfig(i18nScope, type) {
|
|
193
|
+
// delegate to the schema subsystem
|
|
194
|
+
return getEditorConfig_1.getEditorConfig(i18nScope, type, this.entity, this.context);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Return the group as an editor object
|
|
198
|
+
*/
|
|
199
|
+
toEditor() {
|
|
200
|
+
// cast the entity to it's editor
|
|
201
|
+
const editor = util_1.cloneObject(this.entity);
|
|
202
|
+
return editor;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Load the group from the editor object
|
|
206
|
+
* @param editor
|
|
207
|
+
* @returns
|
|
208
|
+
*/
|
|
209
|
+
async fromEditor(editor) {
|
|
210
|
+
const isCreate = !editor.id;
|
|
211
|
+
// Setting the thumbnailCache will ensure that
|
|
212
|
+
// the thumbnail is updated on next save
|
|
213
|
+
if (editor._thumbnail) {
|
|
214
|
+
if (editor._thumbnail.blob) {
|
|
215
|
+
this.thumbnailCache = {
|
|
216
|
+
file: editor._thumbnail.blob,
|
|
217
|
+
filename: editor._thumbnail.fileName,
|
|
218
|
+
clear: false,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
this.thumbnailCache = {
|
|
223
|
+
clear: true,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
delete editor._thumbnail;
|
|
228
|
+
if (this.thumbnailCache) {
|
|
229
|
+
if (this.thumbnailCache.clear) {
|
|
230
|
+
await deleteGroupThumbnail_1.deleteGroupThumbnail(this.entity.id, this.context.userRequestOptions);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
await setGroupThumbnail_1.setGroupThumbnail(this.entity.id, this.thumbnailCache.file, this.thumbnailCache.filename, this.context.userRequestOptions, this.entity.owner);
|
|
234
|
+
// Note: updating the thumbnail alone does not update the modified date of the group
|
|
235
|
+
// thus we can just set props on the entity w/o re-fetching
|
|
236
|
+
this.entity.thumbnail = `thumbnail/${this.thumbnailCache.filename}`;
|
|
237
|
+
// Cover the Hub Group to an IGoup
|
|
238
|
+
const group = convertHubGroupToGroup_1.convertHubGroupToGroup(this.entity);
|
|
239
|
+
this.entity.thumbnailUrl = utils_1.getGroupThumbnailUrl(this.context.userRequestOptions.portal, group);
|
|
240
|
+
// clear the thumbnail cache
|
|
241
|
+
this.thumbnailCache = null;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// convert back to an entity. Apply any reverse transforms used in
|
|
245
|
+
// of the toEditor method
|
|
246
|
+
const entity = util_1.cloneObject(editor);
|
|
247
|
+
// create it if it does not yet exist...
|
|
248
|
+
if (isCreate) {
|
|
249
|
+
throw new Error("Cannot create group using the Editor.");
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
// ...otherwise, update the in-memory entity and save it
|
|
253
|
+
this.entity = entity;
|
|
254
|
+
this.save();
|
|
255
|
+
}
|
|
256
|
+
return this.entity;
|
|
257
|
+
}
|
|
180
258
|
}
|
|
181
259
|
exports.HubGroup = HubGroup;
|
|
182
260
|
//# sourceMappingURL=HubGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HubGroup.js","sourceRoot":"","sources":["../../../src/groups/HubGroup.ts"],"names":[],"mappings":";;;AAAA,2CAKqB;
|
|
1
|
+
{"version":3,"file":"HubGroup.js","sourceRoot":"","sources":["../../../src/groups/HubGroup.ts"],"names":[],"mappings":";;;AAAA,2CAKqB;AACrB,+EAA4E;AAE5E,yCAA2C;AAC3C,gDAOwB;AAIxB,kCAAsC;AAMtC,qEAAkE;AAClE,2DAAwD;AACxD,2CAAuD;AACvD,iEAA8D;AAE9D;;GAEG;AACH,MAAa,QAAQ;IAYnB,YAAoB,KAAgB,EAAE,OAAuB;QAJnD,gBAAW,GAAG,KAAK,CAAC;QACpB,mBAAc,GACtB,IAAI,CAAC;QAGL,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,IAAI,OAAO;QACT,IACE,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU;YACrB,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,KAAK,OAAO;gBACjC,IAAI,CAAC,MAAM,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC;YACxC,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,EACvD;YACA,OAAO,IAAI,CAAC;SACb;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAwB,EAAE,OAAuB;QAC/D,6CAA6C;QAC7C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AE,CAAC;SACb;QAED,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AApTD,4BAoTC"}
|
|
@@ -8,11 +8,10 @@ const parseInclude_1 = require("../search/_internal/parseInclude");
|
|
|
8
8
|
const urls_1 = require("../urls");
|
|
9
9
|
const util_1 = require("../util");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
|
-
const PropertyMapper_1 = require("../core/_internal/PropertyMapper");
|
|
12
11
|
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
13
|
-
const computeProps_1 = require("./_internal/computeProps");
|
|
14
|
-
const getPropertyMap_1 = require("./_internal/getPropertyMap");
|
|
15
12
|
const defaults_1 = require("./defaults");
|
|
13
|
+
const convertHubGroupToGroup_1 = require("./_internal/convertHubGroupToGroup");
|
|
14
|
+
const convertGroupToHubGroup_1 = require("./_internal/convertGroupToHubGroup");
|
|
16
15
|
/**
|
|
17
16
|
* Enrich a generic search result
|
|
18
17
|
* @param group
|
|
@@ -80,13 +79,13 @@ exports.enrichGroupSearchResult = enrichGroupSearchResult;
|
|
|
80
79
|
async function createHubGroup(partialGroup, requestOptions) {
|
|
81
80
|
// merge the incoming and default groups
|
|
82
81
|
const hubGroup = Object.assign(Object.assign({}, defaults_1.DEFAULT_GROUP), partialGroup);
|
|
83
|
-
const group = convertHubGroupToGroup(hubGroup);
|
|
82
|
+
const group = convertHubGroupToGroup_1.convertHubGroupToGroup(hubGroup);
|
|
84
83
|
const opts = {
|
|
85
84
|
group,
|
|
86
85
|
authentication: requestOptions.authentication,
|
|
87
86
|
};
|
|
88
87
|
const result = await arcgis_rest_portal_1.createGroup(opts);
|
|
89
|
-
return convertGroupToHubGroup(result.group, requestOptions);
|
|
88
|
+
return convertGroupToHubGroup_1.convertGroupToHubGroup(result.group, requestOptions);
|
|
90
89
|
}
|
|
91
90
|
exports.createHubGroup = createHubGroup;
|
|
92
91
|
/**
|
|
@@ -97,7 +96,7 @@ exports.createHubGroup = createHubGroup;
|
|
|
97
96
|
*/
|
|
98
97
|
async function fetchHubGroup(identifier, requestOptions) {
|
|
99
98
|
const group = await arcgis_rest_portal_1.getGroup(identifier, requestOptions);
|
|
100
|
-
return convertGroupToHubGroup(group, requestOptions);
|
|
99
|
+
return convertGroupToHubGroup_1.convertGroupToHubGroup(group, requestOptions);
|
|
101
100
|
}
|
|
102
101
|
exports.fetchHubGroup = fetchHubGroup;
|
|
103
102
|
/**
|
|
@@ -109,7 +108,7 @@ exports.fetchHubGroup = fetchHubGroup;
|
|
|
109
108
|
* @param requestOptions
|
|
110
109
|
*/
|
|
111
110
|
async function updateHubGroup(hubGroup, requestOptions) {
|
|
112
|
-
const group = convertHubGroupToGroup(hubGroup);
|
|
111
|
+
const group = convertHubGroupToGroup_1.convertHubGroupToGroup(hubGroup);
|
|
113
112
|
const opts = {
|
|
114
113
|
group,
|
|
115
114
|
authentication: requestOptions.authentication,
|
|
@@ -134,37 +133,4 @@ async function deleteHubGroup(id, requestOptions) {
|
|
|
134
133
|
await arcgis_rest_portal_1.removeGroup(ro);
|
|
135
134
|
}
|
|
136
135
|
exports.deleteHubGroup = deleteHubGroup;
|
|
137
|
-
/**
|
|
138
|
-
* Convert an IGroup to a Hub Group
|
|
139
|
-
* @param group
|
|
140
|
-
* @param requestOptions
|
|
141
|
-
*/
|
|
142
|
-
function convertGroupToHubGroup(group, requestOptions) {
|
|
143
|
-
const mapper = new PropertyMapper_1.PropertyMapper(getPropertyMap_1.getPropertyMap());
|
|
144
|
-
const hubGroup = mapper.storeToEntity(group, {});
|
|
145
|
-
return computeProps_1.computeProps(group, hubGroup, requestOptions);
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Convert a Hub Group to an IGroup
|
|
149
|
-
* @param hubGroup
|
|
150
|
-
*/
|
|
151
|
-
function convertHubGroupToGroup(hubGroup) {
|
|
152
|
-
const mapper = new PropertyMapper_1.PropertyMapper(getPropertyMap_1.getPropertyMap());
|
|
153
|
-
const group = mapper.entityToStore(hubGroup, {});
|
|
154
|
-
// convert the values for membershipAccess back to
|
|
155
|
-
// the ones the API accepts
|
|
156
|
-
if (group.membershipAccess === "organization") {
|
|
157
|
-
group.membershipAccess = "org";
|
|
158
|
-
}
|
|
159
|
-
if (group.membershipAccess === "collaborators") {
|
|
160
|
-
group.membershipAccess = "collaboration";
|
|
161
|
-
}
|
|
162
|
-
// since we are setting null to a prop, we need to
|
|
163
|
-
// send clearEmptyFields: true to the updateGroup call
|
|
164
|
-
if (group.membershipAccess === "anyone") {
|
|
165
|
-
group.membershipAccess = null;
|
|
166
|
-
group._clearEmptyFields = true;
|
|
167
|
-
}
|
|
168
|
-
return group;
|
|
169
|
-
}
|
|
170
136
|
//# sourceMappingURL=HubGroups.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HubGroups.js","sourceRoot":"","sources":["../../../src/groups/HubGroups.ts"],"names":[],"mappings":";;;AACA,yDAAgE;AAChE,wCAA8C;AAC9C,sCAAmE;AACnE,mEAAgE;AAEhE,kCAA0C;AAC1C,kCAAiC;AACjC,oCAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"HubGroups.js","sourceRoot":"","sources":["../../../src/groups/HubGroups.ts"],"names":[],"mappings":";;;AACA,yDAAgE;AAChE,wCAA8C;AAC9C,sCAAmE;AACnE,mEAAgE;AAEhE,kCAA0C;AAC1C,kCAAiC;AACjC,oCAAiC;AACjC,iEAKkC;AAIlC,yCAA2C;AAC3C,+EAA4E;AAC5E,+EAA4E;AAE5E;;;;;;GAMG;AACI,KAAK,UAAU,uBAAuB,CAC3C,KAAa,EACb,OAAiB,EACjB,cAAkC;IAElC,6BAA6B;IAC7B,MAAM,MAAM,GAAqB;QAC/B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,KAAK,CAAC,KAAK;QACjB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO,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AAsB,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG;QACX,KAAK;QACL,cAAc,EAAE,cAAc,CAAC,cAAc;KAC9C,CAAC;IACF,4CAA4C;IAC5C,iEAAiE;IACjE,IAAI,KAAK,CAAC,iBAAiB,EAAE;QAC3B,iBAAO,CAAC,yBAAyB,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;KAChD;IACD,MAAM,gCAAW,CAAC,IAAI,CAAC,CAAC;IACxB,OAAO,QAAQ,CAAC;AAClB,CAAC;AAhBD,wCAgBC;AAED;;;;;GAKG;AACI,KAAK,UAAU,cAAc,CAClC,EAAU,EACV,cAAmC;IAEnC,MAAM,EAAE,mCAAQ,cAAc,GAAK,EAAE,EAAE,EAAE,CAAE,CAAC;IAC5C,MAAM,gCAAW,CAAC,EAAE,CAAC,CAAC;AACxB,CAAC;AAND,wCAMC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GroupSchema = exports.GroupEditorTypes = void 0;
|
|
4
|
+
const shared_1 = require("../../core/schemas/shared");
|
|
5
|
+
exports.GroupEditorTypes = ["hub:group:edit"];
|
|
6
|
+
/**
|
|
7
|
+
* Defines the JSON schema for a Hub Group's editable fields
|
|
8
|
+
*/
|
|
9
|
+
exports.GroupSchema = {
|
|
10
|
+
required: ["name"],
|
|
11
|
+
type: "object",
|
|
12
|
+
properties: {
|
|
13
|
+
name: shared_1.ENTITY_NAME_SCHEMA,
|
|
14
|
+
summary: {
|
|
15
|
+
type: "string",
|
|
16
|
+
},
|
|
17
|
+
_thumbnail: shared_1.ENTITY_IMAGE_SCHEMA,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=GroupSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupSchema.js","sourceRoot":"","sources":["../../../../src/groups/_internal/GroupSchema.ts"],"names":[],"mappings":";;;AACA,sDAGmC;AAGtB,QAAA,gBAAgB,GAAG,CAAC,gBAAgB,CAAU,CAAC;AAE5D;;GAEG;AACU,QAAA,WAAW,GAAyB;IAC/C,QAAQ,EAAE,CAAC,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,IAAI,EAAE,2BAAkB;QACxB,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;SACf;QACD,UAAU,EAAE,4BAAmB;KAChC;CACsB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uiSchema = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Complete edit uiSchema for Hub Groups - this defines
|
|
6
|
+
* how the schema properties should be rendered in the
|
|
7
|
+
* group editing experience
|
|
8
|
+
*/
|
|
9
|
+
exports.uiSchema = {
|
|
10
|
+
type: "Layout",
|
|
11
|
+
elements: [
|
|
12
|
+
{
|
|
13
|
+
type: "Section",
|
|
14
|
+
labelKey: "{{i18nScope}}.sections.basicInfo.label",
|
|
15
|
+
elements: [
|
|
16
|
+
{
|
|
17
|
+
labelKey: "{{i18nScope}}.fields.name.label",
|
|
18
|
+
scope: "/properties/name",
|
|
19
|
+
type: "Control",
|
|
20
|
+
options: {
|
|
21
|
+
messages: [
|
|
22
|
+
{
|
|
23
|
+
type: "ERROR",
|
|
24
|
+
keyword: "required",
|
|
25
|
+
icon: true,
|
|
26
|
+
labelKey: "{{i18nScope}}.fields.name.requiredError",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
labelKey: "{{i18nScope}}.fields.summary.label",
|
|
33
|
+
scope: "/properties/summary",
|
|
34
|
+
type: "Control",
|
|
35
|
+
options: {
|
|
36
|
+
control: "hub-field-input-input",
|
|
37
|
+
type: "textarea",
|
|
38
|
+
helperText: {
|
|
39
|
+
labelKey: "{{i18nScope}}.fields.summary.helperText",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
labelKey: "{{i18nScope}}.fields._thumbnail.label",
|
|
45
|
+
scope: "/properties/_thumbnail",
|
|
46
|
+
type: "Control",
|
|
47
|
+
options: {
|
|
48
|
+
control: "hub-field-input-image-picker",
|
|
49
|
+
maxWidth: 727,
|
|
50
|
+
maxHeight: 484,
|
|
51
|
+
aspectRatio: 1.5,
|
|
52
|
+
helperText: {
|
|
53
|
+
labelKey: "{{i18nScope}}.fields._thumbnail.helperText",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=GroupUiSchemaEdit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupUiSchemaEdit.js","sourceRoot":"","sources":["../../../../src/groups/_internal/GroupUiSchemaEdit.ts"],"names":[],"mappings":";;;AAEA;;;;GAIG;AACU,QAAA,QAAQ,GAAc;IACjC,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE;QACR;YACE,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,wCAAwC;YAClD,QAAQ,EAAE;gBACR;oBACE,QAAQ,EAAE,iCAAiC;oBAC3C,KAAK,EAAE,kBAAkB;oBACzB,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE;wBACP,QAAQ,EAAE;4BACR;gCACE,IAAI,EAAE,OAAO;gCACb,OAAO,EAAE,UAAU;gCACnB,IAAI,EAAE,IAAI;gCACV,QAAQ,EAAE,yCAAyC;6BACpD;yBACF;qBACF;iBACF;gBACD;oBACE,QAAQ,EAAE,oCAAoC;oBAC9C,KAAK,EAAE,qBAAqB;oBAC5B,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE;wBACP,OAAO,EAAE,uBAAuB;wBAChC,IAAI,EAAE,UAAU;wBAChB,UAAU,EAAE;4BACV,QAAQ,EAAE,yCAAyC;yBACpD;qBACF;iBACF;gBACD;oBACE,QAAQ,EAAE,uCAAuC;oBACjD,KAAK,EAAE,wBAAwB;oBAC/B,IAAI,EAAE,SAAS;oBACf,OAAO,EAAE;wBACP,OAAO,EAAE,8BAA8B;wBACvC,QAAQ,EAAE,GAAG;wBACb,SAAS,EAAE,GAAG;wBACd,WAAW,EAAE,GAAG;wBAChB,UAAU,EAAE;4BACV,QAAQ,EAAE,4CAA4C;yBACvD;qBACF;iBACF;aACF;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertGroupToHubGroup = void 0;
|
|
4
|
+
const PropertyMapper_1 = require("../../core/_internal/PropertyMapper");
|
|
5
|
+
const computeProps_1 = require("./computeProps");
|
|
6
|
+
const getPropertyMap_1 = require("./getPropertyMap");
|
|
7
|
+
/**
|
|
8
|
+
* Convert an IGroup to a Hub Group
|
|
9
|
+
* @param group
|
|
10
|
+
* @param requestOptions
|
|
11
|
+
*/
|
|
12
|
+
function convertGroupToHubGroup(group, requestOptions) {
|
|
13
|
+
const mapper = new PropertyMapper_1.PropertyMapper(getPropertyMap_1.getPropertyMap());
|
|
14
|
+
const hubGroup = mapper.storeToEntity(group, {});
|
|
15
|
+
return computeProps_1.computeProps(group, hubGroup, requestOptions);
|
|
16
|
+
}
|
|
17
|
+
exports.convertGroupToHubGroup = convertGroupToHubGroup;
|
|
18
|
+
//# sourceMappingURL=convertGroupToHubGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertGroupToHubGroup.js","sourceRoot":"","sources":["../../../../src/groups/_internal/convertGroupToHubGroup.ts"],"names":[],"mappings":";;;AACA,wEAAqE;AAErE,iDAA8C;AAC9C,qDAAkD;AAGlD;;;;GAIG;AAEH,SAAgB,sBAAsB,CACpC,KAAa,EACb,cAAmC;IAEnC,MAAM,MAAM,GAAG,IAAI,+BAAc,CAC/B,+BAAc,EAAE,CACjB,CAAC;IACF,MAAM,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,CAAc,CAAC;IAC9D,OAAO,2BAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AACvD,CAAC;AATD,wDASC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertHubGroupToGroup = void 0;
|
|
4
|
+
const PropertyMapper_1 = require("../../core/_internal/PropertyMapper");
|
|
5
|
+
const getPropertyMap_1 = require("./getPropertyMap");
|
|
6
|
+
/**
|
|
7
|
+
* Convert a Hub Group to an IGroup
|
|
8
|
+
* @param hubGroup
|
|
9
|
+
*/
|
|
10
|
+
function convertHubGroupToGroup(hubGroup) {
|
|
11
|
+
const mapper = new PropertyMapper_1.PropertyMapper(getPropertyMap_1.getPropertyMap());
|
|
12
|
+
const group = mapper.entityToStore(hubGroup, {});
|
|
13
|
+
// convert the values for membershipAccess back to
|
|
14
|
+
// the ones the API accepts
|
|
15
|
+
if (group.membershipAccess === "organization") {
|
|
16
|
+
group.membershipAccess = "org";
|
|
17
|
+
}
|
|
18
|
+
if (group.membershipAccess === "collaborators") {
|
|
19
|
+
group.membershipAccess = "collaboration";
|
|
20
|
+
}
|
|
21
|
+
// since we are setting null to a prop, we need to
|
|
22
|
+
// send clearEmptyFields: true to the updateGroup call
|
|
23
|
+
if (group.membershipAccess === "anyone") {
|
|
24
|
+
group.membershipAccess = null;
|
|
25
|
+
group._clearEmptyFields = true;
|
|
26
|
+
}
|
|
27
|
+
return group;
|
|
28
|
+
}
|
|
29
|
+
exports.convertHubGroupToGroup = convertHubGroupToGroup;
|
|
30
|
+
//# sourceMappingURL=convertHubGroupToGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertHubGroupToGroup.js","sourceRoot":"","sources":["../../../../src/groups/_internal/convertHubGroupToGroup.ts"],"names":[],"mappings":";;;AACA,wEAAqE;AAErE,qDAAkD;AAElD;;;GAGG;AAEH,SAAgB,sBAAsB,CAAC,QAAmB;IACxD,MAAM,MAAM,GAAG,IAAI,+BAAc,CAC/B,+BAAc,EAAE,CACjB,CAAC;IACF,MAAM,KAAK,GAAG,MAAM,CAAC,aAAa,CAChC,QAAQ,EACR,EAAuB,CACd,CAAC;IACZ,kDAAkD;IAClD,2BAA2B;IAC3B,IAAI,KAAK,CAAC,gBAAgB,KAAK,cAAc,EAAE;QAC7C,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC;KAChC;IACD,IAAI,KAAK,CAAC,gBAAgB,KAAK,eAAe,EAAE;QAC9C,KAAK,CAAC,gBAAgB,GAAG,eAAe,CAAC;KAC1C;IACD,kDAAkD;IAClD,sDAAsD;IACtD,IAAI,KAAK,CAAC,gBAAgB,KAAK,QAAQ,EAAE;QACvC,KAAK,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC9B,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC;KAChC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAvBD,wDAuBC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteGroupThumbnail = void 0;
|
|
4
|
+
const arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
|
|
5
|
+
/**
|
|
6
|
+
* Delete a group's thumbnail
|
|
7
|
+
* @param id
|
|
8
|
+
* @param owner
|
|
9
|
+
* @param requestOptions
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
async function deleteGroupThumbnail(id, requestOptions) {
|
|
13
|
+
const { portal } = requestOptions;
|
|
14
|
+
const urlPath = `${portal}/community/groups/${id}/deleteThumbnail`;
|
|
15
|
+
return arcgis_rest_request_1.request(urlPath, requestOptions);
|
|
16
|
+
}
|
|
17
|
+
exports.deleteGroupThumbnail = deleteGroupThumbnail;
|
|
18
|
+
//# sourceMappingURL=deleteGroupThumbnail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteGroupThumbnail.js","sourceRoot":"","sources":["../../../src/groups/deleteGroupThumbnail.ts"],"names":[],"mappings":";;;AACA,mEAAoD;AAEpD;;;;;;GAMG;AACI,KAAK,UAAU,oBAAoB,CACxC,EAAU,EACV,cAAmC;IAEnC,MAAM,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC;IAClC,MAAM,OAAO,GAAG,GAAG,MAAM,qBAAqB,EAAE,kBAAkB,CAAC;IACnE,OAAO,6BAAO,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAC1C,CAAC;AAPD,oDAOC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setGroupThumbnail = void 0;
|
|
4
|
+
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
5
|
+
const HubError_1 = require("../HubError");
|
|
6
|
+
/**
|
|
7
|
+
* Upload a file to be used as the thumbnail for a group
|
|
8
|
+
* @param id
|
|
9
|
+
* @param file
|
|
10
|
+
* @param filename
|
|
11
|
+
* @param requestOptions
|
|
12
|
+
*/
|
|
13
|
+
async function setGroupThumbnail(id, file, filename, requestOptions, owner) {
|
|
14
|
+
const opts = Object.assign({ group: {
|
|
15
|
+
id,
|
|
16
|
+
}, owner, params: {
|
|
17
|
+
thumbnail: file,
|
|
18
|
+
fileName: filename,
|
|
19
|
+
}, filename }, requestOptions);
|
|
20
|
+
try {
|
|
21
|
+
const response = await arcgis_rest_portal_1.updateGroup(opts);
|
|
22
|
+
if (!response.success) {
|
|
23
|
+
throw new HubError_1.default("Set Group Thumbnail", "Unknown error setting thumbnail.");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
if (err instanceof Error) {
|
|
28
|
+
throw new HubError_1.default("Set Group Thumbnail", err.message, err);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
throw new HubError_1.default("Set Group Thumbnail", "Unknown error setting thumbnail.");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.setGroupThumbnail = setGroupThumbnail;
|
|
36
|
+
//# sourceMappingURL=setGroupThumbnail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setGroupThumbnail.js","sourceRoot":"","sources":["../../../src/groups/setGroupThumbnail.ts"],"names":[],"mappings":";;;AACA,iEAAuD;AACvD,0CAAmC;AAEnC;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CACrC,EAAU,EACV,IAAS,EACT,QAAgB,EAChB,cAAmC,EACnC,KAAa;IAEb,MAAM,IAAI,mBACR,KAAK,EAAE;YACL,EAAE;SACH,EACD,KAAK,EACL,MAAM,EAAE;YACN,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,QAAQ;SACnB,EACD,QAAQ,IACL,cAAc,CAClB,CAAC;IACF,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,gCAAW,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;YACrB,MAAM,IAAI,kBAAQ,CAChB,qBAAqB,EACrB,kCAAkC,CACnC,CAAC;SACH;KACF;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,GAAG,YAAY,KAAK,EAAE;YACxB,MAAM,IAAI,kBAAQ,CAAC,qBAAqB,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;SAC7D;aAAM;YACL,MAAM,IAAI,kBAAQ,CAChB,qBAAqB,EACrB,kCAAkC,CACnC,CAAC;SACH;KACF;AACH,CAAC;AArCD,8CAqCC"}
|
|
@@ -5,7 +5,7 @@ import Ajv from "ajv";
|
|
|
5
5
|
* to the supported/defined uiSchema configurations
|
|
6
6
|
*/
|
|
7
7
|
export declare type EditorType = (typeof validEditorTypes)[number];
|
|
8
|
-
export declare const validEditorTypes: readonly ["hub:project:create", "hub:project:edit", "hub:content:edit", "hub:initiative:edit", "hub:initiative:create", "hub:site:edit", "hub:discussion:edit", "hub:discussion:create", "hub:page:edit"];
|
|
8
|
+
export declare const validEditorTypes: readonly ["hub:project:create", "hub:project:edit", "hub:content:edit", "hub:initiative:edit", "hub:initiative:create", "hub:site:edit", "hub:discussion:edit", "hub:discussion:create", "hub:page:edit", "hub:group:edit"];
|
|
9
9
|
export declare enum UiSchemaRuleEffects {
|
|
10
10
|
SHOW = "SHOW",
|
|
11
11
|
HIDE = "HIDE",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IWithPermissions } from "../traits";
|
|
2
2
|
import { IHubEntityBase } from "./IHubEntityBase";
|
|
3
|
-
import { GroupSortField,
|
|
3
|
+
import { GroupSortField, MemberType, MembershipAccess, PlatformSortOrder, AccessLevel } from "./types";
|
|
4
4
|
/**
|
|
5
5
|
* Defines the properties of a Hub Group object
|
|
6
6
|
* @internal
|
|
@@ -9,8 +9,11 @@ export interface IHubGroup extends IHubEntityBase, IWithPermissions {
|
|
|
9
9
|
/**
|
|
10
10
|
* Access level of the group
|
|
11
11
|
* ("private" | "org" | "public")
|
|
12
|
+
* we are using AccessLevel instead of SettableAccessLevel
|
|
13
|
+
* intentionally due to the Portal API being inconsistent
|
|
14
|
+
* between .access on items vs groups
|
|
12
15
|
*/
|
|
13
|
-
access:
|
|
16
|
+
access: AccessLevel;
|
|
14
17
|
/**
|
|
15
18
|
* Whether members can auto join the group
|
|
16
19
|
*/
|
|
@@ -93,3 +96,14 @@ export interface IHubGroup extends IHubEntityBase, IWithPermissions {
|
|
|
93
96
|
*/
|
|
94
97
|
_clearEmptyFields?: boolean;
|
|
95
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* This type redefines the IHubGroup interface in such a way
|
|
101
|
+
* that it can be consumed by the entity editor.
|
|
102
|
+
*/
|
|
103
|
+
export declare type IHubGroupEditor = IHubGroup & {
|
|
104
|
+
/**
|
|
105
|
+
* Thumbnail image. This is only used on the Editor and is
|
|
106
|
+
* persisted in the fromEditor method on the Class
|
|
107
|
+
*/
|
|
108
|
+
_thumbnail?: any;
|
|
109
|
+
};
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import { IHubGroup } from "../core/types/IHubGroup";
|
|
1
|
+
import { IHubGroup, IHubGroupEditor } from "../core/types/IHubGroup";
|
|
2
2
|
import { IEntityPermissionPolicy, IPermissionAccessResponse, Permission } from "../permissions";
|
|
3
3
|
import { IWithStoreBehavior } from "../core/behaviors/IWithStoreBehavior";
|
|
4
4
|
import { IWithPermissionBehavior } from "../core/behaviors/IWithPermissionBehavior";
|
|
5
5
|
import { IArcGISContext } from "../ArcGISContext";
|
|
6
|
+
import { IEditorConfig, IWithEditorBehavior } from "../core/behaviors/IWithEditorBehavior";
|
|
7
|
+
import { EditorType } from "../core/schemas/types";
|
|
6
8
|
/**
|
|
7
9
|
* Hub Group Class
|
|
8
10
|
*/
|
|
9
|
-
export declare class HubGroup implements IWithStoreBehavior<IHubGroup>, IWithPermissionBehavior {
|
|
11
|
+
export declare class HubGroup implements IWithStoreBehavior<IHubGroup>, IWithPermissionBehavior, IWithEditorBehavior {
|
|
10
12
|
protected context: IArcGISContext;
|
|
11
13
|
protected entity: IHubGroup;
|
|
12
14
|
protected isDestroyed: boolean;
|
|
15
|
+
protected thumbnailCache: {
|
|
16
|
+
file?: any;
|
|
17
|
+
filename?: string;
|
|
18
|
+
clear?: boolean;
|
|
19
|
+
};
|
|
13
20
|
private constructor();
|
|
14
21
|
/**
|
|
15
22
|
* Whether the user can edit the group,
|
|
@@ -92,4 +99,15 @@ export declare class HubGroup implements IWithStoreBehavior<IHubGroup>, IWithPer
|
|
|
92
99
|
* @param id
|
|
93
100
|
*/
|
|
94
101
|
removePermissionPolicy(permission: Permission, id: string): void;
|
|
102
|
+
getEditorConfig(i18nScope: string, type: EditorType): Promise<IEditorConfig>;
|
|
103
|
+
/**
|
|
104
|
+
* Return the group as an editor object
|
|
105
|
+
*/
|
|
106
|
+
toEditor(): IHubGroupEditor;
|
|
107
|
+
/**
|
|
108
|
+
* Load the group from the editor object
|
|
109
|
+
* @param editor
|
|
110
|
+
* @returns
|
|
111
|
+
*/
|
|
112
|
+
fromEditor(editor: IHubGroupEditor): Promise<IHubGroup>;
|
|
95
113
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IConfigurationSchema } from "../../core";
|
|
2
|
+
export declare type GroupEditorType = (typeof GroupEditorTypes)[number];
|
|
3
|
+
export declare const GroupEditorTypes: readonly ["hub:group:edit"];
|
|
4
|
+
/**
|
|
5
|
+
* Defines the JSON schema for a Hub Group's editable fields
|
|
6
|
+
*/
|
|
7
|
+
export declare const GroupSchema: IConfigurationSchema;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IGroup } from "@esri/arcgis-rest-types";
|
|
2
|
+
import { IHubGroup } from "../../core/types/IHubGroup";
|
|
3
|
+
import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
|
|
4
|
+
/**
|
|
5
|
+
* Convert an IGroup to a Hub Group
|
|
6
|
+
* @param group
|
|
7
|
+
* @param requestOptions
|
|
8
|
+
*/
|
|
9
|
+
export declare function convertGroupToHubGroup(group: IGroup, requestOptions: IUserRequestOptions): IHubGroup;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
|
|
2
|
+
/**
|
|
3
|
+
* Delete a group's thumbnail
|
|
4
|
+
* @param id
|
|
5
|
+
* @param owner
|
|
6
|
+
* @param requestOptions
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function deleteGroupThumbnail(id: string, requestOptions: IUserRequestOptions): Promise<any>;
|