@esri/solution-creator 5.2.2 → 5.2.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/package.json +14 -14
- package/dist/cjs/createItemTemplate.d.ts +0 -108
- package/dist/cjs/createItemTemplate.js +0 -442
- package/dist/cjs/createItemTemplate.js.map +0 -1
- package/dist/cjs/creator.d.ts +0 -97
- package/dist/cjs/creator.js +0 -284
- package/dist/cjs/creator.js.map +0 -1
- package/dist/cjs/helpers/add-content-to-solution.d.ts +0 -126
- package/dist/cjs/helpers/add-content-to-solution.js +0 -471
- package/dist/cjs/helpers/add-content-to-solution.js.map +0 -1
- package/dist/cjs/helpers/template.d.ts +0 -30
- package/dist/cjs/helpers/template.js +0 -49
- package/dist/cjs/helpers/template.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -23
- package/dist/cjs/index.js +0 -27
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/module-map.d.ts +0 -23
- package/dist/cjs/module-map.js +0 -233
- package/dist/cjs/module-map.js.map +0 -1
|
@@ -1,471 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2020 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports._templatizeSolutionIds = exports._templatizeOrgUrl = exports._simplifyUrlsInItemDescriptions = exports._replaceRemainingIdsInString = exports._replaceRemainingIdsInObject = exports._replaceDictionaryItemsInObject = exports._postProcessIgnoredItems = exports._postProcessGroupDependencies = exports._getTemplateVariables = exports._getSolutionItemUrls = exports._getIdsOutOfTemplateVariables = exports._getDependencies = exports.addContentToSolution = void 0;
|
|
19
|
-
const solution_common_1 = require("@esri/solution-common");
|
|
20
|
-
const hub_common_1 = require("@esri/hub-common");
|
|
21
|
-
const createItemTemplate_1 = require("../createItemTemplate");
|
|
22
|
-
const template_1 = require("./template");
|
|
23
|
-
/**
|
|
24
|
-
* Adds a list of AGO item ids to a solution item.
|
|
25
|
-
*
|
|
26
|
-
* @param solutionItemId AGO id of solution to receive items
|
|
27
|
-
* @param options Customizations for creating the solution
|
|
28
|
-
* @param srcAuthentication Credentials for requests to source items
|
|
29
|
-
* @param destAuthentication Credentials for the requests to destination solution
|
|
30
|
-
* @returns A promise that resolves with the AGO id of the updated solution
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
function addContentToSolution(solutionItemId, options, srcAuthentication, destAuthentication) {
|
|
34
|
-
return new Promise((resolve, reject) => {
|
|
35
|
-
if (!options.itemIds || options.itemIds.length === 0) {
|
|
36
|
-
resolve(solutionItemId);
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
// Prepare feedback mechanism
|
|
40
|
-
let totalEstimatedCost = 2 * options.itemIds.length + 1; // solution items, plus avoid divide by 0
|
|
41
|
-
let percentDone = 16; // allow for previous creation work
|
|
42
|
-
let progressPercentStep = (95 - percentDone) / totalEstimatedCost; // leave some % for caller for wrapup
|
|
43
|
-
const failedItemIds = [];
|
|
44
|
-
let totalExpended = 0;
|
|
45
|
-
let statusOK = true;
|
|
46
|
-
const itemProgressCallback = (itemId, status, costUsed) => {
|
|
47
|
-
// ---------------------------------------------------------------------------------------------------------------
|
|
48
|
-
if (options.itemIds.indexOf(itemId) < 0) {
|
|
49
|
-
// New item--a dependency that wasn't in the supplied list of itemIds; add it to the list
|
|
50
|
-
// and recalculate the progress percent step based on how much progress remains to be done
|
|
51
|
-
options.itemIds.push(itemId);
|
|
52
|
-
totalEstimatedCost += 2;
|
|
53
|
-
progressPercentStep =
|
|
54
|
-
(95 - percentDone) / (totalEstimatedCost - totalExpended);
|
|
55
|
-
}
|
|
56
|
-
totalExpended += costUsed;
|
|
57
|
-
percentDone += progressPercentStep * costUsed;
|
|
58
|
-
if (options.progressCallback) {
|
|
59
|
-
options.progressCallback(Math.round(percentDone), options.jobId);
|
|
60
|
-
}
|
|
61
|
-
/* istanbul ignore if */
|
|
62
|
-
if (options.consoleProgress) {
|
|
63
|
-
console.log(Date.now(), itemId, options.jobId ?? "", solution_common_1.SItemProgressStatus[status], percentDone.toFixed(0) + "%", costUsed);
|
|
64
|
-
}
|
|
65
|
-
if (status === solution_common_1.EItemProgressStatus.Failed) {
|
|
66
|
-
let error = "";
|
|
67
|
-
solutionTemplates.some(t => {
|
|
68
|
-
/* istanbul ignore else */
|
|
69
|
-
if (t.itemId === itemId) {
|
|
70
|
-
/* istanbul ignore else */
|
|
71
|
-
if ((0, hub_common_1.getProp)(t, "properties.error")) {
|
|
72
|
-
error = t.properties.error;
|
|
73
|
-
try {
|
|
74
|
-
// parse for better console logging if we can
|
|
75
|
-
error = JSON.parse(error);
|
|
76
|
-
}
|
|
77
|
-
catch (e) {
|
|
78
|
-
/* istanbul ignore next */
|
|
79
|
-
// do nothing and show the error as is
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
(0, solution_common_1.removeTemplate)(solutionTemplates, itemId);
|
|
86
|
-
if (failedItemIds.indexOf(itemId) < 0) {
|
|
87
|
-
failedItemIds.push(itemId);
|
|
88
|
-
}
|
|
89
|
-
statusOK = false;
|
|
90
|
-
}
|
|
91
|
-
else if (status === solution_common_1.EItemProgressStatus.Ignored) {
|
|
92
|
-
(0, solution_common_1.removeTemplate)(solutionTemplates, itemId);
|
|
93
|
-
}
|
|
94
|
-
return statusOK;
|
|
95
|
-
// ---------------------------------------------------------------------------------------------------------------
|
|
96
|
-
};
|
|
97
|
-
// Replacement dictionary and created templates
|
|
98
|
-
const templateDictionary = options.templateDictionary ?? {};
|
|
99
|
-
let solutionTemplates = [];
|
|
100
|
-
// Handle a list of one or more AGO ids by stepping through the list
|
|
101
|
-
// and calling this function recursively
|
|
102
|
-
const getItemsPromise = [];
|
|
103
|
-
options.itemIds.forEach(itemId => {
|
|
104
|
-
const createDef = (0, createItemTemplate_1.createItemTemplate)(solutionItemId, itemId, templateDictionary, srcAuthentication, destAuthentication, solutionTemplates, itemProgressCallback);
|
|
105
|
-
getItemsPromise.push(createDef);
|
|
106
|
-
});
|
|
107
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
108
|
-
Promise.all(getItemsPromise).then((multipleResourceItemFiles) => {
|
|
109
|
-
if (failedItemIds.length > 0) {
|
|
110
|
-
reject((0, solution_common_1.failWithIds)(failedItemIds, "One or more items cannot be converted into templates"));
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
if (solutionTemplates.length > 0) {
|
|
114
|
-
// Coalesce the resource file paths from the created templates
|
|
115
|
-
let resourceItemFiles = multipleResourceItemFiles.reduce((accumulator, currentValue) => accumulator.concat(currentValue), []);
|
|
116
|
-
// Extract resource data files from templates
|
|
117
|
-
resourceItemFiles = resourceItemFiles.concat((0, template_1.getDataFilesFromTemplates)(solutionTemplates));
|
|
118
|
-
// test for and update group dependencies and other post-processing
|
|
119
|
-
solutionTemplates = _postProcessGroupDependencies(solutionTemplates);
|
|
120
|
-
solutionTemplates = (0, solution_common_1.postProcessWorkforceTemplates)(solutionTemplates);
|
|
121
|
-
// Filter out any resources from items that have been removed from the templates, such as
|
|
122
|
-
// Living Atlas layers
|
|
123
|
-
solutionTemplates = _postProcessIgnoredItems(solutionTemplates, templateDictionary);
|
|
124
|
-
const templateIds = solutionTemplates.map(template => template.itemId);
|
|
125
|
-
// Coalesce the resource file paths from the created templates
|
|
126
|
-
resourceItemFiles = resourceItemFiles.filter(file => templateIds.includes(file.itemId));
|
|
127
|
-
// Send the accumulated resources to the solution item
|
|
128
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
129
|
-
(0, solution_common_1.copyFilesToStorageItem)(resourceItemFiles, solutionItemId, destAuthentication).then(() => {
|
|
130
|
-
// Remove data files from templates--no longer needed
|
|
131
|
-
(0, template_1.removeDataFilesFromTemplates)(solutionTemplates);
|
|
132
|
-
_templatizeSolutionIds(solutionTemplates);
|
|
133
|
-
_simplifyUrlsInItemDescriptions(solutionTemplates);
|
|
134
|
-
solutionTemplates.forEach(template => {
|
|
135
|
-
if (template.type !== "Vector Tile Service") {
|
|
136
|
-
_replaceDictionaryItemsInObject(templateDictionary, template);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
_templatizeOrgUrl(solutionTemplates, destAuthentication).then(solutionTemplates2 => {
|
|
140
|
-
// Update solution item with its data JSON
|
|
141
|
-
const solutionData = {
|
|
142
|
-
metadata: { version: solution_common_1.SolutionTemplateFormatVersion },
|
|
143
|
-
templates: options.templatizeFields
|
|
144
|
-
? (0, createItemTemplate_1.postProcessFieldReferences)(solutionTemplates2)
|
|
145
|
-
: solutionTemplates2
|
|
146
|
-
};
|
|
147
|
-
const itemInfo = {
|
|
148
|
-
id: solutionItemId,
|
|
149
|
-
text: solutionData
|
|
150
|
-
};
|
|
151
|
-
(0, solution_common_1.updateItem)(itemInfo, destAuthentication).then(() => {
|
|
152
|
-
resolve(solutionItemId);
|
|
153
|
-
}, reject);
|
|
154
|
-
}, reject);
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
resolve(solutionItemId);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
exports.addContentToSolution = addContentToSolution;
|
|
165
|
-
// ------------------------------------------------------------------------------------------------------------------ //
|
|
166
|
-
/**
|
|
167
|
-
* Gets the dependencies of an item by merging its dependencies list with item references in template variables.
|
|
168
|
-
*
|
|
169
|
-
* @param template Template to examine
|
|
170
|
-
* @returns List of dependency ids
|
|
171
|
-
* @private
|
|
172
|
-
*/
|
|
173
|
-
function _getDependencies(template) {
|
|
174
|
-
// Get all dependencies
|
|
175
|
-
let deps = template.dependencies.concat(_getIdsOutOfTemplateVariables(_getTemplateVariables(JSON.stringify(template.data))));
|
|
176
|
-
// Remove duplicates and self-references
|
|
177
|
-
deps.sort();
|
|
178
|
-
deps = deps.filter((elem, index, array) => {
|
|
179
|
-
if (elem === template.itemId) {
|
|
180
|
-
return false;
|
|
181
|
-
}
|
|
182
|
-
else if (index > 0) {
|
|
183
|
-
return elem !== array[index - 1];
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
return true;
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
return deps;
|
|
190
|
-
}
|
|
191
|
-
exports._getDependencies = _getDependencies;
|
|
192
|
-
/**
|
|
193
|
-
* Extracts AGO ids out of template variables.
|
|
194
|
-
*
|
|
195
|
-
* @param variables List of template variables to examine
|
|
196
|
-
* @returns List of AGO ids referenced in `variables`
|
|
197
|
-
* @private
|
|
198
|
-
*/
|
|
199
|
-
function _getIdsOutOfTemplateVariables(variables) {
|
|
200
|
-
return variables
|
|
201
|
-
.map(variable => {
|
|
202
|
-
const idList = variable.match(/[0-9A-F]{32}/i); // is it a guid?
|
|
203
|
-
if (idList) {
|
|
204
|
-
return idList[0];
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
})
|
|
210
|
-
.filter(variable => !!variable);
|
|
211
|
-
}
|
|
212
|
-
exports._getIdsOutOfTemplateVariables = _getIdsOutOfTemplateVariables;
|
|
213
|
-
/**
|
|
214
|
-
* Creates a list of item URLs.
|
|
215
|
-
*
|
|
216
|
-
* @param templates Templates to check for URLs
|
|
217
|
-
* @returns List of URLs
|
|
218
|
-
* @private
|
|
219
|
-
*/
|
|
220
|
-
function _getSolutionItemUrls(templates) {
|
|
221
|
-
const solutionUrls = [];
|
|
222
|
-
templates.forEach(template => {
|
|
223
|
-
/* istanbul ignore else */
|
|
224
|
-
if (template.item.origUrl) {
|
|
225
|
-
solutionUrls.push([template.itemId, template.item.origUrl]);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
return solutionUrls;
|
|
229
|
-
}
|
|
230
|
-
exports._getSolutionItemUrls = _getSolutionItemUrls;
|
|
231
|
-
/**
|
|
232
|
-
* Extracts template variables out of a string.
|
|
233
|
-
*
|
|
234
|
-
* @param text String to examine
|
|
235
|
-
* @returns List of template variables found in string
|
|
236
|
-
* @private
|
|
237
|
-
*/
|
|
238
|
-
function _getTemplateVariables(text) {
|
|
239
|
-
return (text.match(/{{[a-z0-9.]*}}/gi) || []) // find variable
|
|
240
|
-
.map(variable => variable.substring(2, variable.length - 2)); // remove "{{" & "}}"
|
|
241
|
-
}
|
|
242
|
-
exports._getTemplateVariables = _getTemplateVariables;
|
|
243
|
-
/**
|
|
244
|
-
* Update the items dependencies and groups arrays
|
|
245
|
-
*
|
|
246
|
-
* @param templates The array of templates to evaluate
|
|
247
|
-
* @returns Updated version of the templates
|
|
248
|
-
* @private
|
|
249
|
-
*/
|
|
250
|
-
function _postProcessGroupDependencies(templates) {
|
|
251
|
-
return templates.map((template) => {
|
|
252
|
-
if (template.type === "Group") {
|
|
253
|
-
const id = template.itemId;
|
|
254
|
-
// remove group dependencies if we find a circular dependency with one of its items
|
|
255
|
-
let removeDependencies = false;
|
|
256
|
-
// before we remove update each dependants groups array
|
|
257
|
-
template.dependencies.forEach(dependencyId => {
|
|
258
|
-
const dependantTemplate = (0, solution_common_1.getTemplateById)(templates, dependencyId);
|
|
259
|
-
// Not all items shared to the group will exist in the templates array
|
|
260
|
-
// i.e. Hub Initiative items or any other unsupported types
|
|
261
|
-
if (dependantTemplate) {
|
|
262
|
-
// check if the group is in the dependantTemplate's list of dependencies
|
|
263
|
-
const gIndex = (0, hub_common_1.getWithDefault)(dependantTemplate, "dependencies", []).indexOf(id);
|
|
264
|
-
/* istanbul ignore else */
|
|
265
|
-
if (gIndex > -1) {
|
|
266
|
-
removeDependencies = true;
|
|
267
|
-
}
|
|
268
|
-
// if the dependant template does not have the group id
|
|
269
|
-
// in it's groups array, add it
|
|
270
|
-
const groups = (0, hub_common_1.getWithDefault)(dependantTemplate, "groups", []);
|
|
271
|
-
if (groups.indexOf(id) === -1) {
|
|
272
|
-
groups.push(id);
|
|
273
|
-
dependantTemplate.groups = groups;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
if (removeDependencies) {
|
|
278
|
-
template.dependencies = [];
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
return template;
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
exports._postProcessGroupDependencies = _postProcessGroupDependencies;
|
|
285
|
-
/**
|
|
286
|
-
* Check for feature service items that have been flagged for invalid designations.
|
|
287
|
-
* Remove templates that have invalid designations from the solution item and other item dependencies.
|
|
288
|
-
* Clean up any references to items with invalid designations in the other templates.
|
|
289
|
-
*
|
|
290
|
-
* @param templates The array of templates to evaluate
|
|
291
|
-
* @param templateDictionary Hash of key details used for variable replacement
|
|
292
|
-
* @returns Updated version of the templates
|
|
293
|
-
* @private
|
|
294
|
-
*/
|
|
295
|
-
function _postProcessIgnoredItems(templates, templateDictionary) {
|
|
296
|
-
// replace in template
|
|
297
|
-
const updateDictionary = templates.reduce((result, template) => {
|
|
298
|
-
const invalidDes = template.properties.hasInvalidDesignations;
|
|
299
|
-
const unreachableVal = (0, hub_common_1.getProp)(templateDictionary, `${solution_common_1.UNREACHABLE}.${template.itemId}`);
|
|
300
|
-
if (invalidDes && unreachableVal && Object.keys(template.data).length < 1) {
|
|
301
|
-
template.data[template.itemId] = unreachableVal;
|
|
302
|
-
}
|
|
303
|
-
return invalidDes ? Object.assign(result, template.data) : result;
|
|
304
|
-
}, {});
|
|
305
|
-
Object.keys(updateDictionary).forEach(k => {
|
|
306
|
-
(0, solution_common_1.removeTemplate)(templates, k);
|
|
307
|
-
templates = templates.map(t => {
|
|
308
|
-
t.dependencies = t.dependencies.filter(id => id !== k);
|
|
309
|
-
return (0, solution_common_1.replaceInTemplate)(t, updateDictionary);
|
|
310
|
-
});
|
|
311
|
-
});
|
|
312
|
-
return templates;
|
|
313
|
-
}
|
|
314
|
-
exports._postProcessIgnoredItems = _postProcessIgnoredItems;
|
|
315
|
-
/**
|
|
316
|
-
* Recursively runs through an object to find and replace any strings found in a dictionary.
|
|
317
|
-
*
|
|
318
|
-
* @param templateDictionary Hash of things to be replaced
|
|
319
|
-
* @param obj Object to be examined
|
|
320
|
-
* @private
|
|
321
|
-
*/
|
|
322
|
-
function _replaceDictionaryItemsInObject(hash, obj) {
|
|
323
|
-
/* istanbul ignore else */
|
|
324
|
-
if (obj) {
|
|
325
|
-
Object.keys(obj).forEach(prop => {
|
|
326
|
-
const propObj = obj[prop];
|
|
327
|
-
if (propObj) {
|
|
328
|
-
if (typeof propObj === "object") {
|
|
329
|
-
_replaceDictionaryItemsInObject(hash, propObj);
|
|
330
|
-
}
|
|
331
|
-
else if (typeof propObj === "string") {
|
|
332
|
-
obj[prop] = hash[propObj] || propObj;
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
return obj;
|
|
338
|
-
}
|
|
339
|
-
exports._replaceDictionaryItemsInObject = _replaceDictionaryItemsInObject;
|
|
340
|
-
/**
|
|
341
|
-
* Recursively runs through an object to find and templatize any remaining references to solution's items.
|
|
342
|
-
*
|
|
343
|
-
* @param ids Ids to be replaced in strings found in object
|
|
344
|
-
* @param obj Object to be examined
|
|
345
|
-
* @private
|
|
346
|
-
*/
|
|
347
|
-
function _replaceRemainingIdsInObject(ids, obj) {
|
|
348
|
-
/* istanbul ignore else */
|
|
349
|
-
if (obj) {
|
|
350
|
-
Object.keys(obj).forEach(prop => {
|
|
351
|
-
const propObj = obj[prop];
|
|
352
|
-
if (propObj) {
|
|
353
|
-
if (typeof propObj === "object") {
|
|
354
|
-
_replaceRemainingIdsInObject(ids, propObj);
|
|
355
|
-
}
|
|
356
|
-
else if (typeof propObj === "string") {
|
|
357
|
-
obj[prop] = _replaceRemainingIdsInString(ids, propObj);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
return obj;
|
|
363
|
-
}
|
|
364
|
-
exports._replaceRemainingIdsInObject = _replaceRemainingIdsInObject;
|
|
365
|
-
/**
|
|
366
|
-
* Templatizes ids from a list in a string if they're not already templatized.
|
|
367
|
-
*
|
|
368
|
-
* @param ids Ids to be replaced in source string
|
|
369
|
-
* @param str Source string to be examined
|
|
370
|
-
* @returns A copy of the source string with any templatization changes
|
|
371
|
-
* @private
|
|
372
|
-
*/
|
|
373
|
-
function _replaceRemainingIdsInString(ids, str) {
|
|
374
|
-
let updatedStr = str;
|
|
375
|
-
const untemplatizedIds = (0, solution_common_1.getIDs)(str);
|
|
376
|
-
if (untemplatizedIds.length > 0) {
|
|
377
|
-
untemplatizedIds.forEach(id => {
|
|
378
|
-
if (ids.includes(id)) {
|
|
379
|
-
const re = new RegExp("({*)" + id, "gi");
|
|
380
|
-
updatedStr = updatedStr.replace(re, match => match.indexOf("{{") < 0
|
|
381
|
-
? "{{" + id.replace("{", "") + ".itemId}}"
|
|
382
|
-
: match);
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
return updatedStr;
|
|
387
|
-
}
|
|
388
|
-
exports._replaceRemainingIdsInString = _replaceRemainingIdsInString;
|
|
389
|
-
/**
|
|
390
|
-
* Finds and templatizes any URLs in solution items' descriptions.
|
|
391
|
-
*
|
|
392
|
-
* @param templates The array of templates to evaluate, modified in place
|
|
393
|
-
* @private
|
|
394
|
-
*/
|
|
395
|
-
function _simplifyUrlsInItemDescriptions(templates) {
|
|
396
|
-
// Get the urls in the solution along with their item ids & convert the id into the form
|
|
397
|
-
// "{{fcb2bf2837a6404ebb418a1f805f976a.url}}"
|
|
398
|
-
const solutionUrls = _getSolutionItemUrls(templates).map(idUrl => [
|
|
399
|
-
"{{" + idUrl[0] + ".url}}",
|
|
400
|
-
idUrl[1]
|
|
401
|
-
]);
|
|
402
|
-
/* istanbul ignore else */
|
|
403
|
-
if (solutionUrls.length > 0) {
|
|
404
|
-
// Make the replacements
|
|
405
|
-
templates.forEach(template => {
|
|
406
|
-
solutionUrls.forEach(
|
|
407
|
-
// TypeScript for es2015 doesn't have a definition for `replaceAll`
|
|
408
|
-
idUrl => {
|
|
409
|
-
/* istanbul ignore else */
|
|
410
|
-
if (template.item.description) {
|
|
411
|
-
template.item.description = template.item
|
|
412
|
-
.description.replaceAll(idUrl[1], idUrl[0]);
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
exports._simplifyUrlsInItemDescriptions = _simplifyUrlsInItemDescriptions;
|
|
419
|
-
/**
|
|
420
|
-
* Templatizes occurrences of the URL to the user's organization in the `item` and `data` template sections.
|
|
421
|
-
*
|
|
422
|
-
* @param templates The array of templates to evaluate; templates is modified in place
|
|
423
|
-
* @param destAuthentication Credentials for request organization info
|
|
424
|
-
* @returns Promise resolving with `templates`
|
|
425
|
-
* @private
|
|
426
|
-
*/
|
|
427
|
-
function _templatizeOrgUrl(templates, destAuthentication) {
|
|
428
|
-
return new Promise((resolve, reject) => {
|
|
429
|
-
// Get the org's URL
|
|
430
|
-
(0, solution_common_1.getPortal)(null, destAuthentication).then(org => {
|
|
431
|
-
let orgUrl = "https://" + org.urlKey + "." + org.customBaseUrl;
|
|
432
|
-
const templatizedOrgUrl = "{{portalBaseUrl}}";
|
|
433
|
-
// Cycle through each of the items in the template and scan the `item` and `data` sections of each for replacements
|
|
434
|
-
templates.forEach((template) => {
|
|
435
|
-
(0, solution_common_1.globalStringReplace)(template.item, new RegExp(orgUrl, "gi"), templatizedOrgUrl);
|
|
436
|
-
(0, solution_common_1.globalStringReplace)(template.data, new RegExp(orgUrl, "gi"), templatizedOrgUrl);
|
|
437
|
-
});
|
|
438
|
-
// Handle encoded URLs
|
|
439
|
-
orgUrl = orgUrl.replace("https://", "https%3A%2F%2F");
|
|
440
|
-
// Cycle through each of the items in the template and scan the `data` sections of each for replacements
|
|
441
|
-
templates.forEach((template) => {
|
|
442
|
-
(0, solution_common_1.globalStringReplace)(template.data, new RegExp(orgUrl, "gi"), templatizedOrgUrl);
|
|
443
|
-
});
|
|
444
|
-
resolve(templates);
|
|
445
|
-
}, reject);
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
exports._templatizeOrgUrl = _templatizeOrgUrl;
|
|
449
|
-
/**
|
|
450
|
-
* Finds and templatizes any references to solution's items.
|
|
451
|
-
*
|
|
452
|
-
* @param templates The array of templates to evaluate, modified in place
|
|
453
|
-
* @private
|
|
454
|
-
*/
|
|
455
|
-
function _templatizeSolutionIds(templates) {
|
|
456
|
-
// Get the ids in the solution
|
|
457
|
-
const solutionIds = templates.map((template) => template.itemId);
|
|
458
|
-
// Cycle through each of the items in the template and
|
|
459
|
-
// 1. templatize untemplatized ids in our solution in the `item` and `data` sections;
|
|
460
|
-
// 2. update the `dependencies` section
|
|
461
|
-
templates.forEach((template) => {
|
|
462
|
-
_replaceRemainingIdsInObject(solutionIds, template.item);
|
|
463
|
-
_replaceRemainingIdsInObject(solutionIds, template.data);
|
|
464
|
-
/* istanbul ignore else */
|
|
465
|
-
if (template.type !== "Group" && !(0, solution_common_1.isWorkforceProject)(template)) {
|
|
466
|
-
template.dependencies = _getDependencies(template);
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
exports._templatizeSolutionIds = _templatizeSolutionIds;
|
|
471
|
-
//# sourceMappingURL=add-content-to-solution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-content-to-solution.js","sourceRoot":"","sources":["../../../src/helpers/add-content-to-solution.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,2DAuB+B;AAC/B,iDAA2D;AAC3D,8DAG+B;AAC/B,yCAGoB;AAEpB;;;;;;;;;GASG;AACH,SAAgB,oBAAoB,CAClC,cAAsB,EACtB,OAA+B,EAC/B,iBAA8B,EAC9B,kBAA+B;IAE/B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACpD,OAAO,CAAC,cAAc,CAAC,CAAC;YACxB,OAAO;SACR;QAED,6BAA6B;QAC7B,IAAI,kBAAkB,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,yCAAyC;QAClG,IAAI,WAAW,GAAW,EAAE,CAAC,CAAC,mCAAmC;QACjE,IAAI,mBAAmB,GAAG,CAAC,EAAE,GAAG,WAAW,CAAC,GAAG,kBAAkB,CAAC,CAAC,qCAAqC;QAExG,MAAM,aAAa,GAAa,EAAE,CAAC;QACnC,IAAI,aAAa,GAAG,CAAC,CAAC;QACtB,IAAI,QAAQ,GAAG,IAAI,CAAC;QACpB,MAAM,oBAAoB,GAA0B,CAClD,MAAc,EACd,MAA2B,EAC3B,QAAgB,EAChB,EAAE;YACF,kHAAkH;YAClH,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;gBACvC,yFAAyF;gBACzF,0FAA0F;gBAC1F,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAE7B,kBAAkB,IAAI,CAAC,CAAC;gBACxB,mBAAmB;oBACjB,CAAC,EAAE,GAAG,WAAW,CAAC,GAAG,CAAC,kBAAkB,GA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C/D,8BAA8B;IAC9B,MAAM,WAAW,GAAa,SAAS,CAAC,GAAG,CACzC,CAAC,QAAuB,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAC7C,CAAC;IAEF,sDAAsD;IACtD,qFAAqF;IACrF,uCAAuC;IACvC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAuB,EAAE,EAAE;QAC5C,4BAA4B,CAAC,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzD,4BAA4B,CAAC,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzD,0BAA0B;QAC1B,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,IAAA,oCAAkB,EAAC,QAAQ,CAAC,EAAE;YAC9D,QAAQ,CAAC,YAAY,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;SACpD;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,wDAiBC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2022 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { IItemTemplate, ISourceFile } from "@esri/solution-common";
|
|
17
|
-
/**
|
|
18
|
-
* Extracts resource data files from templates.
|
|
19
|
-
*
|
|
20
|
-
* @param templates List of templates to examine
|
|
21
|
-
*
|
|
22
|
-
* @return List of resource data files found in supplied templates
|
|
23
|
-
*/
|
|
24
|
-
export declare function getDataFilesFromTemplates(templates: IItemTemplate[]): ISourceFile[];
|
|
25
|
-
/**
|
|
26
|
-
* Removes data files from templates.
|
|
27
|
-
*
|
|
28
|
-
* @param templates List of templates to modify
|
|
29
|
-
*/
|
|
30
|
-
export declare function removeDataFilesFromTemplates(templates: IItemTemplate[]): void;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2022 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.removeDataFilesFromTemplates = exports.getDataFilesFromTemplates = void 0;
|
|
19
|
-
/**
|
|
20
|
-
* Extracts resource data files from templates.
|
|
21
|
-
*
|
|
22
|
-
* @param templates List of templates to examine
|
|
23
|
-
*
|
|
24
|
-
* @return List of resource data files found in supplied templates
|
|
25
|
-
*/
|
|
26
|
-
function getDataFilesFromTemplates(templates) {
|
|
27
|
-
const resourceItemFiles = [];
|
|
28
|
-
templates.forEach((template) => {
|
|
29
|
-
if (template.dataFile) {
|
|
30
|
-
resourceItemFiles.push(template.dataFile);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return resourceItemFiles;
|
|
34
|
-
}
|
|
35
|
-
exports.getDataFilesFromTemplates = getDataFilesFromTemplates;
|
|
36
|
-
/**
|
|
37
|
-
* Removes data files from templates.
|
|
38
|
-
*
|
|
39
|
-
* @param templates List of templates to modify
|
|
40
|
-
*/
|
|
41
|
-
function removeDataFilesFromTemplates(templates) {
|
|
42
|
-
templates.forEach((template) => {
|
|
43
|
-
if (template.dataFile) {
|
|
44
|
-
delete template.dataFile;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
exports.removeDataFilesFromTemplates = removeDataFilesFromTemplates;
|
|
49
|
-
//# sourceMappingURL=template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/helpers/template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAOH;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACvC,SAA0B;IAE1B,MAAM,iBAAiB,GAAkB,EAAE,CAAC;IAE5C,SAAS,CAAC,OAAO,CACf,CAAC,QAAuB,EAAE,EAAE;QAC1B,IAAI,QAAQ,CAAC,QAAQ,EAAE;YACrB,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SAC3C;IACH,CAAC,CACF,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAdD,8DAcC;AAED;;;;GAIG;AACH,SAAgB,4BAA4B,CAC1C,SAA0B;IAE1B,SAAS,CAAC,OAAO,CACf,CAAC,QAAuB,EAAE,EAAE;QAC1B,IAAI,QAAQ,CAAC,QAAQ,EAAE;YACrB,OAAO,QAAQ,CAAC,QAAQ,CAAC;SAC1B;IACH,CAAC,CACF,CAAC;AACJ,CAAC;AAVD,oEAUC"}
|
package/dist/cjs/index.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2018 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Manages the creation of a Solution item.
|
|
18
|
-
*
|
|
19
|
-
* @module creator
|
|
20
|
-
*/
|
|
21
|
-
export * from "./creator";
|
|
22
|
-
export * from "./createItemTemplate";
|
|
23
|
-
export * from "./module-map";
|
package/dist/cjs/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2018 Esri
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const tslib_1 = require("tslib");
|
|
19
|
-
/**
|
|
20
|
-
* Manages the creation of a Solution item.
|
|
21
|
-
*
|
|
22
|
-
* @module creator
|
|
23
|
-
*/
|
|
24
|
-
tslib_1.__exportStar(require("./creator"), exports);
|
|
25
|
-
tslib_1.__exportStar(require("./createItemTemplate"), exports);
|
|
26
|
-
tslib_1.__exportStar(require("./module-map"), exports);
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,oDAA0B;AAC1B,+DAAqC;AACrC,uDAA6B"}
|
package/dist/cjs/module-map.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2020 Esri
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { moduleHandler, IItemTypeModuleMap } from "@esri/solution-common";
|
|
17
|
-
export declare const UNSUPPORTED: moduleHandler;
|
|
18
|
-
/**
|
|
19
|
-
* Mapping from item type to module with type-specific template-handling code.
|
|
20
|
-
* AGO types come from a blend of arcgis-portal-app\src\js\arcgisonline\pages\item\_Info.ts and
|
|
21
|
-
* arcgis-portal-app\src\js\arcgis-components\src\_utils\metadata\item\displayName.ts
|
|
22
|
-
*/
|
|
23
|
-
export declare const moduleMap: IItemTypeModuleMap;
|