@esri/solution-creator 6.0.5-alpha.0 → 6.1.0-alpha.0

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.
Files changed (37) hide show
  1. package/package.json +15 -15
  2. package/dist/cjs/createItemTemplate.d.ts +0 -117
  3. package/dist/cjs/createItemTemplate.js +0 -484
  4. package/dist/cjs/createItemTemplate.js.map +0 -1
  5. package/dist/cjs/creator.d.ts +0 -107
  6. package/dist/cjs/creator.js +0 -374
  7. package/dist/cjs/creator.js.map +0 -1
  8. package/dist/cjs/helpers/add-content-to-solution.d.ts +0 -159
  9. package/dist/cjs/helpers/add-content-to-solution.js +0 -561
  10. package/dist/cjs/helpers/add-content-to-solution.js.map +0 -1
  11. package/dist/cjs/helpers/template.d.ts +0 -30
  12. package/dist/cjs/helpers/template.js +0 -49
  13. package/dist/cjs/helpers/template.js.map +0 -1
  14. package/dist/cjs/index.d.ts +0 -23
  15. package/dist/cjs/index.js +0 -27
  16. package/dist/cjs/index.js.map +0 -1
  17. package/dist/cjs/module-map.d.ts +0 -23
  18. package/dist/cjs/module-map.js +0 -234
  19. package/dist/cjs/module-map.js.map +0 -1
  20. package/dist/esm/createItemTemplate.d.ts +0 -117
  21. package/dist/esm/createItemTemplate.js +0 -471
  22. package/dist/esm/createItemTemplate.js.map +0 -1
  23. package/dist/esm/creator.d.ts +0 -107
  24. package/dist/esm/creator.js +0 -362
  25. package/dist/esm/creator.js.map +0 -1
  26. package/dist/esm/helpers/add-content-to-solution.d.ts +0 -159
  27. package/dist/esm/helpers/add-content-to-solution.js +0 -540
  28. package/dist/esm/helpers/add-content-to-solution.js.map +0 -1
  29. package/dist/esm/helpers/template.d.ts +0 -30
  30. package/dist/esm/helpers/template.js +0 -44
  31. package/dist/esm/helpers/template.js.map +0 -1
  32. package/dist/esm/index.d.ts +0 -23
  33. package/dist/esm/index.js +0 -24
  34. package/dist/esm/index.js.map +0 -1
  35. package/dist/esm/module-map.d.ts +0 -23
  36. package/dist/esm/module-map.js +0 -230
  37. package/dist/esm/module-map.js.map +0 -1
