@esri/solution-file 1.2.0 → 1.3.2

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/dist/esm/file.js CHANGED
@@ -58,10 +58,9 @@ export function convertItemToTemplate(solutionItemId, itemInfo, destAuthenticati
58
58
  if (itemDataResponse) {
59
59
  const resource = common.convertBlobToSupportableResource(itemDataResponse, itemTemplate.item.name);
60
60
  itemTemplate.properties[resource.filename] = resource.mimeType;
61
- const storageName = common.convertItemResourceToStorageResource(itemTemplate.itemId +
62
- (resource.blob.name === resource.filename
63
- ? "_info_data"
64
- : "_info_dataz"), resource.blob.name, common.SolutionTemplateFormatVersion);
61
+ const storageName = common.convertItemResourceToStorageResource(itemTemplate.itemId, resource.blob.name, common.SolutionTemplateFormatVersion, (resource.blob.name === resource.filename
62
+ ? common.SolutionResourceType.data
63
+ : common.SolutionResourceType.fakezip));
65
64
  common
66
65
  .addResourceFromBlob(resource.blob, solutionItemId, storageName.folder, storageName.filename, destAuthentication)
67
66
  .then(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,wHAAwH;AAExH;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC;IAErC,OAAO,IAAI,OAAO,CAAuB,OAAO,CAAC,EAAE;QACjD,gBAAgB;QAChB,MAAM,YAAY,GAAyB,MAAM,CAAC,6BAA6B,CAC7E,QAAQ,CACT,CAAC;QAEF,uCAAuC;QACvC,YAAY,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,cAAc,CAC1C,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,SAAS,CACV,CA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CAAC,mBAAmB,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;YACF,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,uBAAuB;QACvF,CAAC,CACF,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/node/file.js CHANGED
@@ -16,12 +16,13 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.createItemFromTemplate = exports.convertItemToTemplate = void 0;
19
+ const tslib_1 = require("tslib");
19
20
  /**
20
21
  * Manages the creation and deployment of item types that contain files.
21
22
  *
22
23
  * @module file
23
24
  */
24
- const common = require("@esri/solution-common");
25
+ const common = (0, tslib_1.__importStar)(require("@esri/solution-common"));
25
26
  // ------------------------------------------------------------------------------------------------------------------ //
26
27
  /**
27
28
  * Converts a file item into a template.
@@ -61,10 +62,9 @@ function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, src
61
62
  if (itemDataResponse) {
62
63
  const resource = common.convertBlobToSupportableResource(itemDataResponse, itemTemplate.item.name);
63
64
  itemTemplate.properties[resource.filename] = resource.mimeType;
64
- const storageName = common.convertItemResourceToStorageResource(itemTemplate.itemId +
65
- (resource.blob.name === resource.filename
66
- ? "_info_data"
67
- : "_info_dataz"), resource.blob.name, common.SolutionTemplateFormatVersion);
65
+ const storageName = common.convertItemResourceToStorageResource(itemTemplate.itemId, resource.blob.name, common.SolutionTemplateFormatVersion, (resource.blob.name === resource.filename
66
+ ? common.SolutionResourceType.data
67
+ : common.SolutionResourceType.fakezip));
68
68
  common
69
69
  .addResourceFromBlob(resource.blob, solutionItemId, storageName.folder, storageName.filename, destAuthentication)
70
70
  .then(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/file.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH;;;;GAIG;AAEH,gDAAgD;AAEhD,wHAAwH;AAExH;;;;;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oB,CAClB,QAAQ,CAAC,MAAM,EACf,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EACnC,QAAQ,CAAC,6BAA6B,GAAG,CAAC,EAC1C,cAAc,CAAC,EAAE,CAClB,CAAC;gBAEF,OAAO,CAAC;oBACN,IAAI,EAAE,eAAe;oBACrB,EAAE,EAAE,cAAc,CAAC,EAAE;oBACrB,IAAI,EAAE,eAAe,CAAC,IAAI;oBAC1B,WAAW,EAAE,KAAK;iBACnB,CAAC,CAAC;aACJ;QACH,CAAC,EACD,GAAG,EAAE;YACH,oBAAoB,CAClB,QAAQ,CAAC,MAAM,EACf,MAAM,CAAC,mBAAmB,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;YACF,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,uBAAuB;QACvF,CAAC,CACF,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC;AAnGD,wDAmGC"}
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-file - v1.2.0 - Apache-2.0
3
- * Copyright (c) 2018-2021 Esri, Inc.
4
- * Thu Dec 09 2021 16:02:16 GMT-0800 (Pacific Standard Time)
2
+ * @esri/solution-file - v1.3.2 - Apache-2.0
3
+ * Copyright (c) 2018-2022 Esri, Inc.
4
+ * Thu Mar 03 2022 14:34:56 GMT-0800 (Pacific Standard Time)
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -95,10 +95,9 @@
95
95
  if (itemDataResponse) {
96
96
  const resource = common__namespace.convertBlobToSupportableResource(itemDataResponse, itemTemplate.item.name);
97
97
  itemTemplate.properties[resource.filename] = resource.mimeType;
98
- const storageName = common__namespace.convertItemResourceToStorageResource(itemTemplate.itemId +
99
- (resource.blob.name === resource.filename
100
- ? "_info_data"
101
- : "_info_dataz"), resource.blob.name, common__namespace.SolutionTemplateFormatVersion);
98
+ const storageName = common__namespace.convertItemResourceToStorageResource(itemTemplate.itemId, resource.blob.name, common__namespace.SolutionTemplateFormatVersion, (resource.blob.name === resource.filename
99
+ ? common__namespace.SolutionResourceType.data
100
+ : common__namespace.SolutionResourceType.fakezip));
102
101
  common__namespace
103
102
  .addResourceFromBlob(resource.blob, solutionItemId, storageName.folder, storageName.filename, destAuthentication)
104
103
  .then(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"file.umd.js","sources":["../../src/file.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of item types that contain files.\r\n *\r\n * @module file\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Converts a file item into a template.\r\n *\r\n * @param solutionItemId The solution to contain the template\r\n * @param itemInfo Info about the item\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @return A promise that will resolve when the template has been created\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: common.UserSession,\r\n srcAuthentication: common.UserSession\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>(resolve => {\r\n // Init template\r\n const itemTemplate: common.IItemTemplate = common.createInitializedItemTemplate(\r\n itemInfo\r\n );\r\n\r\n // Templatize item info property values\r\n itemTemplate.item.id = common.templatizeTerm(\r\n itemTemplate.item.id,\r\n itemTemplate.item.id,\r\n \".itemId\"\r\n );\r\n\r\n // Request file\r\n const dataPromise = new Promise<File>(dataResolve => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .getItemDataAsFile(\r\n itemTemplate.itemId,\r\n itemTemplate.item.name,\r\n srcAuthentication\r\n )\r\n .then(response => {\r\n if (!response || response.size === 0) {\r\n dataResolve(null);\r\n } else {\r\n dataResolve(response);\r\n }\r\n });\r\n });\r\n\r\n // Request related items\r\n const relatedPromise = Promise.resolve(\r\n {} as common.IGetRelatedItemsResponse\r\n );\r\n\r\n // Errors are handled as resolved empty values; this means that there's no `reject` clause to handle, hence:\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all([dataPromise, relatedPromise]).then(responses => {\r\n const [itemDataResponse] = responses;\r\n\r\n if (itemDataResponse) {\r\n const resource: common.IFileMimeTyped = common.convertBlobToSupportableResource(\r\n itemDataResponse,\r\n itemTemplate.item.name\r\n );\r\n itemTemplate.properties[resource.filename] = resource.mimeType;\r\n\r\n const storageName = common.convertItemResourceToStorageResource(\r\n itemTemplate.itemId +\r\n ((resource.blob as File).name === resource.filename\r\n ? \"_info_data\"\r\n : \"_info_dataz\"),\r\n (resource.blob as File).name,\r\n common.SolutionTemplateFormatVersion\r\n );\r\n common\r\n .addResourceFromBlob(\r\n resource.blob,\r\n solutionItemId,\r\n storageName.folder,\r\n storageName.filename,\r\n destAuthentication\r\n )\r\n .then(\r\n () => {\r\n itemTemplate.resources.push(\r\n storageName.folder + \"/\" + storageName.filename\r\n );\r\n resolve(itemTemplate);\r\n },\r\n error => {\r\n itemTemplate.properties[\"error\"] = JSON.stringify(error);\r\n resolve(itemTemplate);\r\n }\r\n );\r\n } else {\r\n resolve(itemTemplate);\r\n }\r\n });\r\n });\r\n}\r\n\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Started,\r\n 0\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Ignored,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n return;\r\n }\r\n\r\n // Replace the templatized symbols in a copy of the template\r\n let newItemTemplate: common.IItemTemplate = common.cloneObject(template);\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n /* istanbul ignore else */\r\n if (template.item.thumbnail) {\r\n newItemTemplate.item.thumbnail = template.item.thumbnail;\r\n }\r\n\r\n // Create the item, then update its URL with its new id\r\n common\r\n .createItemWithData(\r\n newItemTemplate.item,\r\n newItemTemplate.data,\r\n destinationAuthentication,\r\n templateDictionary.folderId\r\n )\r\n .then(\r\n createResponse => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(createResponse.id, destinationAuthentication)\r\n .then(\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type)),\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type))\r\n );\r\n } else {\r\n // Add the new item to the settings\r\n newItemTemplate.itemId = createResponse.id;\r\n templateDictionary[template.itemId] = {\r\n itemId: createResponse.id\r\n };\r\n\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.id\r\n );\r\n\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.id,\r\n type: newItemTemplate.type,\r\n postProcess: false\r\n });\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n );\r\n });\r\n}\r\n"],"names":["common"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;EAwBA;EAEA;;;;;;;;;WASgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC;MAErC,OAAO,IAAI,OAAO,CAAuB,OAAO;;UAE9C,MAAM,YAAY,GAAyBA,iBAAM,CAAC,6BAA6B,CAC7E,QAAQ,CACT,CAAC;;UAGF,YAAY,CAAC,IAAI,CAAC,EAAE,GAAGA,iBAAM,CAAC,cAAc,CAC1C,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,SAAS,CACV,CAAC;;UAGF,MAAM,WAAW,GAAG,IAAI,OAAO,CAAO,WAAW;;cAE/CA,iBAAM;mBACH,iBAAiB,CAChB,YAAY,CAAC,MAAM,EACnB,YAAY,CAAC,IAAI,CAAC,IAAI,EACtB,iBAAiB,CAClB;mBACA,IAAI,CAAC,QAAQ;kBACZ,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,EAAE;sBACpC,WAAW,CAAC,IAAI,CAAC,CAAC;mBACnB;uBAAM;sBACL,WAAW,CAAC,QAAQ,CAAC,CAAC;mBACvB;eACF,CAAC,CAAC;WACN,CAAC,CAAC;;UAGH,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CACpC,EAAqC,CACtC,CAAC;;;UAIF,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS;cACvD,MAAM,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;cAErC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AAM,GAAG,cAAc,CAAC,EAAE,CAAC;kBAC3C,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG;sBACpC,MAAM,EAAE,cAAc,CAAC,EAAE;mBAC1B,CAAC;kBAEF,oBAAoB,CAClB,QAAQ,CAAC,MAAM,EACfA,iBAAM,CAAC,mBAAmB,CAAC,QAAQ,EACnC,QAAQ,CAAC,6BAA6B,GAAG,CAAC,EAC1C,cAAc,CAAC,EAAE,CAClB,CAAC;kBAEF,OAAO,CAAC;sBACN,IAAI,EAAE,eAAe;sBACrB,EAAE,EAAE,cAAc,CAAC,EAAE;sBACrB,IAAI,EAAE,eAAe,CAAC,IAAI;sBAC1B,WAAW,EAAE,KAAK;mBACnB,CAAC,CAAC;eACJ;WACF,EACD;cACE,oBAAoB,CAClB,QAAQ,CAAC,MAAM,EACfA,iBAAM,CAAC,mBAAmB,CAAC,MAAM,EACjC,CAAC,CACF,CAAC;cACF,OAAO,CAACA,iBAAM,CAAC,6BAA6B,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;WAC9D,CACF,CAAC;OACL,CAAC,CAAC;EACL;;;;;;;;;;;"}
1
+ {"version":3,"file":"file.umd.js","sources":["../../src/file.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of item types that contain files.\r\n *\r\n * @module file\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Converts a file item into a template.\r\n *\r\n * @param solutionItemId The solution to contain the template\r\n * @param itemInfo Info about the item\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @return A promise that will resolve when the template has been created\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: common.UserSession,\r\n srcAuthentication: common.UserSession\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>(resolve => {\r\n // Init template\r\n const itemTemplate: common.IItemTemplate = common.createInitializedItemTemplate(\r\n itemInfo\r\n );\r\n\r\n // Templatize item info property values\r\n itemTemplate.item.id = common.templatizeTerm(\r\n itemTemplate.item.id,\r\n itemTemplate.item.id,\r\n \".itemId\"\r\n );\r\n\r\n // Request file\r\n const dataPromise = new Promise<File>(dataResolve => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .getItemDataAsFile(\r\n itemTemplate.itemId,\r\n itemTemplate.item.name,\r\n srcAuthentication\r\n )\r\n .then(response => {\r\n if (!response || response.size === 0) {\r\n dataResolve(null);\r\n } else {\r\n dataResolve(response);\r\n }\r\n });\r\n });\r\n\r\n // Request related items\r\n const relatedPromise = Promise.resolve(\r\n {} as common.IGetRelatedItemsResponse\r\n );\r\n\r\n // Errors are handled as resolved empty values; this means that there's no `reject` clause to handle, hence:\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all([dataPromise, relatedPromise]).then(responses => {\r\n const [itemDataResponse] = responses;\r\n\r\n if (itemDataResponse) {\r\n const resource: common.IFileMimeTyped = common.convertBlobToSupportableResource(\r\n itemDataResponse,\r\n itemTemplate.item.name\r\n );\r\n itemTemplate.properties[resource.filename] = resource.mimeType;\r\n\r\n const storageName = common.convertItemResourceToStorageResource(\r\n itemTemplate.itemId,\r\n (resource.blob as File).name,\r\n common.SolutionTemplateFormatVersion,\r\n ((resource.blob as File).name === resource.filename\r\n ? common.SolutionResourceType.data\r\n : common.SolutionResourceType.fakezip)\r\n );\r\n common\r\n .addResourceFromBlob(\r\n resource.blob,\r\n solutionItemId,\r\n storageName.folder,\r\n storageName.filename,\r\n destAuthentication\r\n )\r\n .then(\r\n () => {\r\n itemTemplate.resources.push(\r\n storageName.folder + \"/\" + storageName.filename\r\n );\r\n resolve(itemTemplate);\r\n },\r\n error => {\r\n itemTemplate.properties[\"error\"] = JSON.stringify(error);\r\n resolve(itemTemplate);\r\n }\r\n );\r\n } else {\r\n resolve(itemTemplate);\r\n }\r\n });\r\n });\r\n}\r\n\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Started,\r\n 0\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Ignored,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n return;\r\n }\r\n\r\n // Replace the templatized symbols in a copy of the template\r\n let newItemTemplate: common.IItemTemplate = common.cloneObject(template);\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n /* istanbul ignore else */\r\n if (template.item.thumbnail) {\r\n newItemTemplate.item.thumbnail = template.item.thumbnail;\r\n }\r\n\r\n // Create the item, then update its URL with its new id\r\n common\r\n .createItemWithData(\r\n newItemTemplate.item,\r\n newItemTemplate.data,\r\n destinationAuthentication,\r\n templateDictionary.folderId\r\n )\r\n .then(\r\n createResponse => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(createResponse.id, destinationAuthentication)\r\n .then(\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type)),\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type))\r\n );\r\n } else {\r\n // Add the new item to the settings\r\n newItemTemplate.itemId = createResponse.id;\r\n templateDictionary[template.itemId] = {\r\n itemId: createResponse.id\r\n };\r\n\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.id\r\n );\r\n\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.id,\r\n type: newItemTemplate.type,\r\n postProcess: false\r\n });\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n );\r\n });\r\n}\r\n"],"names":["common"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;EAwBA;EAEA;;;;;;;;;WASgB,qBAAqB,CACnC,cAAsB,EACtB,QAAa,EACb,kBAAsC,EACtC,iBAAqC;MAErC,OAAO,IAAI,OAAO,CAAuB,OAAO;;UAE9C,MAAM,YAAY,GAAyBA,iBAAM,CAAC,6BAA6B,CAC7E,QAAQ,CACT,CAAC;;UAGF,YAAY,CAAC,IAAI,CAAC,EAAE,GAAGA,iBAAM,CAAC,cAAc,CAC1C,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,YAAY,CAAC,IAAI,CAAC,EAAE,EACpB,SAAS,CACV,CAAC;;UAGF,MAAM,WAAW,GAAG,IAAI,OAAO,CAAO,WAAW;;cAE/CA,iBAAM;mBACH,iBAAiB,CAChB,YAAY,CAAC,MAAM,EACnB,YAAY,CAAC,IAA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;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/solution-file - v1.2.0 - Apache-2.0
3
- * Copyright (c) 2018-2021 Esri, Inc.
4
- * Thu Dec 09 2021 16:02:20 GMT-0800 (Pacific Standard Time)
2
+ * @esri/solution-file - v1.3.2 - Apache-2.0
3
+ * Copyright (c) 2018-2022 Esri, Inc.
4
+ * Thu Mar 03 2022 14:35:03 GMT-0800 (Pacific Standard Time)
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -15,5 +15,5 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution)}(this,(function(e,t){"use strict";function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:function(){return e[o]}})}})),t.default=e,Object.freeze(t)}var i=o(t);e.convertItemToTemplate=function(e,t,o,r){return new Promise((n=>{const m=i.createInitializedItemTemplate(t);m.item.id=i.templatizeTerm(m.item.id,m.item.id,".itemId");const s=new Promise((e=>{i.getItemDataAsFile(m.itemId,m.item.name,r).then((t=>{t&&0!==t.size?e(t):e(null)}))})),a=Promise.resolve({});Promise.all([s,a]).then((t=>{const[r]=t;if(r){const t=i.convertBlobToSupportableResource(r,m.item.name);m.properties[t.filename]=t.mimeType;const s=i.convertItemResourceToStorageResource(m.itemId+(t.blob.name===t.filename?"_info_data":"_info_dataz"),t.blob.name,i.SolutionTemplateFormatVersion);i.addResourceFromBlob(t.blob,e,s.folder,s.filename,o).then((()=>{m.resources.push(s.folder+"/"+s.filename),n(m)}),(e=>{m.properties.error=JSON.stringify(e),n(m)}))}else n(m)}))}))},e.createItemFromTemplate=function(e,t,o,r){return new Promise((n=>{if(!r(e.itemId,i.EItemProgressStatus.Started,0))return r(e.itemId,i.EItemProgressStatus.Ignored,0),void n(i.generateEmptyCreationResponse(e.type));let m=i.cloneObject(e);m=i.replaceInTemplate(m,t),e.item.thumbnail&&(m.item.thumbnail=e.item.thumbnail),i.createItemWithData(m.item,m.data,o,t.folderId).then((s=>{r(e.itemId,i.EItemProgressStatus.Created,e.estimatedDeploymentCostFactor/2,s.id)?(m.itemId=s.id,t[e.itemId]={itemId:s.id},r(e.itemId,i.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor/2,s.id),n({item:m,id:s.id,type:m.type,postProcess:!1})):(r(e.itemId,i.EItemProgressStatus.Cancelled,0),i.removeItem(s.id,o).then((()=>n(i.generateEmptyCreationResponse(e.type))),(()=>n(i.generateEmptyCreationResponse(e.type)))))}),(()=>{r(e.itemId,i.EItemProgressStatus.Failed,0),n(i.generateEmptyCreationResponse(e.type))}))}))},Object.defineProperty(e,"__esModule",{value:!0})}));
18
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/solution-common")):"function"==typeof define&&define.amd?define(["exports","@esri/solution-common"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisSolution=e.arcgisSolution||{},e.arcgisSolution)}(this,(function(e,t){"use strict";function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(o){if("default"!==o){var i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:function(){return e[o]}})}})),t.default=e,Object.freeze(t)}var i=o(t);e.convertItemToTemplate=function(e,t,o,r){return new Promise((n=>{const s=i.createInitializedItemTemplate(t);s.item.id=i.templatizeTerm(s.item.id,s.item.id,".itemId");const m=new Promise((e=>{i.getItemDataAsFile(s.itemId,s.item.name,r).then((t=>{t&&0!==t.size?e(t):e(null)}))})),a=Promise.resolve({});Promise.all([m,a]).then((t=>{const[r]=t;if(r){const t=i.convertBlobToSupportableResource(r,s.item.name);s.properties[t.filename]=t.mimeType;const m=i.convertItemResourceToStorageResource(s.itemId,t.blob.name,i.SolutionTemplateFormatVersion,t.blob.name===t.filename?i.SolutionResourceType.data:i.SolutionResourceType.fakezip);i.addResourceFromBlob(t.blob,e,m.folder,m.filename,o).then((()=>{s.resources.push(m.folder+"/"+m.filename),n(s)}),(e=>{s.properties.error=JSON.stringify(e),n(s)}))}else n(s)}))}))},e.createItemFromTemplate=function(e,t,o,r){return new Promise((n=>{if(!r(e.itemId,i.EItemProgressStatus.Started,0))return r(e.itemId,i.EItemProgressStatus.Ignored,0),void n(i.generateEmptyCreationResponse(e.type));let s=i.cloneObject(e);s=i.replaceInTemplate(s,t),e.item.thumbnail&&(s.item.thumbnail=e.item.thumbnail),i.createItemWithData(s.item,s.data,o,t.folderId).then((m=>{r(e.itemId,i.EItemProgressStatus.Created,e.estimatedDeploymentCostFactor/2,m.id)?(s.itemId=m.id,t[e.itemId]={itemId:m.id},r(e.itemId,i.EItemProgressStatus.Finished,e.estimatedDeploymentCostFactor/2,m.id),n({item:s,id:m.id,type:s.type,postProcess:!1})):(r(e.itemId,i.EItemProgressStatus.Cancelled,0),i.removeItem(m.id,o).then((()=>n(i.generateEmptyCreationResponse(e.type))),(()=>n(i.generateEmptyCreationResponse(e.type)))))}),(()=>{r(e.itemId,i.EItemProgressStatus.Failed,0),n(i.generateEmptyCreationResponse(e.type))}))}))},Object.defineProperty(e,"__esModule",{value:!0})}));
19
19
  //# sourceMappingURL=file.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file.umd.min.js","sources":["../../src/file.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of item types that contain files.\r\n *\r\n * @module file\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Converts a file item into a template.\r\n *\r\n * @param solutionItemId The solution to contain the template\r\n * @param itemInfo Info about the item\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @return A promise that will resolve when the template has been created\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: common.UserSession,\r\n srcAuthentication: common.UserSession\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>(resolve => {\r\n // Init template\r\n const itemTemplate: common.IItemTemplate = common.createInitializedItemTemplate(\r\n itemInfo\r\n );\r\n\r\n // Templatize item info property values\r\n itemTemplate.item.id = common.templatizeTerm(\r\n itemTemplate.item.id,\r\n itemTemplate.item.id,\r\n \".itemId\"\r\n );\r\n\r\n // Request file\r\n const dataPromise = new Promise<File>(dataResolve => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .getItemDataAsFile(\r\n itemTemplate.itemId,\r\n itemTemplate.item.name,\r\n srcAuthentication\r\n )\r\n .then(response => {\r\n if (!response || response.size === 0) {\r\n dataResolve(null);\r\n } else {\r\n dataResolve(response);\r\n }\r\n });\r\n });\r\n\r\n // Request related items\r\n const relatedPromise = Promise.resolve(\r\n {} as common.IGetRelatedItemsResponse\r\n );\r\n\r\n // Errors are handled as resolved empty values; this means that there's no `reject` clause to handle, hence:\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all([dataPromise, relatedPromise]).then(responses => {\r\n const [itemDataResponse] = responses;\r\n\r\n if (itemDataResponse) {\r\n const resource: common.IFileMimeTyped = common.convertBlobToSupportableResource(\r\n itemDataResponse,\r\n itemTemplate.item.name\r\n );\r\n itemTemplate.properties[resource.filename] = resource.mimeType;\r\n\r\n const storageName = common.convertItemResourceToStorageResource(\r\n itemTemplate.itemId +\r\n ((resource.blob as File).name === resource.filename\r\n ? \"_info_data\"\r\n : \"_info_dataz\"),\r\n (resource.blob as File).name,\r\n common.SolutionTemplateFormatVersion\r\n );\r\n common\r\n .addResourceFromBlob(\r\n resource.blob,\r\n solutionItemId,\r\n storageName.folder,\r\n storageName.filename,\r\n destAuthentication\r\n )\r\n .then(\r\n () => {\r\n itemTemplate.resources.push(\r\n storageName.folder + \"/\" + storageName.filename\r\n );\r\n resolve(itemTemplate);\r\n },\r\n error => {\r\n itemTemplate.properties[\"error\"] = JSON.stringify(error);\r\n resolve(itemTemplate);\r\n }\r\n );\r\n } else {\r\n resolve(itemTemplate);\r\n }\r\n });\r\n });\r\n}\r\n\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Started,\r\n 0\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Ignored,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n return;\r\n }\r\n\r\n // Replace the templatized symbols in a copy of the template\r\n let newItemTemplate: common.IItemTemplate = common.cloneObject(template);\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n /* istanbul ignore else */\r\n if (template.item.thumbnail) {\r\n newItemTemplate.item.thumbnail = template.item.thumbnail;\r\n }\r\n\r\n // Create the item, then update its URL with its new id\r\n common\r\n .createItemWithData(\r\n newItemTemplate.item,\r\n newItemTemplate.data,\r\n destinationAuthentication,\r\n templateDictionary.folderId\r\n )\r\n .then(\r\n createResponse => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(createResponse.id, destinationAuthentication)\r\n .then(\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type)),\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type))\r\n );\r\n } else {\r\n // Add the new item to the settings\r\n newItemTemplate.itemId = createResponse.id;\r\n templateDictionary[template.itemId] = {\r\n itemId: createResponse.id\r\n };\r\n\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.id\r\n );\r\n\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.id,\r\n type: newItemTemplate.type,\r\n postProcess: false\r\n });\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n );\r\n });\r\n}\r\n"],"names":["solutionItemId","itemInfo","destAuthentication","srcAuthentication","Promise","resolve","itemTemplate","common","createInitializedItemTemplate","item","id","templatizeTerm","dataPromise","dataResolve","getItemDataAsFile","itemId","name","then","response","size","relatedPromise","all","responses","itemDataResponse","resource","convertBlobToSupportableResource","properties","filename","mimeType","storageName","convertItemResourceToStorageResource","blob","SolutionTemplateFormatVersion","addResourceFromBlob","folder","resources","push","error","JSON","stringify","template","templateDictionary","destinationAuthentication","itemProgressCallback","EItemProgressStatus","Started","Ignored","generateEmptyCreationResponse","type","newItemTemplate","cloneObject","replaceInTemplate","thumbnail","createItemWithData","data","folderId","createResponse","Created","estimatedDeploymentCostFactor","Finished","postProcess","Cancelled","removeItem","Failed"],"mappings":";;;;;;;;;;;;;;;;;+pBAoCEA,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIC,SAA8BC,IAEvC,MAAMC,EAAqCC,EAAOC,8BAChDP,GAIFK,EAAaG,KAAKC,GAAKH,EAAOI,eAC5BL,EAAaG,KAAKC,GAClBJ,EAAaG,KAAKC,GAClB,WAIF,MAAME,EAAc,IAAIR,SAAcS,IAEpCN,EACGO,kBACCR,EAAaS,OACbT,EAAaG,KAAKO,KAClBb,GAEDc,MAAKC,IACCA,GAA8B,IAAlBA,EAASC,KAGxBN,EAAYK,GAFZL,EAAY,YAQdO,EAAiBhB,QAAQC,QAC7B,IAKFD,QAAQiB,IAAI,CAACT,EAAaQ,IAAiBH,MAAKK,IAC9C,MAAOC,GAAoBD,EAE3B,GAAIC,EAAkB,CACpB,MAAMC,EAAkCjB,EAAOkB,iCAC7CF,EACAjB,EAAaG,KAAKO,MAEpBV,EAAaoB,WAAWF,EAASG,UAAYH,EAASI,SAEtD,MAAMC,EAActB,EAAOuB,qCACzBxB,EAAaS,QACTS,EAASO,KAAcf,OAASQ,EAASG,SACvC,aACA,eACLH,EAASO,KAAcf,KACxBT,EAAOyB,+BAETzB,EACG0B,oBACCT,EAASO,KACT/B,EACA6B,EAAYK,OACZL,EAAYF,SACZzB,GAEDe,MACC,KACEX,EAAa6B,UAAUC,KACrBP,EAAYK,OAAS,IAAML,EAAYF,UAEzCtB,EAAQC,MAEV+B,IACE/B,EAAaoB,WAAkB,MAAIY,KAAKC,UAAUF,GAClDhC,EAAQC,WAIdD,EAAQC,4CAOdkC,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIvC,SAAgDC,IAEzD,IACGsC,EACCH,EAASzB,OACTR,EAAOqC,oBAAoBC,QAC3B,GASF,OANAF,EACEH,EAASzB,OACTR,EAAOqC,oBAAoBE,QAC3B,QAEFzC,EAAQE,EAAOwC,8BAA8BP,EAASQ,OAKxD,IAAIC,EAAwC1C,EAAO2C,YAAYV,GAC/DS,EAAkB1C,EAAO4C,kBACvBF,EACAR,GAGED,EAAS/B,KAAK2C,YAChBH,EAAgBxC,KAAK2C,UAAYZ,EAAS/B,KAAK2C,WAIjD7C,EACG8C,mBACCJ,EAAgBxC,KAChBwC,EAAgBK,KAChBZ,EACAD,EAAmBc,UAEpBtC,MACCuC,IAGKb,EACCH,EAASzB,OACTR,EAAOqC,oBAAoBa,QAC3BjB,EAASkB,8BAAgC,EACzCF,EAAe9C,KAkBjBuC,EAAgBlC,OAASyC,EAAe9C,GACxC+B,EAAmBD,EAASzB,QAAU,CACpCA,OAAQyC,EAAe9C,IAGzBiC,EACEH,EAASzB,OACTR,EAAOqC,oBAAoBe,SAC3BnB,EAASkB,8BAAgC,EACzCF,EAAe9C,IAGjBL,EAAQ,CACNI,KAAMwC,EACNvC,GAAI8C,EAAe9C,GACnBsC,KAAMC,EAAgBD,KACtBY,aAAa,MA/BfjB,EACEH,EAASzB,OACTR,EAAOqC,oBAAoBiB,UAC3B,GAEFtD,EACGuD,WAAWN,EAAe9C,GAAIgC,GAC9BzB,MACC,IACEZ,EAAQE,EAAOwC,8BAA8BP,EAASQ,SACxD,IACE3C,EAAQE,EAAOwC,8BAA8BP,EAASQ,aAwBhE,KACEL,EACEH,EAASzB,OACTR,EAAOqC,oBAAoBmB,OAC3B,GAEF1D,EAAQE,EAAOwC,8BAA8BP,EAASQ"}
