@esri/solution-creator 0.24.0 → 1.1.4

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.
@@ -13,73 +13,86 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { __read, __spread } from "tslib";
17
16
  /**
18
17
  * Manages the creation of a Solution item.
19
18
  *
20
19
  * @module creator
21
20
  */
22
- import { appendQueryParam, createItemWithData, createLongId, createShortId, CURRENT_SCHEMA_VERSION, generateSourceThumbnailUrl, getBlobAsFile, getFilenameFromUrl, getGroupBase, getGroupContents, getItemBase, removeItem, sanitizeJSONAndReportChanges } from "@esri/solution-common";
21
+ import { appendQueryParam, createItemWithData, createLongId, createShortId, CURRENT_SCHEMA_VERSION, generateSourceThumbnailUrl, getBlobAsFile, getFilenameFromUrl, getGroupBase, getGroupContents, getItemBase, getPortal, getUser, getVelocityUrlBase, removeItem, sanitizeJSONAndReportChanges, setLocationTrackingEnabled } from "@esri/solution-common";
23
22
  import { failSafe } from "@esri/hub-common";
24
23
  import { addContentToSolution } from "./helpers/add-content-to-solution";
25
24
  // Simple no-op to clean up progressCallback management
26
- var noOp = function () { };
25
+ const noOp = () => { };
27
26
  /**
28
27
  * Creates a solution item.
29
28
  *
30
29
  * @param sourceId AGO id of group whose contents are to be added to solution or of an item to convert into a solution
31
- * @param authentication Credentials for the request
30
+ * @param srcAuthentication Credentials for requests to source items
31
+ * @param destAuthentication Credentials for the requests to destination solution
32
32
  * @param options Customizations for creating the solution
33
33
  * @return A promise that resolves with the AGO id of the new solution
34
34
  */
