@esri/solution-form 5.2.9 → 5.2.10
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/cjs/formUtils.d.ts +0 -1
- package/dist/cjs/formUtils.js +28 -21
- package/dist/cjs/formUtils.js.map +1 -1
- package/dist/esm/formUtils.d.ts +0 -1
- package/dist/esm/formUtils.js +27 -19
- package/dist/esm/formUtils.js.map +1 -1
- package/package.json +11 -11
package/dist/cjs/formUtils.d.ts
CHANGED
|
@@ -30,7 +30,6 @@ export declare function swizzleFormObject(zipObject: JSZip, templateDictionary:
|
|
|
30
30
|
* @param templateDictionary Dictionary of replacement values
|
|
31
31
|
* @returns Promise that resolves to the updated zip file item
|
|
32
32
|
*/
|
|
33
|
-
export declare function _updateZipObjectBinaryContent(zipFileItem: common.IZipObjectContentItem, templateDictionary: any): Promise<common.IZipObjectContentItem>;
|
|
34
33
|
/**
|
|
35
34
|
* Updates the text content of a zip object.
|
|
36
35
|
*
|
package/dist/cjs/formUtils.js
CHANGED
|
@@ -15,10 +15,9 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports._updateZipObjectTextContent = exports.
|
|
18
|
+
exports._updateZipObjectTextContent = exports.swizzleFormObject = void 0;
|
|
19
19
|
const tslib_1 = require("tslib");
|
|
20
20
|
const common = tslib_1.__importStar(require("@esri/solution-common"));
|
|
21
|
-
const jszip_1 = tslib_1.__importDefault(require("jszip"));
|
|
22
21
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
23
22
|
/**
|
|
24
23
|
* Detemplatizes Form data and swizzles the AGO ids of a zip object if they are present in the template dictionary.
|
|
@@ -31,26 +30,28 @@ async function swizzleFormObject(zipObject, templateDictionary) {
|
|
|
31
30
|
// Get the contents of the zip object
|
|
32
31
|
const zipObjectContents = await common.getZipObjectContents(zipObject);
|
|
33
32
|
// Swizzle the contents of each file in a zip file and replace them in the zip object
|
|
34
|
-
const zipObjectUpdatePromises = [];
|
|
33
|
+
//const zipObjectUpdatePromises: Array<Promise<common.IZipObjectContentItem>> = [];
|
|
35
34
|
zipObjectContents.forEach((zipFileItem) => {
|
|
36
35
|
// Separate the binary files from the text files
|
|
37
36
|
if (typeof zipFileItem.content === "string") {
|
|
38
37
|
const updatedZipContent = _updateZipObjectTextContent(zipFileItem, templateDictionary);
|
|
39
38
|
// Replace the file content in the zip object
|
|
40
39
|
zipObject.file(zipFileItem.file, updatedZipContent);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (zipFileItem.file.endsWith(".xlsx")) {
|
|
40
|
+
/*} else {
|
|
41
|
+
// Only update XLSX binary files
|
|
42
|
+
if (zipFileItem.file.endsWith(".xlsx")) {
|
|
45
43
|
zipObjectUpdatePromises.push(_updateZipObjectBinaryContent(zipFileItem, templateDictionary));
|
|
46
|
-
|
|
44
|
+
}
|
|
45
|
+
*/
|
|
47
46
|
}
|
|
48
47
|
});
|
|
48
|
+
/*
|
|
49
49
|
const asyncUpdates = await Promise.all(zipObjectUpdatePromises);
|
|
50
|
-
asyncUpdates.forEach((zipFileItem) => {
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
asyncUpdates.forEach((zipFileItem: common.IZipObjectContentItem) => {
|
|
51
|
+
// Replace the file content in the zip object
|
|
52
|
+
zipObject.file(zipFileItem.file, zipFileItem.content);
|
|
53
53
|
});
|
|
54
|
+
*/
|
|
54
55
|
return Promise.resolve(zipObject);
|
|
55
56
|
}
|
|
56
57
|
exports.swizzleFormObject = swizzleFormObject;
|
|
@@ -62,16 +63,22 @@ exports.swizzleFormObject = swizzleFormObject;
|
|
|
62
63
|
* @param templateDictionary Dictionary of replacement values
|
|
63
64
|
* @returns Promise that resolves to the updated zip file item
|
|
64
65
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
/*
|
|
67
|
+
export async function _updateZipObjectBinaryContent(
|
|
68
|
+
zipFileItem: common.IZipObjectContentItem,
|
|
69
|
+
templateDictionary: any
|
|
70
|
+
): Promise<common.IZipObjectContentItem> {
|
|
71
|
+
const updatedZipContent = await swizzleFormObject(await JSZip.loadAsync(zipFileItem.content), templateDictionary);
|
|
72
|
+
|
|
73
|
+
// Replace the file content in the zip file item
|
|
74
|
+
const updatedZipFileItem = {
|
|
75
|
+
file: zipFileItem.file,
|
|
76
|
+
content: await common.zipObjectToZipFile(updatedZipContent, zipFileItem.file)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return Promise.resolve(updatedZipFileItem);
|
|
73
80
|
}
|
|
74
|
-
|
|
81
|
+
*/
|
|
75
82
|
/**
|
|
76
83
|
* Updates the text content of a zip object.
|
|
77
84
|
*
|
|
@@ -86,7 +93,7 @@ function _updateZipObjectTextContent(zipFileItem, templateDictionary) {
|
|
|
86
93
|
let updatedZipObjectContent = zipFileItem.content;
|
|
87
94
|
updatedZipObjectContent = common.replaceInTemplate(zipFileItem.content, templateDictionary);
|
|
88
95
|
// Find the AGO ids in the file content
|
|
89
|
-
const agoIdMatches = updatedZipObjectContent.match(agoIdRegEx) ?? [];
|
|
96
|
+
const agoIdMatches = common.dedupe(updatedZipObjectContent.match(agoIdRegEx) ?? []);
|
|
90
97
|
// Replace things that look like AGO ids in the file content iff they are present in the template dictionary
|
|
91
98
|
agoIdMatches.forEach((match) => {
|
|
92
99
|
const replacement = templateDictionary[match];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formUtils.js","sourceRoot":"","sources":["../../src/formUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,sEAAgD;
|
|
1
|
+
{"version":3,"file":"formUtils.js","sourceRoot":"","sources":["../../src/formUtils.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,sEAAgD;AAG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AC,KAAK,CAAC,CAAC;QAC9C,IAAI,OAAO,WAAW,EAAE,MAAM,KAAK,QAAQ,EAAE;YAC3C,uBAAuB,GAAG,uBAAuB,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;SAC5G;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAxBD,kEAwBC"}
|
package/dist/esm/formUtils.d.ts
CHANGED
|
@@ -30,7 +30,6 @@ export declare function swizzleFormObject(zipObject: JSZip, templateDictionary:
|
|
|
30
30
|
* @param templateDictionary Dictionary of replacement values
|
|
31
31
|
* @returns Promise that resolves to the updated zip file item
|
|
32
32
|
*/
|
|
33
|
-
export declare function _updateZipObjectBinaryContent(zipFileItem: common.IZipObjectContentItem, templateDictionary: any): Promise<common.IZipObjectContentItem>;
|
|
34
33
|
/**
|
|
35
34
|
* Updates the text content of a zip object.
|
|
36
35
|
*
|
package/dist/esm/formUtils.js
CHANGED
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import * as common from "@esri/solution-common";
|
|
17
|
-
import JSZip from "jszip";
|
|
18
17
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
19
18
|
/**
|
|
20
19
|
* Detemplatizes Form data and swizzles the AGO ids of a zip object if they are present in the template dictionary.
|
|
@@ -27,26 +26,28 @@ export async function swizzleFormObject(zipObject, templateDictionary) {
|
|
|
27
26
|
// Get the contents of the zip object
|
|
28
27
|
const zipObjectContents = await common.getZipObjectContents(zipObject);
|
|
29
28
|
// Swizzle the contents of each file in a zip file and replace them in the zip object
|
|
30
|
-
const zipObjectUpdatePromises = [];
|
|
29
|
+
//const zipObjectUpdatePromises: Array<Promise<common.IZipObjectContentItem>> = [];
|
|
31
30
|
zipObjectContents.forEach((zipFileItem) => {
|
|
32
31
|
// Separate the binary files from the text files
|
|
33
32
|
if (typeof zipFileItem.content === "string") {
|
|
34
33
|
const updatedZipContent = _updateZipObjectTextContent(zipFileItem, templateDictionary);
|
|
35
34
|
// Replace the file content in the zip object
|
|
36
35
|
zipObject.file(zipFileItem.file, updatedZipContent);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (zipFileItem.file.endsWith(".xlsx")) {
|
|
36
|
+
/*} else {
|
|
37
|
+
// Only update XLSX binary files
|
|
38
|
+
if (zipFileItem.file.endsWith(".xlsx")) {
|
|
41
39
|
zipObjectUpdatePromises.push(_updateZipObjectBinaryContent(zipFileItem, templateDictionary));
|
|
42
|
-
|
|
40
|
+
}
|
|
41
|
+
*/
|
|
43
42
|
}
|
|
44
43
|
});
|
|
44
|
+
/*
|
|
45
45
|
const asyncUpdates = await Promise.all(zipObjectUpdatePromises);
|
|
46
|
-
asyncUpdates.forEach((zipFileItem) => {
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
asyncUpdates.forEach((zipFileItem: common.IZipObjectContentItem) => {
|
|
47
|
+
// Replace the file content in the zip object
|
|
48
|
+
zipObject.file(zipFileItem.file, zipFileItem.content);
|
|
49
49
|
});
|
|
50
|
+
*/
|
|
50
51
|
return Promise.resolve(zipObject);
|
|
51
52
|
}
|
|
52
53
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
@@ -57,15 +58,22 @@ export async function swizzleFormObject(zipObject, templateDictionary) {
|
|
|
57
58
|
* @param templateDictionary Dictionary of replacement values
|
|
58
59
|
* @returns Promise that resolves to the updated zip file item
|
|
59
60
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
/*
|
|
62
|
+
export async function _updateZipObjectBinaryContent(
|
|
63
|
+
zipFileItem: common.IZipObjectContentItem,
|
|
64
|
+
templateDictionary: any
|
|
65
|
+
): Promise<common.IZipObjectContentItem> {
|
|
66
|
+
const updatedZipContent = await swizzleFormObject(await JSZip.loadAsync(zipFileItem.content), templateDictionary);
|
|
67
|
+
|
|
68
|
+
// Replace the file content in the zip file item
|
|
69
|
+
const updatedZipFileItem = {
|
|
70
|
+
file: zipFileItem.file,
|
|
71
|
+
content: await common.zipObjectToZipFile(updatedZipContent, zipFileItem.file)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return Promise.resolve(updatedZipFileItem);
|
|
68
75
|
}
|
|
76
|
+
*/
|
|
69
77
|
/**
|
|
70
78
|
* Updates the text content of a zip object.
|
|
71
79
|
*
|
|
@@ -80,7 +88,7 @@ export function _updateZipObjectTextContent(zipFileItem, templateDictionary) {
|
|
|
80
88
|
let updatedZipObjectContent = zipFileItem.content;
|
|
81
89
|
updatedZipObjectContent = common.replaceInTemplate(zipFileItem.content, templateDictionary);
|
|
82
90
|
// Find the AGO ids in the file content
|
|
83
|
-
const agoIdMatches = updatedZipObjectContent.match(agoIdRegEx) ?? [];
|
|
91
|
+
const agoIdMatches = common.dedupe(updatedZipObjectContent.match(agoIdRegEx) ?? []);
|
|
84
92
|
// Replace things that look like AGO ids in the file content iff they are present in the template dictionary
|
|
85
93
|
agoIdMatches.forEach((match) => {
|
|
86
94
|
const replacement = templateDictionary[match];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formUtils.js","sourceRoot":"","sources":["../../src/formUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"formUtils.js","sourceRoot":"","sources":["../../src/formUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAGhD,wHAAwH;AAExH;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAAgB,EAChB,kBAAuB;IAEvB,qCAAqC;IACrC,MAAM,iBAA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IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;SAC5G;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,uBAAuB,CAAC;AACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-form",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.10",
|
|
4
4
|
"description": "Manages the creation and deployment of form item types for @esri/solution.js.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -23,21 +23,21 @@
|
|
|
23
23
|
"@esri/arcgis-rest-portal": "^3.7.0",
|
|
24
24
|
"@esri/arcgis-rest-request": "^3.7.0",
|
|
25
25
|
"@esri/arcgis-rest-service-admin": "^3.7.0",
|
|
26
|
-
"@esri/hub-common": "^14.
|
|
26
|
+
"@esri/hub-common": "^14.109.1",
|
|
27
27
|
"@esri/hub-initiatives": "^14.0.0",
|
|
28
|
-
"@esri/hub-sites": "^14.2.
|
|
28
|
+
"@esri/hub-sites": "^14.2.4",
|
|
29
29
|
"@esri/hub-teams": "^14.1.0",
|
|
30
|
-
"@esri/solution-common": "^5.2.
|
|
31
|
-
"@esri/solution-feature-layer": "^5.2.
|
|
32
|
-
"@esri/solution-file": "^5.2.
|
|
33
|
-
"@esri/solution-group": "^5.2.
|
|
34
|
-
"@esri/solution-simple-types": "^5.2.
|
|
35
|
-
"@esri/solution-storymap": "^5.2.
|
|
30
|
+
"@esri/solution-common": "^5.2.10",
|
|
31
|
+
"@esri/solution-feature-layer": "^5.2.10",
|
|
32
|
+
"@esri/solution-file": "^5.2.10",
|
|
33
|
+
"@esri/solution-group": "^5.2.10",
|
|
34
|
+
"@esri/solution-simple-types": "^5.2.10",
|
|
35
|
+
"@esri/solution-storymap": "^5.2.10",
|
|
36
36
|
"@types/jasmine": "^5.1.4",
|
|
37
37
|
"fetch-mock": "^7.7.3",
|
|
38
38
|
"jasmine": "^5.1.0",
|
|
39
39
|
"jasmine-core": "^5.1.0",
|
|
40
|
-
"rollup": "^4.13.
|
|
40
|
+
"rollup": "^4.13.2"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"tslib": "1.14.1"
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"esri",
|
|
79
79
|
"ES6"
|
|
80
80
|
],
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "5ad94c5c39559c3399cc7c42ba1b0075ec618bf4"
|
|
82
82
|
}
|