1
+ {"version":3,"file":"file.umd.min.js","sources":["../../src/file.ts"],"sourcesContent":["/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation and deployment of item types that contain files.\r\n *\r\n * @module file\r\n */\r\n\r\nimport * as common from \"@esri/solution-common\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Converts a file item into a template.\r\n *\r\n * @param solutionItemId The solution to contain the template\r\n * @param itemInfo Info about the item\r\n * @param destAuthentication Credentials for requests to the destination organization\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @return A promise that will resolve when the template has been created\r\n */\r\nexport function convertItemToTemplate(\r\n solutionItemId: string,\r\n itemInfo: any,\r\n destAuthentication: common.UserSession,\r\n srcAuthentication: common.UserSession\r\n): Promise<common.IItemTemplate> {\r\n return new Promise<common.IItemTemplate>(resolve => {\r\n // Init template\r\n const itemTemplate: common.IItemTemplate = common.createInitializedItemTemplate(\r\n itemInfo\r\n );\r\n\r\n // Templatize item info property values\r\n itemTemplate.item.id = common.templatizeTerm(\r\n itemTemplate.item.id,\r\n itemTemplate.item.id,\r\n \".itemId\"\r\n );\r\n\r\n // Request file\r\n const dataPromise = new Promise<File>(dataResolve => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n common\r\n .getItemDataAsFile(\r\n itemTemplate.itemId,\r\n itemTemplate.item.name,\r\n srcAuthentication\r\n )\r\n .then(response => {\r\n if (!response || response.size === 0) {\r\n dataResolve(null);\r\n } else {\r\n dataResolve(response);\r\n }\r\n });\r\n });\r\n\r\n // Request related items\r\n const relatedPromise = Promise.resolve(\r\n {} as common.IGetRelatedItemsResponse\r\n );\r\n\r\n // Errors are handled as resolved empty values; this means that there's no `reject` clause to handle, hence:\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all([dataPromise, relatedPromise]).then(responses => {\r\n const [itemDataResponse] = responses;\r\n\r\n if (itemDataResponse) {\r\n const resource: common.IFileMimeTyped = common.convertBlobToSupportableResource(\r\n itemDataResponse,\r\n itemTemplate.item.name\r\n );\r\n itemTemplate.properties[resource.filename] = resource.mimeType;\r\n\r\n const storageName = common.convertItemResourceToStorageResource(\r\n itemTemplate.itemId,\r\n (resource.blob as File).name,\r\n common.SolutionTemplateFormatVersion,\r\n ((resource.blob as File).name === resource.filename\r\n ? common.SolutionResourceType.data\r\n : common.SolutionResourceType.fakezip)\r\n );\r\n common\r\n .addResourceFromBlob(\r\n resource.blob,\r\n solutionItemId,\r\n storageName.folder,\r\n storageName.filename,\r\n destAuthentication\r\n )\r\n .then(\r\n () => {\r\n itemTemplate.resources.push(\r\n storageName.folder + \"/\" + storageName.filename\r\n );\r\n resolve(itemTemplate);\r\n },\r\n error => {\r\n itemTemplate.properties[\"error\"] = JSON.stringify(error);\r\n resolve(itemTemplate);\r\n }\r\n );\r\n } else {\r\n resolve(itemTemplate);\r\n }\r\n });\r\n });\r\n}\r\n\r\nexport function createItemFromTemplate(\r\n template: common.IItemTemplate,\r\n templateDictionary: any,\r\n destinationAuthentication: common.UserSession,\r\n itemProgressCallback: common.IItemProgressCallback\r\n): Promise<common.ICreateItemFromTemplateResponse> {\r\n return new Promise<common.ICreateItemFromTemplateResponse>(resolve => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Started,\r\n 0\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Ignored,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type));\r\n return;\r\n }\r\n\r\n // Replace the templatized symbols in a copy of the template\r\n let newItemTemplate: common.IItemTemplate = common.cloneObject(template);\r\n newItemTemplate = common.replaceInTemplate(\r\n newItemTemplate,\r\n templateDictionary\r\n );\r\n /* istanbul ignore else */\r\n if (template.item.thumbnail) {\r\n newItemTemplate.item.thumbnail = template.item.thumbnail;\r\n }\r\n\r\n // Create the item, then update its URL with its new id\r\n common\r\n .createItemWithData(\r\n newItemTemplate.item,\r\n newItemTemplate.data,\r\n destinationAuthentication,\r\n templateDictionary.folderId\r\n )\r\n .then(\r\n createResponse => {\r\n // Interrupt process if progress callback returns `false`\r\n if (\r\n !itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Created,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.id\r\n )\r\n ) {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Cancelled,\r\n 0\r\n );\r\n common\r\n .removeItem(createResponse.id, destinationAuthentication)\r\n .then(\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type)),\r\n () =>\r\n resolve(common.generateEmptyCreationResponse(template.type))\r\n );\r\n } else {\r\n // Add the new item to the settings\r\n newItemTemplate.itemId = createResponse.id;\r\n templateDictionary[template.itemId] = {\r\n itemId: createResponse.id\r\n };\r\n\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Finished,\r\n template.estimatedDeploymentCostFactor / 2,\r\n createResponse.id\r\n );\r\n\r\n resolve({\r\n item: newItemTemplate,\r\n id: createResponse.id,\r\n type: newItemTemplate.type,\r\n postProcess: false\r\n });\r\n }\r\n },\r\n () => {\r\n itemProgressCallback(\r\n template.itemId,\r\n common.EItemProgressStatus.Failed,\r\n 0\r\n );\r\n resolve(common.generateEmptyCreationResponse(template.type)); // fails to create item\r\n }\r\n );\r\n });\r\n}\r\n"],"names":["solutionItemId","itemInfo","destAuthentication","srcAuthentication","Promise","resolve","itemTemplate","common","createInitializedItemTemplate","item","id","templatizeTerm","dataPromise","dataResolve","getItemDataAsFile","itemId","name","then","response","size","relatedPromise","all","responses","itemDataResponse","resource","convertBlobToSupportableResource","properties","filename","mimeType","storageName","convertItemResourceToStorageResource","blob","SolutionTemplateFormatVersion","SolutionResourceType","data","fakezip","addResourceFromBlob","folder","resources","push","error","JSON","stringify","template","templateDictionary","destinationAuthentication","itemProgressCallback","EItemProgressStatus","Started","Ignored","generateEmptyCreationResponse","type","newItemTemplate","cloneObject","replaceInTemplate","thumbnail","createItemWithData","folderId","createResponse","Created","estimatedDeploymentCostFactor","Finished","postProcess","Cancelled","removeItem","Failed"],"mappings":";;;;;;;;;;;;;;;;;+pBAoCEA,EACAC,EACAC,EACAC,GAEA,OAAO,IAAIC,SAA8BC,IAEvC,MAAMC,EAAqCC,EAAOC,8BAChDP,GAIFK,EAAaG,KAAKC,GAAKH,EAAOI,eAC5BL,EAAaG,KAAKC,GAClBJ,EAAaG,KAAKC,GAClB,WAIF,MAAME,EAAc,IAAIR,SAAcS,IAEpCN,EACGO,kBACCR,EAAaS,OACbT,EAAaG,KAAKO,KAClBb,GAEDc,MAAKC,IACCA,GAA8B,IAAlBA,EAASC,KAGxBN,EAAYK,GAFZL,EAAY,YAQdO,EAAiBhB,QAAQC,QAC7B,IAKFD,QAAQiB,IAAI,CAACT,EAAaQ,IAAiBH,MAAKK,IAC9C,MAAOC,GAAoBD,EAE3B,GAAIC,EAAkB,CACpB,MAAMC,EAAkCjB,EAAOkB,iCAC7CF,EACAjB,EAAaG,KAAKO,MAEpBV,EAAaoB,WAAWF,EAASG,UAAYH,EAASI,SAEtD,MAAMC,EAActB,EAAOuB,qCACzBxB,EAAaS,OACZS,EAASO,KAAcf,KACxBT,EAAOyB,8BACLR,EAASO,KAAcf,OAASQ,EAASG,SACrCpB,EAAO0B,qBAAqBC,KAC5B3B,EAAO0B,qBAAqBE,SAEpC5B,EACG6B,oBACCZ,EAASO,KACT/B,EACA6B,EAAYQ,OACZR,EAAYF,SACZzB,GAEDe,MACC,KACEX,EAAagC,UAAUC,KACrBV,EAAYQ,OAAS,IAAMR,EAAYF,UAEzCtB,EAAQC,MAEVkC,IACElC,EAAaoB,WAAkB,MAAIe,KAAKC,UAAUF,GAClDnC,EAAQC,WAIdD,EAAQC,4CAOdqC,EACAC,EACAC,EACAC,GAEA,OAAO,IAAI1C,SAAgDC,IAEzD,IACGyC,EACCH,EAAS5B,OACTR,EAAOwC,oBAAoBC,QAC3B,GASF,OANAF,EACEH,EAAS5B,OACTR,EAAOwC,oBAAoBE,QAC3B,QAEF5C,EAAQE,EAAO2C,8BAA8BP,EAASQ,OAKxD,IAAIC,EAAwC7C,EAAO8C,YAAYV,GAC/DS,EAAkB7C,EAAO+C,kBACvBF,EACAR,GAGED,EAASlC,KAAK8C,YAChBH,EAAgB3C,KAAK8C,UAAYZ,EAASlC,KAAK8C,WAIjDhD,EACGiD,mBACCJ,EAAgB3C,KAChB2C,EAAgBlB,KAChBW,EACAD,EAAmBa,UAEpBxC,MACCyC,IAGKZ,EACCH,EAAS5B,OACTR,EAAOwC,oBAAoBY,QAC3BhB,EAASiB,8BAAgC,EACzCF,EAAehD,KAkBjB0C,EAAgBrC,OAAS2C,EAAehD,GACxCkC,EAAmBD,EAAS5B,QAAU,CACpCA,OAAQ2C,EAAehD,IAGzBoC,EACEH,EAAS5B,OACTR,EAAOwC,oBAAoBc,SAC3BlB,EAASiB,8BAAgC,EACzCF,EAAehD,IAGjBL,EAAQ,CACNI,KAAM2C,EACN1C,GAAIgD,EAAehD,GACnByC,KAAMC,EAAgBD,KACtBW,aAAa,MA/BfhB,EACEH,EAAS5B,OACTR,EAAOwC,oBAAoBgB,UAC3B,GAEFxD,EACGyD,WAAWN,EAAehD,GAAImC,GAC9B5B,MACC,IACEZ,EAAQE,EAAO2C,8BAA8BP,EAASQ,SACxD,IACE9C,EAAQE,EAAO2C,8BAA8BP,EAASQ,aAwBhE,KACEL,EACEH,EAAS5B,OACTR,EAAOwC,oBAAoBkB,OAC3B,GAEF5D,EAAQE,EAAO2C,8BAA8BP,EAASQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-file",
3
- "version": "1.2.0",
3
+ "version": "1.3.2",
4
4
  "description": "Manages the creation and deployment of item types that contain files for @esri/solution.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "unpkg": "dist/umd/file.umd.min.js",
@@ -18,12 +18,11 @@
18
18
  "@esri/arcgis-rest-portal": "3.4.3",
19
19
  "@esri/arcgis-rest-request": "3.4.3",
20
20
  "@esri/arcgis-rest-service-admin": "3.4.3",
21
- "@esri/hub-common": "9.7.2",
22
- "@esri/hub-initiatives": "9.7.2",
23
- "@esri/hub-sites": "9.7.2",
24
- "@esri/hub-teams": "9.7.2",
25
- "rollup": "^2.60.0",
26
- "typescript": "^4.4.4"
21
+ "@esri/hub-common": "9.15.0",
22
+ "@esri/hub-initiatives": "9.15.0",
23
+ "@esri/hub-sites": "9.15.0",
24
+ "@esri/hub-teams": "9.15.0",
25
+ "rollup": "^2.60.0"
27
26
  },
