@esri/solution-common 6.4.0-next.20250925 → 6.4.0-next.20250926

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.
@@ -21,6 +21,7 @@ import JSZip from "jszip";
21
21
  export declare const SolutionTemplateFormatVersion = 1;
22
22
  export declare const DeployedSolutionFormatVersion = 1;
23
23
  export declare const UNREACHABLE = "unreachable";
24
+ export declare const TASK_CONFIG = "tasks-configuration.json";
24
25
  /**
25
26
  * Flags for storing an item's binary resources.
26
27
  */
@@ -15,11 +15,12 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.SItemProgressStatus = exports.EItemProgressStatus = exports.SFileType = exports.EFileType = exports.UNREACHABLE = exports.DeployedSolutionFormatVersion = exports.SolutionTemplateFormatVersion = void 0;
18
+ exports.SItemProgressStatus = exports.EItemProgressStatus = exports.SFileType = exports.EFileType = exports.TASK_CONFIG = exports.UNREACHABLE = exports.DeployedSolutionFormatVersion = exports.SolutionTemplateFormatVersion = void 0;
19
19
  //#endregion ---------------------------------------------------------------------------------------------------------//
20
20
  exports.SolutionTemplateFormatVersion = 1;
21
21
  exports.DeployedSolutionFormatVersion = 1;
22
22
  exports.UNREACHABLE = "unreachable";
23
+ exports.TASK_CONFIG = "tasks-configuration.json";
23
24
  //#region Enums ------------------------------------------------------------------------------------------------------//
24
25
  /**
25
26
  * Flags for storing an item's binary resources.
@@ -26,6 +26,7 @@ const copyZipIntoItem_1 = require("./copyZipIntoItem");
26
26
  const createCopyResults_1 = require("./createCopyResults");
27
27
  const generalHelpers_1 = require("../generalHelpers");
28
28
  const restHelpersGet_1 = require("../restHelpersGet");
29
+ const templatization_1 = require("../templatization");
29
30
  const jszip_1 = tslib_1.__importDefault(require("jszip"));
30
31
  // ------------------------------------------------------------------------------------------------------------------ //
31
32
  /**
@@ -302,6 +303,31 @@ function _detemplatizeResources(sourceAuthentication, sourceItemId, itemTemplate
302
303
  }));
303
304
  });
304
305
  }
306
+ else if (itemTemplate.type === "Web Map") {
307
+ fileInfos.forEach((fileResource) => {
308
+ if (fileResource.filename === interfaces_1.TASK_CONFIG) {
309
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
310
+ synchronizePromises.push(new Promise((resolve) => {
311
+ // Fetch the file
312
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
313
+ (0, restHelpersGet_1.getBlobAsFile)(fileResource.url, fileResource.filename, sourceAuthentication).then((file) => {
314
+ // Read the file
315
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
316
+ (0, generalHelpers_1.blobToJson)(file).then((fileJson) => {
317
+ // DeTemplatize by turning JSON into string, replacing paths with new value, and re-JSONing
318
+ let fileString = JSON.stringify(fileJson);
319
+ fileString = (0, templatization_1.replaceInTemplate)(fileString, templateDictionary);
320
+ const updatedFileJson = JSON.parse(fileString);
321
+ // Write the changes back into the file
322
+ fileResource.file = (0, generalHelpers_1.jsonToFile)(updatedFileJson, fileResource.filename);
323
+ fileResource.url = "";
324
+ resolve(null);
325
+ });
326
+ });
327
+ }));
328
+ }
329
+ });
330
+ }
305
331
  return Promise.all(synchronizePromises);
306
332
  }
307
333
  exports._detemplatizeResources = _detemplatizeResources;
@@ -62,6 +62,9 @@ exports.TRANSFORMS = {
62
62
  // this fallback is needed when we detemplatize living atlas layers as a part of the create process
63
63
  return val ? val[0].url : `{{${exports.GEOCODE_SERVER_NAME}}}`;
64
64
  },
65
+ encode(key, val, settings) {
66
+ return encodeURIComponent(val);
67
+ },
65
68
  };
66
69
  /**
67
70
  * Wraps double brackets around the supplied term.
@@ -21,6 +21,7 @@ import JSZip from "jszip";
21
21
  export declare const SolutionTemplateFormatVersion = 1;
22
22
  export declare const DeployedSolutionFormatVersion = 1;
23
23
  export declare const UNREACHABLE = "unreachable";
24
+ export declare const TASK_CONFIG = "tasks-configuration.json";
24
25
  /**
25
26
  * Flags for storing an item's binary resources.
26
27
  */
