Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise((resolve, reject) => {
const requestOptions: common.IUserRequestOptions = {
authentication: destinationAuthentication
};
let newItemTemplate: common.IItemTemplate = common.cloneObject(template);
// cache the popup info to be added later
const popupInfos: common.IPopupInfos = common.cachePopupInfos(
newItemTemplate.data
);
// Create the item, then update its URL with its new id
common
.createFeatureService(
newItemTemplate,
requestOptions.authentication,
templateDictionary
)
.then(
createResponse => {
progressTickCallback();
return new Promise((resolve, reject) => {
// Replace the templatized symbols in a copy of the template
let newItemTemplate: common.IItemTemplate = common.cloneObject(template);
newItemTemplate = common.replaceInTemplate(
newItemTemplate,
templateDictionary
);
// Create the item, then update its URL with its new id
// some fieldnames are used as keys for objects
// when we templatize field references for web applications we first stringify the components of the
// web application that could contain field references and then serach for them with a regular expression.
// We also need to stringify the web application when de-templatizing so it will find all of these occurrences as well.
if (template.type === "Web Mapping Application" && template.data) {
newItemTemplate = JSON.parse(
common.replaceInTemplate(
JSON.stringify(newItemTemplate),
templateDictionary
return new Promise((resolve, reject) => {
// Replace the templatized symbols in a copy of the template
let newItemTemplate: common.IItemTemplate = common.cloneObject(template);
newItemTemplate = common.replaceInTemplate(
newItemTemplate,
templateDictionary
);
// handle group
const title: string = common.getUniqueTitle(
newItemTemplate.item.title,
templateDictionary,
"user.groups"
);
// Set the item title with a valid name for the ORG
newItemTemplate.item.title = title;
newItemTemplate.item.access = "private";
common.createGroup(newItemTemplate.item, destinationAuthentication).then(
createResponse => {