28
27
  "peerDependencies": {
29
28
  "@esri/arcgis-rest-auth": "3.4.3",
@@ -31,13 +30,13 @@
31
30
  "@esri/arcgis-rest-portal": "3.4.3",
32
31
  "@esri/arcgis-rest-request": "3.4.3",
33
32
  "@esri/arcgis-rest-service-admin": "3.4.3",
34
- "@esri/hub-common": "9.7.2",
35
- "@esri/hub-initiatives": "9.7.2",
36
- "@esri/hub-sites": "9.7.2",
37
- "@esri/hub-teams": "9.7.2"
33
+ "@esri/hub-common": "9.15.0",
34
+ "@esri/hub-initiatives": "9.15.0",
35
+ "@esri/hub-sites": "9.15.0",
36
+ "@esri/hub-teams": "9.15.0"
38
37
  },
39
38
  "dependencies": {
40
- "@esri/solution-common": "^1.2.0",
39
+ "@esri/solution-common": "^1.3.2",
41
40
  "tslib": "1.13.0"
42
41
  },
43
42
  "scripts": {
@@ -90,5 +89,5 @@
90
89
  "esri",
91
90
  "ES6"
92
91
  ],
93
- "gitHead": "70f706fb28a50db0b9b13030f263f8e9e270b98d"
92
+ "gitHead": "08334d19a46a19455c798c89c325f50b9305d8b3"
94
93
  }