@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.
@@ -1,97 +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 { ICreateSolutionOptions, IGroup, IItem, UserSession } from "@esri/solution-common";
22
- import { IModel } from "@esri/hub-common";
23
- /**
24
- * Creates a solution item.
25
- *
26
- * @param sourceId AGO id of group whose contents are to be added to solution or of an item to convert into a solution
27
- * @param srcAuthentication Credentials for requests to source items
28
- * @param destAuthentication Credentials for the requests to destination solution
29
- * @param options Customizations for creating the solution
30
- * @returns A promise that resolves with the AGO id of the new solution
31
- */
32
- export declare function createSolution(sourceId: string, srcAuthentication: UserSession, destAuthentication: UserSession, options?: ICreateSolutionOptions): Promise<string>;
33
- /**
34
- * Update the createOptions with the group properties
35
- *
36
- * @param createOptions
37
- * @param sourceInfo
38
- * @param authentication
39
- * @param isGroup Boolean to indicate if the files are associated with a group or item
40
- * @private
41
- */
42
- export declare function _applySourceToCreateOptions(createOptions: ICreateSolutionOptions, sourceInfo: IGroup | IItem, srcAuthentication: UserSession, isGroup?: boolean): ICreateSolutionOptions;
43
- /**
44
- * Update the createOptions with the thumbnail file
45
- *
46
- * @param createOptions
47
- * @param srcAuthentication
48
- * @private
49
- */
50
- export declare function _addThumbnailFileToCreateOptions(createOptions: ICreateSolutionOptions, srcAuthentication: UserSession): Promise<ICreateSolutionOptions>;
51
- /**
52
- * Creates a solution item using a list of AGO item ids.
53
- *
54
- * @param options Customizations for creating the solution
55
- * @param srcAuthentication Credentials for requests to source items
56
- * @param destAuthentication Credentials for the requests to destination solution
57
- * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its
58
- * there is a problem updating it
59
- * @private
60
- */
61
- export declare function _createSolutionFromItemIds(options: ICreateSolutionOptions, srcAuthentication: UserSession, destAuthentication: UserSession): Promise<string>;
62
- /**
63
- * Creates an empty solution item.
64
- *
65
- * @param authentication Credentials for the request
66
- * @param options Customizations for creating the solution
67
- * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its
68
- * there is a problem updating its thumbnail
69
- * @private
70
- */
71
- export declare function _createSolutionItem(authentication: UserSession, options?: ICreateSolutionOptions): Promise<string>;
72
- /**
73
- * Create the Solution Item model to be used to create
74
- * the Solution Item itself
75
- *
76
- * @param options
77
- * @private
78
- */
79
- export declare function _createSolutionItemModel(options: any): IModel;
80
- /**
81
- * Gets the deploy.id and deploy.version tag values.
82
- *
83
- * @param tags A list of item tags
84
- * @returns A list containing the two values found in the tags, or defaulting to a new GUID and "1.0", respectively,
85
- * as needed
86
- * @private
87
- */
88
- export declare function _getDeploymentProperties(tags: string[]): string[];
89
- /**
90
- * Searches for a tag that has the specified prefix and returns the rest of the tag following that prefix.
91
- *
92
- * @param desiredTagPrefix Tag prefix to look for
93
- * @param tags A list of item tags
94
- * @returns The extracted value of the first matching tag or null if a tag with the specified prefix is not found
95
- * @private
96
- */
97
- export declare function _getDeploymentProperty(desiredTagPrefix: string, tags: string[]): string | null;
@@ -1,284 +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
- exports._getDeploymentProperty = exports._getDeploymentProperties = exports._createSolutionItemModel = exports._createSolutionItem = exports._createSolutionFromItemIds = exports._addThumbnailFileToCreateOptions = exports._applySourceToCreateOptions = exports.createSolution = void 0;
19
- /**
20
- * Manages the creation of a Solution item.
21
- *
22
- * @module creator
23
- */
24
- const solution_common_1 = require("@esri/solution-common");
25
- const hub_common_1 = require("@esri/hub-common");
26
- const add_content_to_solution_1 = require("./helpers/add-content-to-solution");
27
- // Simple no-op to clean up progressCallback management
28
- const noOp = () => { };
29
- /**
30
- * Creates a solution item.
31
- *
32
- * @param sourceId AGO id of group whose contents are to be added to solution or of an item to convert into a solution
33
- * @param srcAuthentication Credentials for requests to source items
34
- * @param destAuthentication Credentials for the requests to destination solution
35
- * @param options Customizations for creating the solution
36
- * @returns A promise that resolves with the AGO id of the new solution
37
- */
38
- function createSolution(sourceId, srcAuthentication, destAuthentication, options) {
39
- const createOptions = options || {};
40
- const progressCb = createOptions.progressCallback || noOp;
41
- createOptions.templateDictionary = Object.assign({}, createOptions.templateDictionary);
42
- progressCb(1); // let the caller know that we've started
43
- // Assume that source is a group and try to get group's information
44
- return Promise.all([
45
- (0, solution_common_1.getGroupBase)(sourceId, srcAuthentication),
46
- (0, solution_common_1.getGroupContents)(sourceId, srcAuthentication),
47
- (0, solution_common_1.getVelocityUrlBase)(srcAuthentication, createOptions.templateDictionary)
48
- ])
49
- .then(
50
- // Group fetches worked; assumption was correct
51
- responses => {
52
- createOptions.itemIds = responses[1];
53
- progressCb(15);
54
- return new Promise(resolve => {
55
- // Update the createOptions with values from the group
56
- resolve(_applySourceToCreateOptions(createOptions, responses[0], srcAuthentication, true));
57
- });
58
- },
59
- // Assumption incorrect; try source as an item
60
- () => {
61
- return new Promise((resolve, reject) => {
62
- createOptions.itemIds = [sourceId];
63
- (0, solution_common_1.getItemBase)(sourceId, srcAuthentication).then(
64
- // Update the createOptions with values from the item
65
- itemBase => resolve(_applySourceToCreateOptions(createOptions, itemBase, srcAuthentication, false)), reject);
66
- });
67
- })
68
- .then(createOptions => {
69
- return new Promise((resolve, reject) => {
70
- Promise.all([
71
- (0, solution_common_1.getPortal)("", srcAuthentication),
72
- (0, solution_common_1.getUser)(srcAuthentication)
73
- ]).then(responses => {
74
- // check tracking
75
- const [portalResponse, userResponse] = responses;
76
- (0, solution_common_1.setLocationTrackingEnabled)(portalResponse, userResponse, createOptions.templateDictionary);
77
- resolve(createOptions);
78
- }, reject);
79
- });
80
- })
81
- .then(
82
- // Use a copy of the thumbnail rather than a URL to it
83
- createOptions => {
84
- return _addThumbnailFileToCreateOptions(createOptions, srcAuthentication);
85
- })
86
- .then(
87
- // Create a solution
88
- createOptions => {
89
- return _createSolutionFromItemIds(createOptions, srcAuthentication, destAuthentication);
90
- })
91
- .then(
92
- // Successfully created solution
93
- createdSolutionId => {
94
- progressCb(100); // finished
95
- return createdSolutionId;
96
- },
97
- // Error fetching group, group contents, or item, or error creating solution from ids
98
- error => {
99
- progressCb(1);
100
- console.error(error);
101
- throw error;
102
- });
103
- }
104
- exports.createSolution = createSolution;
105
- /**
106
- * Update the createOptions with the group properties
107
- *
108
- * @param createOptions
109
- * @param sourceInfo
110
- * @param authentication
111
- * @param isGroup Boolean to indicate if the files are associated with a group or item
112
- * @private
113
- */
114
- function _applySourceToCreateOptions(createOptions, sourceInfo, srcAuthentication, isGroup = false) {
115
- // Create a solution from the group's or item's contents,
116
- // using the group's or item's information as defaults for the solution item
117
- ["title", "snippet", "description", "tags"].forEach(prop => {
118
- createOptions[prop] = createOptions[prop] ?? sourceInfo[prop];
119
- });
120
- if (!createOptions.thumbnailurl && sourceInfo.thumbnail) {
121
- // Get the full path to the thumbnail
122
- createOptions.thumbnailurl = (0, solution_common_1.generateSourceThumbnailUrl)(srcAuthentication.portal, sourceInfo.id, sourceInfo.thumbnail, isGroup);
123
- delete sourceInfo.thumbnail;
124
- }
125
- if (isGroup) {
126
- // Does the group contain groups?
127
- const groupIdsViaOptions = createOptions.subgroupIds || [];
128
- createOptions.itemIds = groupIdsViaOptions.concat(createOptions.itemIds || [], (0, solution_common_1.getSubgroupIds)(sourceInfo.tags));
129
- }
130
- return createOptions;
131
- }
132
- exports._applySourceToCreateOptions = _applySourceToCreateOptions;
133
- /**
134
- * Update the createOptions with the thumbnail file
135
- *
136
- * @param createOptions
137
- * @param srcAuthentication
138
- * @private
139
- */
140
- function _addThumbnailFileToCreateOptions(createOptions, srcAuthentication) {
141
- return new Promise(resolve => {
142
- if (!createOptions.thumbnail && createOptions.thumbnailurl) {
143
- // Figure out the thumbnail's filename
144
- const filename = (0, solution_common_1.getFilenameFromUrl)(createOptions.thumbnailurl) || "thumbnail";
145
- const thumbnailurl = (0, solution_common_1.appendQueryParam)(createOptions.thumbnailurl, "w=400");
146
- delete createOptions.thumbnailurl;
147
- // Fetch the thumbnail
148
- (0, solution_common_1.getBlobAsFile)(thumbnailurl, filename, srcAuthentication).then(thumbnail => {
149
- createOptions.thumbnail = thumbnail;
150
- resolve(createOptions);
151
- }, () => {
152
- resolve(createOptions);
153
- });
154
- }
155
- else {
156
- resolve(createOptions);
157
- }
158
- });
159
- }
160
- exports._addThumbnailFileToCreateOptions = _addThumbnailFileToCreateOptions;
161
- /**
162
- * Creates a solution item using a list of AGO item ids.
163
- *
164
- * @param options Customizations for creating the solution
165
- * @param srcAuthentication Credentials for requests to source items
166
- * @param destAuthentication Credentials for the requests to destination solution
167
- * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its
168
- * there is a problem updating it
169
- * @private
170
- */
171
- function _createSolutionFromItemIds(options, srcAuthentication, destAuthentication) {
172
- let solutionId = "";
173
- // Create a solution from the list of items
174
- return _createSolutionItem(destAuthentication, options)
175
- .then(id => {
176
- solutionId = id;
177
- // Add list of items to the new solution
178
- return (0, add_content_to_solution_1.addContentToSolution)(solutionId, options, srcAuthentication, destAuthentication);
179
- })
180
- .catch(addError => {
181
- // If the solution item got created, delete it
182
- if (solutionId) {
183
- const failSafeRemove = (0, hub_common_1.failSafe)(solution_common_1.removeItem, { success: true });
184
- return failSafeRemove(solutionId, destAuthentication).then(() => {
185
- throw addError;
186
- });
187
- }
188
- else {
189
- throw addError;
190
- }
191
- });
192
- }
193
- exports._createSolutionFromItemIds = _createSolutionFromItemIds;
194
- /**
195
- * Creates an empty solution item.
196
- *
197
- * @param authentication Credentials for the request
198
- * @param options Customizations for creating the solution
199
- * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its
200
- * there is a problem updating its thumbnail
201
- * @private
202
- */
203
- function _createSolutionItem(authentication, options) {
204
- const model = _createSolutionItemModel(options);
205
- // Create new solution item
206
- delete model.item.thumbnailurl;
207
- model.item.thumbnail = options?.thumbnail;
208
- return (0, solution_common_1.createItemWithData)(model.item, model.data, authentication, options?.folderId).then(createResponse => {
209
- return Promise.resolve(createResponse.id);
210
- });
211
- }
212
- exports._createSolutionItem = _createSolutionItem;
213
- /**
214
- * Create the Solution Item model to be used to create
215
- * the Solution Item itself
216
- *
217
- * @param options
218
- * @private
219
- */
220
- function _createSolutionItemModel(options) {
221
- // Solution uses all supplied tags but for deploy.* tags; that information goes into properties
222
- const creationTags = options?.tags ?? [];
223
- const solutionItem = {
224
- type: "Solution",
225
- title: options?.title ?? (0, solution_common_1.createShortId)(),
226
- snippet: options?.snippet ?? "",
227
- description: options?.description ?? "",
228
- properties: {
229
- schemaVersion: solution_common_1.CURRENT_SCHEMA_VERSION
230
- },
231
- thumbnailurl: options?.thumbnailurl ?? "",
232
- tags: creationTags.filter((tag) => !tag.startsWith("deploy.")),
233
- typeKeywords: ["Solution", "Template"].concat(_getDeploymentProperties(creationTags))
234
- };
235
- // ensure that snippet and description are not nefarious
236
- const sanitizedItem = (0, solution_common_1.sanitizeJSON)(solutionItem);
237
- const addlKeywords = options?.additionalTypeKeywords || [];
238
- sanitizedItem.typeKeywords = [].concat(solutionItem.typeKeywords, addlKeywords);
239
- const solutionData = {
240
- metadata: {},
241
- templates: []
242
- };
243
- return {
244
- item: sanitizedItem,
245
- data: solutionData
246
- };
247
- }
248
- exports._createSolutionItemModel = _createSolutionItemModel;
249
- /**
250
- * Gets the deploy.id and deploy.version tag values.
251
- *
252
- * @param tags A list of item tags
253
- * @returns A list containing the two values found in the tags, or defaulting to a new GUID and "1.0", respectively,
254
- * as needed
255
- * @private
256
- */
257
- function _getDeploymentProperties(tags) {
258
- return [
259
- "solutionid-" +
260
- (_getDeploymentProperty("deploy.id.", tags) ?? (0, solution_common_1.createLongId)()),
261
- "solutionversion-" +
262
- (_getDeploymentProperty("deploy.version.", tags) ?? "1.0")
263
- ];
264
- }
265
- exports._getDeploymentProperties = _getDeploymentProperties;
266
- /**
267
- * Searches for a tag that has the specified prefix and returns the rest of the tag following that prefix.
268
- *
269
- * @param desiredTagPrefix Tag prefix to look for
270
- * @param tags A list of item tags
271
- * @returns The extracted value of the first matching tag or null if a tag with the specified prefix is not found
272
- * @private
273
- */
274
- function _getDeploymentProperty(desiredTagPrefix, tags) {
275
- const foundTagAsList = tags.filter(tag => tag.startsWith(desiredTagPrefix));
276
- if (foundTagAsList.length > 0) {
277
- return foundTagAsList[0].substr(desiredTagPrefix.length);
278
- }
279
- else {
280
- return null;
281
- }
282
- }
283
- exports._getDeploymentProperty = _getDeploymentProperty;
284
- //# 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,2DAwB+B;AAC/B,iDAAoD;AACpD,+EAAyE;AAEzE,uDAAuD;AACvD,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEtB;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAC5B,QAAgB,EAChB,iBAA8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8BAAY,EAAC,YAAY,CAAC,CAAC;IAEjD,MAAM,YAAY,GAAG,OAAO,EAAE,sBAAsB,IAAI,EAAE,CAAC;IAC3D,aAAa,CAAC,YAAY,GAAG,EAAE,CAAC,MAAM,CACpC,YAAY,CAAC,YAAY,EACzB,YAAY,CACb,CAAC;IAEF,MAAM,YAAY,GAAsB;QACtC,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE;KACd,CAAC;IACF,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,YAAY;KACnB,CAAC;AACJ,CAAC;AApCD,4DAoCC;AAED;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CAAC,IAAc;IACrD,OAAO;QACL,aAAa;YACX,CAAC,sBAAsB,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,IAAA,8BAAY,GAAE,CAAC;QAChE,kBAAkB;YAChB,CAAC,sBAAsB,CAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC;KAC7D,CAAC;AACJ,CAAC;AAPD,4DAOC;AAED;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CACpC,gBAAwB,EACxB,IAAc;IAEd,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC5E,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;QAC7B,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;KAC1D;SAAM;QACL,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAVD,wDAUC"}
@@ -1,126 +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, 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
- * Creates a list of item URLs.
46
- *
47
- * @param templates Templates to check for URLs
48
- * @returns List of URLs
49
- * @private
50
- */
51
- export declare function _getSolutionItemUrls(templates: IItemTemplate[]): string[][];
52
- /**
53
- * Extracts template variables out of a string.
54
- *
55
- * @param text String to examine
56
- * @returns List of template variables found in string
57
- * @private
58
- */
59
- export declare function _getTemplateVariables(text: string): string[];
60
- /**
61
- * Update the items dependencies and groups arrays
62
- *
63
- * @param templates The array of templates to evaluate
64
- * @returns Updated version of the templates
65
- * @private
66
- */
67
- export declare function _postProcessGroupDependencies(templates: IItemTemplate[]): IItemTemplate[];
68
- /**
69
- * Check for feature service items that have been flagged for invalid designations.
70
- * Remove templates that have invalid designations from the solution item and other item dependencies.
71
- * Clean up any references to items with invalid designations in the other templates.
72
- *
73
- * @param templates The array of templates to evaluate
74
- * @param templateDictionary Hash of key details used for variable replacement
75
- * @returns Updated version of the templates
76
- * @private
77
- */
78
- export declare function _postProcessIgnoredItems(templates: IItemTemplate[], templateDictionary: any): IItemTemplate[];
79
- /**
80
- * Recursively runs through an object to find and replace any strings found in a dictionary.
81
- *
82
- * @param templateDictionary Hash of things to be replaced
83
- * @param obj Object to be examined
84
- * @private
85
- */
86
- export declare function _replaceDictionaryItemsInObject(hash: any, obj: any): any;
87
- /**
88
- * Recursively runs through an object to find and templatize any remaining references to solution's items.
89
- *
90
- * @param ids Ids to be replaced in strings found in object
91
- * @param obj Object to be examined
92
- * @private
93
- */
94
- export declare function _replaceRemainingIdsInObject(ids: string[], obj: any): any;
95
- /**
96
- * Templatizes ids from a list in a string if they're not already templatized.
97
- *
98
- * @param ids Ids to be replaced in source string
99
- * @param str Source string to be examined
100
- * @returns A copy of the source string with any templatization changes
101
- * @private
102
- */
103
- export declare function _replaceRemainingIdsInString(ids: string[], str: string): string;
104
- /**
105
- * Finds and templatizes any URLs in solution items' descriptions.
106
- *
107
- * @param templates The array of templates to evaluate, modified in place
108
- * @private
109
- */
110
- export declare function _simplifyUrlsInItemDescriptions(templates: IItemTemplate[]): void;
111
- /**
112
- * Templatizes occurrences of the URL to the user's organization in the `item` and `data` template sections.
113
- *
114
- * @param templates The array of templates to evaluate; templates is modified in place
115
- * @param destAuthentication Credentials for request organization info
116
- * @returns Promise resolving with `templates`
117
- * @private
118
- */
119
- export declare function _templatizeOrgUrl(templates: IItemTemplate[], destAuthentication: UserSession): Promise<IItemTemplate[]>;
120
- /**
121
- * Finds and templatizes any references to solution's items.
122
- *
123
- * @param templates The array of templates to evaluate, modified in place
124
- * @private
125
- */
126
- export declare function _templatizeSolutionIds(templates: IItemTemplate[]): void;