@@ -1,362 +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
- import { appendQueryParam, createItemWithData, createLongId, createShortId, CURRENT_SCHEMA_VERSION, generateSourceThumbnailUrl, getBlobAsFile, getFilenameFromUrl, getGroup, getGroupBase, getGroupContents, getItem, getItemBase, getItemDataAsJson, getPortal, getSubgroupIds, getUser, getVelocityUrlBase, getWorkflowBaseURL, removeItem, sanitizeJSON, searchItems, setLocationTrackingEnabled, } from "@esri/solution-common";
22
- import { failSafe } from "@esri/hub-common";
23
- import { addContentToSolution } from "./helpers/add-content-to-solution";
24
- // Simple no-op to clean up progressCallback management
25
- const noOp = () => { };
26
- /**
27
- * Creates a solution item.
28
- *
29
- * @param sourceId AGO id of group whose contents are to be added to solution or of an item to convert into a solution
30
- * @param srcAuthentication Credentials for requests to source items
31
- * @param destAuthentication Credentials for the requests to destination solution
32
- * @param options Customizations for creating the solution
33
- * @returns A promise that resolves with the AGO id of the new solution
34
- */
35
- export async function createSolution(sourceId, srcAuthentication, destAuthentication, options) {
36
- const createOptions = options || {};
37
- const progressCb = createOptions.progressCallback || noOp;
38
- createOptions.templateDictionary = Object.assign({}, createOptions.templateDictionary);
39
- progressCb(1); // let the caller know that we've started
40
- try {
41
- // Assume that source is a group and try to get group's information
42
- let updatedCreateOptions = await Promise.all([
43
- getGroupBase(sourceId, srcAuthentication),
44
- getGroupContents(sourceId, srcAuthentication),
45
- getVelocityUrlBase(srcAuthentication, createOptions.templateDictionary),
46
- ]).then(
47
- // Group fetches worked; assumption was correct
48
- (responses) => {
49
- createOptions.itemIds = responses[1];
50
- progressCb(15);
51
- return new Promise((resolve) => {
52
- // Update the createOptions with values from the group
53
- resolve(_applySourceToCreateOptions(createOptions, responses[0], srcAuthentication, true));
54
- });
55
- },
56
- // Assumption incorrect; try source as an item
57
- () => {
58
- return new Promise((resolve, reject) => {
59
- createOptions.itemIds = [sourceId];
60
- getItemBase(sourceId, srcAuthentication).then(
61
- // Update the createOptions with values from the item
62
- (itemBase) => {
63
- if (itemBase.type === "Solution" && itemBase.typeKeywords && itemBase.typeKeywords.includes("Deployed")) {
64
- _updateCreateOptionForReDeployedTemplate(sourceId, srcAuthentication, createOptions, itemBase).then((modifiedCreateOptions) => {
65
- resolve(_applySourceToCreateOptions(modifiedCreateOptions, itemBase, srcAuthentication, false));
66
- }, reject);
67
- }
68
- else {
69
- resolve(_applySourceToCreateOptions(createOptions, itemBase, srcAuthentication, false));
70
- }
71
- }, reject);
72
- });
73
- });
74
- const userInfoResponses = await Promise.all([getPortal("", srcAuthentication), getUser(srcAuthentication)]);
75
- const [portalResponse, userResponse] = userInfoResponses;
76
- // check tracking
77
- setLocationTrackingEnabled(portalResponse, userResponse, updatedCreateOptions.templateDictionary);
78
- // Add information needed for workflow manager
79
- const user = await getUser(srcAuthentication);
80
- updatedCreateOptions.templateDictionary.workflowBaseUrl = await getWorkflowBaseURL(srcAuthentication, portalResponse, user.orgId);
81
- const portal = await srcAuthentication.getPortal();
82
- let portalBaseUrl;
83
- if (portal.urlKey) {
84
- portalBaseUrl = `https://${portal.urlKey}.maps.arcgis.com`;
85
- }
86
- else if (portal.portalHostname) {
87
- portalBaseUrl = `https://${portal.portalHostname}`;
88
- }
89
- if (portalBaseUrl) {
90
- updatedCreateOptions.templateDictionary["portalBaseUrl"] = portalBaseUrl;
91
- }
92
- // Use a copy of the thumbnail rather than a URL to it
93
- updatedCreateOptions = await _addThumbnailFileToCreateOptions(updatedCreateOptions, srcAuthentication);
94
- // Create a solution
95
- const createdSolutionId = _createSolutionFromItemIds(updatedCreateOptions, srcAuthentication, destAuthentication);
96
- // Successfully created solution
97
- progressCb(100); // finished
98
- return createdSolutionId;
99
- }
100
- catch (error) {
101
- // Error fetching group, group contents, or item, or error creating solution from ids
102
- progressCb(1);
103
- console.error(error);
104
- throw error;
105
- }
106
- }
107
- /**
108
- * Update the createOptions with the group properties
109
- *
110
- * @param createOptions
111
- * @param sourceInfo
112
- * @param authentication
113
- * @param isGroup Boolean to indicate if the files are associated with a group or item
114
- * @private
115
- */
116
- export function _applySourceToCreateOptions(createOptions, sourceInfo, srcAuthentication, isGroup = false) {
117
- // Create a solution from the group's or item's contents,
118
- // using the group's or item's information as defaults for the solution item
119
- [
120
- "title",
121
- "snippet",
122
- "description",
123
- "tags",
124
- "properties",
125
- "accessInformation",
126
- "licenseInfo",
127
- "categories",
128
- "typeKeywords",
129
- ].forEach((prop) => {
130
- if (createOptions[prop] !== undefined || sourceInfo[prop] !== undefined) {
131
- createOptions[prop] = createOptions[prop] ?? sourceInfo[prop];
132
- }
133
- });
134
- if (!createOptions.thumbnailurl && sourceInfo.thumbnail) {
135
- // Get the full path to the thumbnail
136
- createOptions.thumbnailurl = generateSourceThumbnailUrl(srcAuthentication.portal, sourceInfo.id, sourceInfo.thumbnail, isGroup);
137
- delete sourceInfo.thumbnail;
138
- }
139
- if (isGroup) {
140
- // Does the group contain groups?
141
- const groupIdsViaOptions = createOptions.subgroupIds || [];
142
- createOptions.itemIds = groupIdsViaOptions.concat(createOptions.itemIds || [], getSubgroupIds(sourceInfo.tags));
143
- }
144
- return createOptions;
145
- }
146
- /**
147
- * Update the createOptions with the thumbnail file
148
- *
149
- * @param createOptions
150
- * @param srcAuthentication
151
- * @private
152
- */
153
- export function _addThumbnailFileToCreateOptions(createOptions, srcAuthentication) {
154
- return new Promise((resolve) => {
155
- if (!createOptions.thumbnail && createOptions.thumbnailurl) {
156
- // Figure out the thumbnail's filename
157
- const filename = getFilenameFromUrl(createOptions.thumbnailurl) || "thumbnail";
158
- const thumbnailurl = appendQueryParam(createOptions.thumbnailurl, "w=400");
159
- delete createOptions.thumbnailurl;
160
- // Fetch the thumbnail
161
- getBlobAsFile(thumbnailurl, filename, srcAuthentication).then((thumbnail) => {
162
- createOptions.thumbnail = thumbnail;
163
- resolve(createOptions);
164
- }, () => {
165
- resolve(createOptions);
166
- });
167
- }
168
- else {
169
- resolve(createOptions);
170
- }
171
- });
172
- }
173
- /**
174
- * Creates a solution item using a list of AGO item ids.
175
- *
176
- * @param options Customizations for creating the solution
177
- * @param srcAuthentication Credentials for requests to source items
178
- * @param destAuthentication Credentials for the requests to destination solution
179
- * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its
180
- * there is a problem updating it
181
- * @private
182
- */
183
- export function _createSolutionFromItemIds(options, srcAuthentication, destAuthentication) {
184
- let solutionId = "";
185
- // Create a solution from the list of items
186
- return _createSolutionItem(destAuthentication, options)
187
- .then((id) => {
188
- solutionId = id;
189
- // Add list of items to the new solution
190
- return addContentToSolution(solutionId, options, srcAuthentication, destAuthentication);
191
- })
192
- .catch((addError) => {
193
- // If the solution item got created, delete it
194
- if (solutionId) {
195
- const failSafeRemove = failSafe(removeItem, { success: true });
196
- return failSafeRemove(solutionId, destAuthentication).then(() => {
197
- throw addError;
198
- });
199
- }
200
- else {
201
- throw addError;
202
- }
203
- });
204
- }
205
- /**
206
- * Creates an empty solution item.
207
- *
208
- * @param authentication Credentials for the request
209
- * @param options Customizations for creating the solution
210
- * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its
211
- * there is a problem updating its thumbnail
212
- * @private
213
- */
214
- export function _createSolutionItem(authentication, options) {
215
- const model = _createSolutionItemModel(options);
216
- // Create new solution item
217
- delete model.item.thumbnailurl;
218
- model.item.thumbnail = options?.thumbnail;
219
- return createItemWithData(model.item, model.data, authentication, options?.folderId).then((createResponse) => {
220
- return Promise.resolve(createResponse.id);
221
- });
222
- }
223
- /**
224
- * Create the Solution Item model to be used to create
225
- * the Solution Item itself
226
- *
227
- * @param options
228
- * @private
229
- */
230
- export function _createSolutionItemModel(options) {
231
- // Solution uses all supplied tags but for deploy.* tags; that information goes into properties
232
- const creationTags = options?.tags ?? [];
233
- const solutionItem = {
234
- type: "Solution",
235
- accessInformation: options?.accessInformation ?? "",
236
- title: options?.title ?? createShortId(),
237
- snippet: options?.snippet ?? "",
238
- description: options?.description ?? "",
239
- properties: options?.properties ?? {
240
- schemaVersion: CURRENT_SCHEMA_VERSION,
241
- },
242
- thumbnailurl: options?.thumbnailurl ?? "",
243
- tags: creationTags.filter((tag) => !tag.startsWith("deploy.")),
244
- typeKeywords: !options?.typeKeywords || !options.typeKeywords.some((keyword) => keyword.includes("solutionid"))
245
- ? ["Solution", "Template"].concat(_getDeploymentProperties(creationTags))
246
- : options.typeKeywords,
247
- categories: options?.categories ?? [],
248
- licenseInfo: options?.licenseInfo ?? "",
249
- };
250
- // ensure that snippet and description are not nefarious
251
- const sanitizedItem = sanitizeJSON(solutionItem);
252
- const addlKeywords = options?.additionalTypeKeywords || [];
253
- sanitizedItem.typeKeywords = [].concat(solutionItem.typeKeywords, addlKeywords);
254
- const solutionData = {
255
- metadata: {},
256
- templates: [],
257
- };
258
- return {
259
- item: sanitizedItem,
260
- data: solutionData,
261
- };
262
- }
263
- /**
264
- * Gets the deploy.id and deploy.version tag values.
265
- *
266
- * @param tags A list of item tags
267
- * @returns A list containing the two values found in the tags, or defaulting to a new GUID and "1.0", respectively,
268
- * as needed
269
- * @private
270
- */
271
- export function _getDeploymentProperties(tags) {
272
- return [
273
- "solutionid-" + (_getDeploymentProperty("deploy.id.", tags) ?? createLongId()),
274
- "solutionversion-" + (_getDeploymentProperty("deploy.version.", tags) ?? "1.0"),
275
- ];
276
- }
277
- /**
278
- * Searches for a tag that has the specified prefix and returns the rest of the tag following that prefix.
279
- *
280
- * @param desiredTagPrefix Tag prefix to look for
281
- * @param tags A list of item tags
282
- * @returns The extracted value of the first matching tag or null if a tag with the specified prefix is not found
283
- * @private
284
- */
285
- export function _getDeploymentProperty(desiredTagPrefix, tags) {
286
- const foundTagAsList = tags.filter((tag) => tag.startsWith(desiredTagPrefix));
287
- if (foundTagAsList.length > 0) {
288
- return foundTagAsList[0].substr(desiredTagPrefix.length);
289
- }
290
- else {
291
- return null;
292
- }
293
- }
294
- /**
295
- * Updates the createOptions based on rules with dealing with a deployed solution being re-templatized.
296
- *
297
- * @param sourceId AGO id of the deployed solution item
298
- * @param authentication Credentials for requests to source items
299
- * @param createOptions Customizations for creating the solution
300
- * @param itemBase the base information of the deployed solution item
301
- * @returns A promise that resolves with an updated createOptions
302
- */
303
- export async function _updateCreateOptionForReDeployedTemplate(sourceId, authentication, createOptions, itemBase) {
304
- const itemData = await getItemDataAsJson(sourceId, authentication);
305
- if (itemData) {
306
- const checkExistsList = [];
307
- //Check if any of the item ids is deleted, if so remove from the list
308
- for (const template of itemData.templates) {
309
- if (template.type === "Group") {
310
- checkExistsList.push(getGroup(template.itemId, { authentication: authentication }));
311
- }
312
- else {
313
- checkExistsList.push(getItem(template.itemId, { authentication: authentication }));
314
- }
315
- }
316
- const itemFetches = await Promise.allSettled(checkExistsList);
317
- //Add all valid items to createOptions items list
318
- createOptions.itemIds = itemFetches
319
- .filter((item) => item.status === "fulfilled")
320
- .map((item) => item.value.id);
321
- //check if any new groups were made and store in the tag
322
- const newGroups = itemBase.tags.filter((str) => str.includes("group.")).map((str) => str.split(".")[1]);
323
- if (newGroups.length > 0) {
324
- newGroups.forEach((groupId) => {
325
- // If id does not already exist, push it to createOptions, itemids list.
326
- if (!createOptions.itemIds.includes(groupId)) {
327
- createOptions.itemIds.push(groupId);
328
- }
329
- });
330
- }
331
- if (itemBase.ownerFolder) {
332
- //query the folder for new items
333
- const response = await searchItems({
334
- q: `ownerfolder:${itemBase.ownerFolder}`,
335
- authentication: authentication,
336
- num: 100,
337
- sortField: "modified",
338
- sortOrder: "desc",
339
- });
340
- response.results.forEach((result) => {
341
- // See if there are new items in the folder, if so add them to the itemIds
342
- if (!createOptions.itemIds.includes(result.id) && result.type !== "Solution") {
343
- createOptions.itemIds.push(result.id);
344
- }
345
- });
346
- }
347
- //switch thhe Deployed keyword to Template
348
- createOptions.typeKeywords = itemBase.typeKeywords;
349
- const deployedIndex = createOptions.typeKeywords.indexOf("Deployed");
350
- if (deployedIndex !== -1) {
351
- createOptions.typeKeywords[deployedIndex] = "Template";
352
- }
353
- //remove any tags with group. since it's now a new solution.
354
- createOptions.tags = itemBase.tags;
355
- createOptions.tags = itemBase.tags.filter((tag) => !tag.includes("group."));
356
- }
357
- else {
358
- console.error("Item data does not exists, returning create options");
359
- }
360
- return createOptions;
361
- }
362
- //# sourceMappingURL=creator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"creator.js","sourceRoot":"","sources":["../../src/creator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,sBAAsB,EACtB,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,OAAO,EACP,kBAAkB,EAClB,kBAAkB,EAKlB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,0BAA0B,GAE3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,uDAAuD;AACvD,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEtB;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,iBAA8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gC;YAChC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC;gBACjC,CAAC,EAAE,eAAe,QAAQ,CAAC,WAAW,EAAE;gBACxC,cAAc,EAAE,cAAc;gBAC9B,GAAG,EAAE,GAAG;gBACR,SAAS,EAAE,UAAU;gBACrB,SAAS,EAAE,MAAM;aAClB,CAAC,CAAC;YAEH,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBAClC,0EAA0E;gBAC1E,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE;oBAC5E,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;iBACvC;YACH,CAAC,CAAC,CAAC;SACJ;QAED,0CAA0C;QAC1C,aAAa,CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC;QACnD,MAAM,aAAa,GAAG,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QACrE,IAAI,aAAa,KAAK,CAAC,CAAC,EAAE;YACxB,aAAa,CAAC,YAAY,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC;SACxD;QAED,4DAA4D;QAC5D,aAAa,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QACnC,aAAa,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;KAC7E;SAAM;QACL,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;KACtE;IAED,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -1,159 +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 { ICreateSolutionOptions, IItemTemplate, TPossibleSourceFile, UserSession } from "@esri/solution-common";
17
- /**
18
- * Adds a list of AGO item ids to a solution item.
19
- *
20
- * @param solutionItemId AGO id of solution to receive items
21
- * @param options Customizations for creating the solution
22
- * @param srcAuthentication Credentials for requests to source items
23
- * @param destAuthentication Credentials for the requests to destination solution
24
- * @returns A promise that resolves with the AGO id of the updated solution
25
- * @internal
26
- */
27
- export declare function addContentToSolution(solutionItemId: string, options: ICreateSolutionOptions, srcAuthentication: UserSession, destAuthentication: UserSession): Promise<string>;
28
- /**
29
- * Gets the dependencies of an item by merging its dependencies list with item references in template variables.
30
- *
31
- * @param template Template to examine
32
- * @returns List of dependency ids
33
- * @private
34
- */
35
- export declare function _getDependencies(template: IItemTemplate): string[];
36
- /**
37
- * Extracts AGO ids out of template variables.
38
- *
39
- * @param variables List of template variables to examine
40
- * @returns List of AGO ids referenced in `variables`
41
- * @private
42
- */
43
- export declare function _getIdsOutOfTemplateVariables(variables: string[]): string[];
44
- /**
45
- * Fetches the organization's URL.
46
- *
47
- * @param destAuthentication Credentials for request organization info
48
- * @returns Promise resolving with the organization's URL
49
- * @private
50
- */
51
- export declare function _getOrgUrl(destAuthentication: UserSession): Promise<string>;
52
- /**
53
- * Creates a list of item URLs.
54
- *
55
- * @param templates Templates to check for URLs
56
- * @returns List of URLs
57
- * @private
58
- */
59
- export declare function _getSolutionItemUrls(templates: IItemTemplate[]): string[][];
60
- /**
61
- * Extracts template variables out of a string.
62
- *
63
- * @param text String to examine
64
- * @returns List of template variables found in string
65
- * @private
66
- */
67
- export declare function _getTemplateVariables(text: string): string[];
68
- /**
69
- * Update the items dependencies and groups arrays
70
- *
71
- * @param templates The array of templates to evaluate
72
- * @returns Updated version of the templates
73
- * @private
74
- */
75
- export declare function _postProcessGroupDependencies(templates: IItemTemplate[]): IItemTemplate[];
76
- /**
77
- * Check for feature service items that have been flagged for invalid designations.
78
- * Remove templates that have invalid designations from the solution item and other item dependencies.
79
- * Clean up any references to items with invalid designations in the other templates.
80
- *
81
- * @param templates The array of templates to evaluate
82
- * @param templateDictionary Hash of key details used for variable replacement
83
- * @returns Updated version of the templates
84
- * @private
85
- */
86
- export declare function _postProcessIgnoredItems(templates: IItemTemplate[], templateDictionary: any): IItemTemplate[];
87
- /**
88
- * Retrieves the Form dataFiles from a list of templates and removes them from the templates.
89
- *
90
- * @param templates Templates to be scanned and have their `dataFile` property deleted
91
- * @returns List of Form dataFiles from the templates, which have their `dataFile` property removed;
92
- * the list is in the same order as the templates and has `undefined` for templates that don't have a dataFile
93
- */
94
- export declare function _getDataFilesFromTemplates(templates: IItemTemplate[]): TPossibleSourceFile[];
95
- /**
96
- * Recursively runs through an object to find and replace any strings found in a dictionary.
97
- *
98
- * @param templateDictionary Hash of things to be replaced
99
- * @param obj Object to be examined
100
- * @private
101
- */
102
- export declare function _replaceDictionaryItemsInObject(hash: any, obj: any): any;
103
- /**
104
- * Recursively runs through an object to find and templatize any remaining references to solution's items.
105
- *
106
- * @param ids Ids to be replaced in strings found in object
107
- * @param obj Object to be examined
108
- * @private
109
- */
110
- export declare function _replaceRemainingIdsInObject(ids: string[], obj: any): any;
111
- /**
112
- * Templatizes ids from a list in a string if they're not already templatized.
113
- *
114
- * @param ids Ids to be replaced in source string
115
- * @param str Source string to be examined
116
- * @returns A copy of the source string with any templatization changes
117
- * @private
118
- */
119
- export declare function _replaceRemainingIdsInString(ids: string[], str: string): string;
120
- /**
121
- * Restores the Form dataFiles to the templates.
122
- *
123
- * @param templates Templates to be updated with the dataFiles; the `dataFile` property is added back to the templates
124
- * that originally had it
125
- * @param dataFiles List of Form dataFiles to be restored to the templates; the list is in the same order
126
- * as the templates and has `undefined` for templates that don't have a dataFile
127
- */
128
- export declare function _restoreDataFilesToTemplates(templates: IItemTemplate[], dataFiles: TPossibleSourceFile[]): void;
129
- /**
130
- * Finds and templatizes any URLs in solution items' descriptions.
131
- *
132
- * @param templates The array of templates to evaluate, modified in place
133
- * @private
134
- */
135
- export declare function _simplifyUrlsInItemDescriptions(templates: IItemTemplate[]): void;
136
- /**
137
- * Templatizes occurrences of the URL to the user's organization in the `item` and `data` template sections.
138
- *
139
- * @param templates The array of templates to evaluate; `templates` is modified in place
140
- * @param orgUrl The organization's URL
141
- * @returns Updated templates
142
- * @private
143
- */
144
- export declare function _templatizeOrgUrl(templates: IItemTemplate[], orgUrl: string): IItemTemplate[];
145
- /**
146
- * Finds and templatizes any references to solution's items.
147
- *
148
- * @param templates The array of templates to evaluate, modified in place
149
- * @private
150
- */
151
- export declare function _templatizeSolutionIds(templates: IItemTemplate[]): void;
152
- /**
153
- * Finds and templatizes any references to AGO ids in the workflow configuration.
154
- *
155
- * @param templates The array of templates whose workflow configurations are to be templatized; this array is
156
- * modified in place
157
- * @param templateDictionary Hash of key details used for variable replacement
158
- */
159
- export declare function _templatizeWorkflowConfig(templates: IItemTemplate[], templateDictionary: any): void;