@@ -17,6 +17,7 @@
17
17
  export const SolutionTemplateFormatVersion = 1;
18
18
  export const DeployedSolutionFormatVersion = 1;
19
19
  export const UNREACHABLE = "unreachable";
20
+ export const TASK_CONFIG = "tasks-configuration.json";
20
21
  //#region Enums ------------------------------------------------------------------------------------------------------//
21
22
  /**
22
23
  * Flags for storing an item's binary resources.
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { EFileType, } from "../interfaces";
16
+ import { EFileType, TASK_CONFIG, } from "../interfaces";
17
17
  import { chunkArray } from "@esri/hub-common";
18
18
  import { copyDataIntoItem } from "./copyDataIntoItem";
19
19
  import { copyMetadataIntoItem } from "./copyMetadataIntoItem";
@@ -22,6 +22,7 @@ import { copyZipIntoItem } from "./copyZipIntoItem";
22
22
  import { createCopyResults } from "./createCopyResults";
23
23
  import { blobToJson, jsonToFile } from "../generalHelpers";
24
24
  import { getBlobAsFile } from "../restHelpersGet";
25
+ import { replaceInTemplate } from "../templatization";
25
26
  import JSZip from "jszip";
26
27
  // ------------------------------------------------------------------------------------------------------------------ //
27
28
  /**
@@ -295,6 +296,31 @@ export function _detemplatizeResources(sourceAuthentication, sourceItemId, itemT
295
296
  }));
296
297
  });
297
298
  }
299
+ else if (itemTemplate.type === "Web Map") {
300
+ fileInfos.forEach((fileResource) => {
301
+ if (fileResource.filename === TASK_CONFIG) {
302
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
303
+ synchronizePromises.push(new Promise((resolve) => {
304
+ // Fetch the file
305
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
306
+ getBlobAsFile(fileResource.url, fileResource.filename, sourceAuthentication).then((file) => {
307
+ // Read the file
308
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
309
+ blobToJson(file).then((fileJson) => {
310
+ // DeTemplatize by turning JSON into string, replacing paths with new value, and re-JSONing
311
+ let fileString = JSON.stringify(fileJson);
312
+ fileString = replaceInTemplate(fileString, templateDictionary);
313
+ const updatedFileJson = JSON.parse(fileString);
314
+ // Write the changes back into the file
315
+ fileResource.file = jsonToFile(updatedFileJson, fileResource.filename);
316
+ fileResource.url = "";
317
+ resolve(null);
318
+ });
319
+ });
320
+ }));
321
+ }
322
+ });
323
+ }
298
324
  return Promise.all(synchronizePromises);
299
325
  }
300
326
  /**
@@ -59,6 +59,9 @@ export const TRANSFORMS = {
59
59
  // this fallback is needed when we detemplatize living atlas layers as a part of the create process
60
60
  return val ? val[0].url : `{{${GEOCODE_SERVER_NAME}}}`;
61
61
  },
62
+ encode(key, val, settings) {
63
+ return encodeURIComponent(val);
64
+ },
62
65
  };
63
66
  /**
64
67
  * Wraps double brackets around the supplied term.
@@ -1,7 +1,10 @@
1
- Built 09/25/2025 20:41:24.50
1
+ Built 09/26/2025 20:41:25.04
2
2
  develop
3
- commit 0092f8c76afb3b4d94d2a89353313a3b42cf2d77
4
- Author: Ryan Cosby <ryan9313@esri.com>
5
- Date: Wed Sep 24 20:45:40 2025 -0700
3
+ commit f8b6ad1803cd5c2f67b317b6ea7390dad77ada61
4
+ Merge: 59c9931ec 9d3b00522
5
+ Author: John Hauck <jhauck@esri.com>
6
+ Date: Fri Sep 26 09:45:56 2025 -0700
6
7
 
7
- v6.4.0-next.20250924
8
+ Merge pull request #1559 from Esri/field-map-tasks
9
+
10
+ need to pass the resourceStringUpdated
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/solution-common",
3
- "version": "6.4.0-next.20250925",
3
+ "version": "6.4.0-next.20250926",
4
4
  "description": "Provides general helper functions for @esri/solution.js.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -96,5 +96,5 @@
96
96
  "esri",
97
97
  "ES6"
98
98
  ],
99
- "gitHead": "0092f8c76afb3b4d94d2a89353313a3b42cf2d77"
99
+ "gitHead": "f8b6ad1803cd5c2f67b317b6ea7390dad77ada61"
100
100
  }