35
- export function createSolution(sourceId, authentication, options) {
36
- var createOptions = options || {};
37
- var progressCb = createOptions.progressCallback || noOp;
35
+ export function createSolution(sourceId, srcAuthentication, destAuthentication, options) {
36
+ const createOptions = options || {};
37
+ const progressCb = createOptions.progressCallback || noOp;
38
+ createOptions.templateDictionary = Object.assign({}, createOptions.templateDictionary);
38
39
  progressCb(1); // let the caller know that we've started
39
40
  // Assume that source is a group and try to get group's information
40
41
  return Promise.all([
41
- getGroupBase(sourceId, authentication),
42
- getGroupContents(sourceId, authentication)
42
+ getGroupBase(sourceId, srcAuthentication),
43
+ getGroupContents(sourceId, srcAuthentication),
44
+ getVelocityUrlBase(srcAuthentication, createOptions.templateDictionary)
43
45
  ])
44
46
  .then(
45
47
  // Group fetches worked; assumption was correct
46
- function (responses) {
48
+ responses => {
47
49
  createOptions.itemIds = responses[1];
48
50
  progressCb(15);
49
- return new Promise(function (resolve) {
51
+ return new Promise(resolve => {
50
52
  // Update the createOptions with values from the group
51
- resolve(_applySourceToCreateOptions(createOptions, responses[0], authentication, true));
53
+ resolve(_applySourceToCreateOptions(createOptions, responses[0], srcAuthentication, true));
52
54
  });
53
55
  },
54
56
  // Assumption incorrect; try source as an item
55
- function () {
56
- return new Promise(function (resolve, reject) {
57
+ () => {
58
+ return new Promise((resolve, reject) => {
57
59
  createOptions.itemIds = [sourceId];
58
- getItemBase(sourceId, authentication).then(
60
+ getItemBase(sourceId, srcAuthentication).then(
59
61
  // Update the createOptions with values from the item
60
- function (itemBase) {
61
- return resolve(_applySourceToCreateOptions(createOptions, itemBase, authentication, false));
62
+ itemBase => resolve(_applySourceToCreateOptions(createOptions, itemBase, srcAuthentication, false)), reject);
63
+ });
64
+ })
65
+ .then(createOptions => {
66
+ return new Promise((resolve, reject) => {
67
+ Promise.all([
68
+ getPortal("", srcAuthentication),
69
+ getUser(srcAuthentication)
70
+ ]).then(responses => {
71
+ // check tracking
72
+ const [portalResponse, userResponse] = responses;
73
+ setLocationTrackingEnabled(portalResponse, userResponse, createOptions.templateDictionary);
74
+ resolve(createOptions);
62
75
  }, reject);
63
76
  });
64
77
  })
65
78
  .then(
66
79
  // Use a copy of the thumbnail rather than a URL to it
67
- function (createOptions) {
68
- return _addThumbnailFileToCreateOptions(createOptions, authentication);
80
+ createOptions => {
81
+ return _addThumbnailFileToCreateOptions(createOptions, srcAuthentication);
69
82
  })
70
83
  .then(
71
84
  // Create a solution
72
- function (createOptions) {
73
- return _createSolutionFromItemIds(createOptions, authentication);
85
+ createOptions => {
86
+ return _createSolutionFromItemIds(createOptions, srcAuthentication, destAuthentication);
74
87
  })
75
88
  .then(
76
89
  // Successfully created solution
77
- function (createdSolutionId) {
90
+ createdSolutionId => {
78
91
  progressCb(100); // finished
79
92
  return createdSolutionId;
80
93
  },
81
94
  // Error fetching group, group contents, or item, or error creating solution from ids
82
- function (error) {
95
+ error => {
83
96
  progressCb(1);
84
97
  console.error(error);
85
98
  throw error;
@@ -94,17 +107,15 @@ export function createSolution(sourceId, authentication, options) {
94
107
  * @param isGroup Boolean to indicate if the files are associated with a group or item
95
108
  * @internal
96
109
  */
97
- export function _applySourceToCreateOptions(createOptions, sourceInfo, authentication, isGroup) {
98
- if (isGroup === void 0) { isGroup = false; }
110
+ export function _applySourceToCreateOptions(createOptions, sourceInfo, srcAuthentication, isGroup = false) {
99
111
  // Create a solution from the group's or item's contents,
100
112
  // using the group's or item's information as defaults for the solution item
101
- ["title", "snippet", "description", "tags"].forEach(function (prop) {
102
- var _a;
103
- createOptions[prop] = (_a = createOptions[prop]) !== null && _a !== void 0 ? _a : sourceInfo[prop];
113
+ ["title", "snippet", "description", "tags"].forEach(prop => {
114
+ createOptions[prop] = createOptions[prop] ?? sourceInfo[prop];
104
115
  });
105
116
  if (!createOptions.thumbnailurl && sourceInfo.thumbnail) {
106
117
  // Get the full path to the thumbnail
107
- createOptions.thumbnailurl = generateSourceThumbnailUrl(authentication.portal, sourceInfo.id, sourceInfo.thumbnail, isGroup);
118
+ createOptions.thumbnailurl = generateSourceThumbnailUrl(srcAuthentication.portal, sourceInfo.id, sourceInfo.thumbnail, isGroup);
108
119
  delete sourceInfo.thumbnail;
109
120
  }
110
121
  return createOptions;
@@ -113,21 +124,21 @@ export function _applySourceToCreateOptions(createOptions, sourceInfo, authentic
113
124
  * Update the createOptions with the thumbnail file
114
125
  *
115
126
  * @param createOptions
116
- * @param authentication
127
+ * @param srcAuthentication
117
128
  * @internal
118
129
  */
119
- export function _addThumbnailFileToCreateOptions(createOptions, authentication) {
120
- return new Promise(function (resolve) {
130
+ export function _addThumbnailFileToCreateOptions(createOptions, srcAuthentication) {
131
+ return new Promise(resolve => {
121
132
  if (!createOptions.thumbnail && createOptions.thumbnailurl) {
122
133
  // Figure out the thumbnail's filename
123
- var filename = getFilenameFromUrl(createOptions.thumbnailurl) || "thumbnail";
124
- var thumbnailurl = appendQueryParam(createOptions.thumbnailurl, "w=400");
134
+ const filename = getFilenameFromUrl(createOptions.thumbnailurl) || "thumbnail";
135
+ const thumbnailurl = appendQueryParam(createOptions.thumbnailurl, "w=400");
125
136
  delete createOptions.thumbnailurl;
126
137
  // Fetch the thumbnail
127
- getBlobAsFile(thumbnailurl, filename, authentication).then(function (thumbnail) {
138
+ getBlobAsFile(thumbnailurl, filename, srcAuthentication).then(thumbnail => {
128
139
  createOptions.thumbnail = thumbnail;
129
140
  resolve(createOptions);
130
- }, function () {
141
+ }, () => {
131
142
  resolve(createOptions);
132
143
  });
133
144
  }
@@ -140,25 +151,26 @@ export function _addThumbnailFileToCreateOptions(createOptions, authentication)
140
151
  * Creates a solution item using a list of AGO item ids.
141
152
  *
142
153
  * @param options Customizations for creating the solution
143
- * @param authentication Credentials for the request
154
+ * @param srcAuthentication Credentials for requests to source items
155
+ * @param destAuthentication Credentials for the requests to destination solution
144
156
  * @return A promise that resolves with the AGO id of the new solution; solution item is deleted if its
145
157
  * there is a problem updating it
146
158
  * @internal
147
159
  */
148
- export function _createSolutionFromItemIds(options, authentication) {
149
- var solutionId = "";
160
+ export function _createSolutionFromItemIds(options, srcAuthentication, destAuthentication) {
161
+ let solutionId = "";
150
162
  // Create a solution from the list of items
151
- return _createSolutionItem(authentication, options)
152
- .then(function (id) {
163
+ return _createSolutionItem(destAuthentication, options)
164
+ .then(id => {
153
165
  solutionId = id;
154
166
  // Add list of items to the new solution
155
- return addContentToSolution(solutionId, options, authentication);
167
+ return addContentToSolution(solutionId, options, srcAuthentication, destAuthentication);
156
168
  })
157
- .catch(function (addError) {
169
+ .catch(addError => {
158
170
  // If the solution item got created, delete it
159
171
  if (solutionId) {
160
- var failSafeRemove = failSafe(removeItem, { success: true });
161
- return failSafeRemove(solutionId, authentication).then(function () {
172
+ const failSafeRemove = failSafe(removeItem, { success: true });
173
+ return failSafeRemove(solutionId, destAuthentication).then(() => {
162
174
  throw addError;
163
175
  });
164
176
  }
@@ -177,16 +189,12 @@ export function _createSolutionFromItemIds(options, authentication) {
177
189
  * @internal
178
190
  */
179
191
  export function _createSolutionItem(authentication, options) {
180
- return new Promise(function (resolve, reject) {
181
- var model = _createSolutionItemModel(options);
182
- // Create new solution item
183
- delete model.item.thumbnailurl;
184
- model.item.thumbnail = options === null || options === void 0 ? void 0 : options.thumbnail;
185
- createItemWithData(model.item, model.data, authentication, options === null || options === void 0 ? void 0 : options.folderId).then(function (createResponse) {
186
- resolve(createResponse.id);
187
- }, function (err) {
188
- reject(err);
189
- });
192
+ const model = _createSolutionItemModel(options);
193
+ // Create new solution item
194
+ delete model.item.thumbnailurl;
195
+ model.item.thumbnail = options?.thumbnail;
196
+ return createItemWithData(model.item, model.data, authentication, options?.folderId).then(createResponse => {
197
+ return Promise.resolve(createResponse.id);
190
198
  });
191
199
  }
192
200
  /**
@@ -197,26 +205,25 @@ export function _createSolutionItem(authentication, options) {
197
205
  * @internal
198
206
  */
199
207
  export function _createSolutionItemModel(options) {
200
- var _a, _b, _c, _d, _e;
201
208
  // Solution uses all supplied tags but for deploy.* tags; that information goes into properties
202
- var creationTags = (_a = options === null || options === void 0 ? void 0 : options.tags) !== null && _a !== void 0 ? _a : [];
203
- var solutionItem = {
209
+ const creationTags = options?.tags ?? [];
210
+ const solutionItem = {
204
211
  type: "Solution",
205
- title: (_b = options === null || options === void 0 ? void 0 : options.title) !== null && _b !== void 0 ? _b : createShortId(),
206
- snippet: (_c = options === null || options === void 0 ? void 0 : options.snippet) !== null && _c !== void 0 ? _c : "",
207
- description: (_d = options === null || options === void 0 ? void 0 : options.description) !== null && _d !== void 0 ? _d : "",
212
+ title: options?.title ?? createShortId(),
213
+ snippet: options?.snippet ?? "",
214
+ description: options?.description ?? "",
208
215
  properties: {
209
216
  schemaVersion: CURRENT_SCHEMA_VERSION
210
217
  },
211
- thumbnailurl: (_e = options === null || options === void 0 ? void 0 : options.thumbnailurl) !== null && _e !== void 0 ? _e : "",
212
- tags: creationTags.filter(function (tag) { return !tag.startsWith("deploy."); }),
218
+ thumbnailurl: options?.thumbnailurl ?? "",
219
+ tags: creationTags.filter((tag) => !tag.startsWith("deploy.")),
213
220
  typeKeywords: ["Solution", "Template"].concat(_getDeploymentProperties(creationTags))
214
221
  };
215
222
  // ensure that snippet and description are not nefarious
216
- var sanitizedItem = sanitizeJSONAndReportChanges(solutionItem);
217
- var addlKeywords = (options === null || options === void 0 ? void 0 : options.additionalTypeKeywords) || [];
218
- sanitizedItem.typeKeywords = __spread(solutionItem.typeKeywords, addlKeywords);
219
- var solutionData = {
223
+ const sanitizedItem = sanitizeJSONAndReportChanges(solutionItem);
224
+ const addlKeywords = options?.additionalTypeKeywords || [];
225
+ sanitizedItem.typeKeywords = [].concat(solutionItem.typeKeywords, addlKeywords);
226
+ const solutionData = {
220
227
  metadata: {},
221
228
  templates: []
222
229
  };
@@ -229,17 +236,16 @@ export function _createSolutionItemModel(options) {
229
236
  * Gets the deploy.id and deploy.version tag values.
230
237
  *
231
238
  * @param tags A list of item tags
232
- * @return A list ocntaining the two values found in the tags, or defaulting to a new GUID and "1.0", respectively,
239
+ * @return A list containing the two values found in the tags, or defaulting to a new GUID and "1.0", respectively,
233
240
  * as needed
234
241
  * @internal
235
242
  */
236
243
  export function _getDeploymentProperties(tags) {
237
- var _a, _b;
238
244
  return [
239
245
  "solutionid-" +
240
- ((_a = _getDeploymentProperty("deploy.id.", tags)) !== null && _a !== void 0 ? _a : createLongId()),
246
+ (_getDeploymentProperty("deploy.id.", tags) ?? createLongId()),
241
247
  "solutionversion-" +
242
- ((_b = _getDeploymentProperty("deploy.version.", tags)) !== null && _b !== void 0 ? _b : "1.0")
248
+ (_getDeploymentProperty("deploy.version.", tags) ?? "1.0")
243
249
  ];
244
250
  }
245
251
  /**
@@ -251,7 +257,7 @@ export function _getDeploymentProperties(tags) {
251
257
  * @internal
252
258
  */
253
259
  export function _getDeploymentProperty(desiredTagPrefix, tags) {
254
- var foundTagAsList = tags.filter(function (tag) { return tag.startsWith(desiredTagPrefix); });
260
+ const foundTagAsList = tags.filter(tag => tag.startsWith(desiredTagPrefix));
255
261
  if (foundTagAsList.length > 0) {
256
262
  return foundTagAsList[0].substr(desiredTagPrefix.length);
257
263
  }
@@ -1 +1 @@
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,YAAY,EACZ,gBAAgB,EAChB,WAAW,EAKX,UAAU,EACV,4BAA4B,EAE7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAU,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,uDAAuD;AACvD,IAAM,IAAI,GAAG,cAAO,CAAC,CAAC;AAEtB;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,cAA2B,EAC3B,OAAgC;IAEhC,IAAM,aAAa,GAA2B,OAAO,IAAI,EAAE,CAAC;IAC5D,IAAM,UAAU,GAAG,aAAa,CAAC,gBAAgB,IAAI,IAAI,CAAC;IAE1D,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,yCAAyC;IAExD,mEAAmE;IACnE,OAAO,OAAO,CAAC,GAAG,CAAC;QACjB,YAAY,CAAC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4BAA4B,CAAC,YAAY,CAAC,CAAC;IAEjE,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;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAc;IACrD,OAAO;QACL,aAAa;YACX,CAAC,sBAAsB,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,YAAY,EAAE,CAAC;QAChE,kBAAkB;YAChB,CAAC,sBAAsB,CAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC;KAC7D,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,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"}
@@ -19,11 +19,12 @@ import { ICreateSolutionOptions, IItemTemplate, UserSession } from "@esri/soluti
19
19
  *
20
20
  * @param solutionItemId AGO id of solution to receive items
21
21
  * @param options Customizations for creating the solution
22
- * @param authentication Credentials for the request
22
+ * @param srcAuthentication Credentials for requests to source items
23
+ * @param destAuthentication Credentials for the requests to destination solution
23
24
  * @return A promise that resolves with the AGO id of the updated solution
24
25
  * @internal
25
26
  */
26
- export declare function addContentToSolution(solutionItemId: string, options: ICreateSolutionOptions, authentication: UserSession): Promise<string>;
27
+ export declare function addContentToSolution(solutionItemId: string, options: ICreateSolutionOptions, srcAuthentication: UserSession, destAuthentication: UserSession): Promise<string>;
27
28
  /**
28
29
  * Gets the dependencies of an item by merging its dependencies list with item references in template variables.
29
30
  *
@@ -110,11 +111,11 @@ export declare function _simplifyUrlsInItemDescriptions(templates: IItemTemplate
110
111
  * Templatizes occurrences of the URL to the user's organization in the `item` and `data` template sections.
111
112
  *
112
113
  * @param templates The array of templates to evaluate; templates is modified in place
113
- * @param authentication Credentials for request organization info
114
+ * @param destAuthentication Credentials for request organization info
114
115
  * @return Promise resolving with `templates`
115
116
  * @private
116
117
  */
117
- export declare function _templatizeOrgUrl(templates: IItemTemplate[], authentication: UserSession): Promise<IItemTemplate[]>;
118
+ export declare function _templatizeOrgUrl(templates: IItemTemplate[], destAuthentication: UserSession): Promise<IItemTemplate[]>;
118
119
  /**
119
120
  * Finds and templatizes any references to solution's items.
120
121
  *