@esri/solution-simple-types 5.3.7 → 5.4.1
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/helpers/convert-item-to-template.d.ts +0 -11
- package/dist/cjs/helpers/convert-item-to-template.js +2 -59
- package/dist/cjs/helpers/convert-item-to-template.js.map +1 -1
- package/dist/cjs/notebook.d.ts +2 -1
- package/dist/cjs/notebook.js +39 -23
- package/dist/cjs/notebook.js.map +1 -1
- package/dist/esm/helpers/convert-item-to-template.d.ts +0 -11
- package/dist/esm/helpers/convert-item-to-template.js +1 -57
- package/dist/esm/helpers/convert-item-to-template.js.map +1 -1
- package/dist/esm/notebook.d.ts +2 -1
- package/dist/esm/notebook.js +39 -23
- package/dist/esm/notebook.js.map +1 -1
- package/package.json +9 -9
- package/dist/cjs/helpers/formHelpers.d.ts +0 -24
- package/dist/cjs/helpers/formHelpers.js +0 -57
- package/dist/cjs/helpers/formHelpers.js.map +0 -1
- package/dist/esm/helpers/formHelpers.d.ts +0 -24
- package/dist/esm/helpers/formHelpers.js +0 -52
- package/dist/esm/helpers/formHelpers.js.map +0 -1
|
@@ -32,14 +32,3 @@ export declare function convertItemToTemplate(itemInfo: any, destAuthentication:
|
|
|
32
32
|
* @return List of feature layer ids or an empty list if there are no sources or sinks in the pipeline
|
|
33
33
|
*/
|
|
34
34
|
export declare function _getDataPipelineSourcesAndSinks(itemData: any): string[];
|
|
35
|
-
/**
|
|
36
|
-
* Encapsulates the rules for naming a form's data file.
|
|
37
|
-
* Chooses the first parameter that's defined and is not the string "undefined".
|
|
38
|
-
*
|
|
39
|
-
* @param itemName Template's item name
|
|
40
|
-
* @param dataFilename The data file name
|
|
41
|
-
* @param itemIdAsName A name constructed from the template's id suffixed with ".zip"
|
|
42
|
-
*
|
|
43
|
-
* @return A name for the data file
|
|
44
|
-
*/
|
|
45
|
-
export declare function _getFormDataFilename(itemName: string, dataFilename: string, itemIdAsName: string): string;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports._getDataPipelineSourcesAndSinks = exports.convertItemToTemplate = void 0;
|
|
19
19
|
const tslib_1 = require("tslib");
|
|
20
20
|
const common = tslib_1.__importStar(require("@esri/solution-common"));
|
|
21
21
|
const dashboard = tslib_1.__importStar(require("../dashboard"));
|
|
@@ -25,7 +25,6 @@ const quickcapture = tslib_1.__importStar(require("../quickcapture"));
|
|
|
25
25
|
const webmap = tslib_1.__importStar(require("../webmap"));
|
|
26
26
|
const webmappingapplication = tslib_1.__importStar(require("../webmappingapplication"));
|
|
27
27
|
const workforce = tslib_1.__importStar(require("../workforce"));
|
|
28
|
-
const formHelpers = tslib_1.__importStar(require("./formHelpers"));
|
|
29
28
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
30
29
|
/**
|
|
31
30
|
* Converts an item into a template.
|
|
@@ -110,46 +109,8 @@ function convertItemToTemplate(itemInfo, destAuthentication, srcAuthentication,
|
|
|
110
109
|
case "Dashboard":
|
|
111
110
|
dashboard.convertItemToTemplate(itemTemplate, templateDictionary);
|
|
112
111
|
break;
|
|
113
|
-
case "Form":
|
|
114
|
-
// Store the form's data in the solution resources, not in template
|
|
115
|
-
itemTemplate.data = null;
|
|
116
|
-
// Add the form data to the template for a post-process resource upload
|
|
117
|
-
if (itemDataResponse) {
|
|
118
|
-
templateModifyingPromise = new Promise(
|
|
119
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises, no-async-promise-executor
|
|
120
|
-
async (resolve) => {
|
|
121
|
-
let zipObject = await common.blobToZipObject(itemDataResponse);
|
|
122
|
-
// Templatize the form's webhooks
|
|
123
|
-
const portal = await srcAuthentication.getPortal();
|
|
124
|
-
let sourceOrgUrl;
|
|
125
|
-
if (portal.urlKey) {
|
|
126
|
-
sourceOrgUrl = `https://${portal.urlKey}.maps.arcgis.com`;
|
|
127
|
-
}
|
|
128
|
-
else if (portal.portalHostname) {
|
|
129
|
-
sourceOrgUrl = `https://${portal.portalHostname}`;
|
|
130
|
-
}
|
|
131
|
-
if (sourceOrgUrl) {
|
|
132
|
-
zipObject = await formHelpers.templatizeFormWebHooks(zipObject, sourceOrgUrl);
|
|
133
|
-
}
|
|
134
|
-
itemTemplate.item.name = _getFormDataFilename(itemTemplate.item.name, itemDataResponse.name, `${itemTemplate.itemId}.zip`);
|
|
135
|
-
const templatizedFormData = await common.zipObjectToZipFile(zipObject, itemTemplate.item.name);
|
|
136
|
-
// Add the data file to the template so that it can be uploaded with the other resources in the solution
|
|
137
|
-
const storageName = common.convertItemResourceToStorageResource(itemTemplate.itemId, itemTemplate.item.name, common.SolutionTemplateFormatVersion, common.SolutionResourceType.data);
|
|
138
|
-
const dataFile = {
|
|
139
|
-
itemId: itemTemplate.itemId,
|
|
140
|
-
file: templatizedFormData,
|
|
141
|
-
folder: storageName.folder,
|
|
142
|
-
filename: itemTemplate.item.name
|
|
143
|
-
};
|
|
144
|
-
itemTemplate.dataFile = dataFile;
|
|
145
|
-
// Update the template's resources
|
|
146
|
-
itemTemplate.resources.push(storageName.folder + "/" + storageName.filename);
|
|
147
|
-
resolve(itemTemplate);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
break;
|
|
151
112
|
case "Notebook":
|
|
152
|
-
notebook.convertNotebookToTemplate(itemTemplate);
|
|
113
|
+
templateModifyingPromise = notebook.convertNotebookToTemplate(itemTemplate, srcAuthentication);
|
|
153
114
|
break;
|
|
154
115
|
case "Oriented Imagery Catalog":
|
|
155
116
|
templateModifyingPromise = oic.convertItemToTemplate(itemTemplate, destAuthentication, srcAuthentication);
|
|
@@ -235,22 +196,4 @@ function _getDataPipelineSourcesAndSinks(itemData) {
|
|
|
235
196
|
return dependencies;
|
|
236
197
|
}
|
|
237
198
|
exports._getDataPipelineSourcesAndSinks = _getDataPipelineSourcesAndSinks;
|
|
238
|
-
/**
|
|
239
|
-
* Encapsulates the rules for naming a form's data file.
|
|
240
|
-
* Chooses the first parameter that's defined and is not the string "undefined".
|
|
241
|
-
*
|
|
242
|
-
* @param itemName Template's item name
|
|
243
|
-
* @param dataFilename The data file name
|
|
244
|
-
* @param itemIdAsName A name constructed from the template's id suffixed with ".zip"
|
|
245
|
-
*
|
|
246
|
-
* @return A name for the data file
|
|
247
|
-
*/
|
|
248
|
-
function _getFormDataFilename(itemName, dataFilename, itemIdAsName) {
|
|
249
|
-
const originalFilename = itemName || dataFilename;
|
|
250
|
-
const filename = originalFilename && originalFilename !== "undefined"
|
|
251
|
-
? originalFilename
|
|
252
|
-
: itemIdAsName;
|
|
253
|
-
return filename;
|
|
254
|
-
}
|
|
255
|
-
exports._getFormDataFilename = _getFormDataFilename;
|
|
256
199
|
//# sourceMappingURL=convert-item-to-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-item-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-item-to-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,sEAAgD;AAChD,gEAA0C;AAC1C,8DAAwC;AACxC,oDAA8B;AAC9B,sEAAgD;AAChD,0DAAoC;AACpC,wFAAkE;AAClE,gEAA0C;
|
|
1
|
+
{"version":3,"file":"convert-item-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-item-to-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,sEAAgD;AAChD,gEAA0C;AAC1C,8DAAwC;AACxC,oDAA8B;AAC9B,sEAAgD;AAChD,0DAAoC;AACpC,wFAAkE;AAClE,gEAA0C;AAE1C,wHAAwH;AAExH;;;;;;;;;GASG;AACH,SAAgB,qBAAqB,CACnC,QAAa,EACb,kBAAsC,EACtC,iBAAqC,EACrC,kBAAuB;IAEvB,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3D,gBAAgB;QACh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GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAChC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AA/MD,sDA+MC;AAED;;;;;GAKG;AACH,SAAgB,+BAA+B,CAC7C,QAAa;IAEb,MAAM,YAAY,GAAG,EAAc,CAAC;IACpC,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IAEjF,eAAe,CAAC,OAAO,CACrB,YAAY,CAAC,EAAE;QACb,IAAI,YAAY,CAAC,IAAI,KAAK,sBAAsB,IAAI,YAAY,CAAC,IAAI,KAAK,oBAAoB,EAAE;YAC9F,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,+BAA+B,CAAC,CAAA;YACtF,IAAI,gBAAgB,EAAE;gBACpB,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACrC;SACF;IACH,CAAC,CACF,CAAC;IAEF,OAAO,YAAY,CAAC;AACtB,CAAC;AAlBD,0EAkBC"}
|
package/dist/cjs/notebook.d.ts
CHANGED
|
@@ -29,9 +29,10 @@ export declare function createItemFromTemplate(template: common.IItemTemplate, t
|
|
|
29
29
|
* Converts a Python Notebook item to a template.
|
|
30
30
|
*
|
|
31
31
|
* @param itemTemplate template for the Python Notebook
|
|
32
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
32
33
|
* @returns templatized itemTemplate
|
|
33
34
|
*/
|
|
34
|
-
export declare function convertNotebookToTemplate(itemTemplate: common.IItemTemplate): common.IItemTemplate
|
|
35
|
+
export declare function convertNotebookToTemplate(itemTemplate: common.IItemTemplate, srcAuthentication: common.UserSession): Promise<common.IItemTemplate>;
|
|
35
36
|
/**
|
|
36
37
|
* Remove interpreter and papermill props
|
|
37
38
|
*
|
package/dist/cjs/notebook.js
CHANGED
|
@@ -46,32 +46,48 @@ exports.createItemFromTemplate = createItemFromTemplate;
|
|
|
46
46
|
* Converts a Python Notebook item to a template.
|
|
47
47
|
*
|
|
48
48
|
* @param itemTemplate template for the Python Notebook
|
|
49
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
49
50
|
* @returns templatized itemTemplate
|
|
50
51
|
*/
|
|
51
|
-
function convertNotebookToTemplate(itemTemplate) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
52
|
+
function convertNotebookToTemplate(itemTemplate, srcAuthentication) {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
// The templates data to process
|
|
55
|
+
const data = itemTemplate.data;
|
|
56
|
+
deleteProps(data);
|
|
57
|
+
let dataString = JSON.stringify(data);
|
|
58
|
+
const idTest = /[0-9A-F]{32}/gim;
|
|
59
|
+
if (data && idTest.test(dataString)) {
|
|
60
|
+
const ids = dataString.match(idTest);
|
|
61
|
+
const promises = [];
|
|
62
|
+
const verifiedIds = [];
|
|
63
|
+
const idLookup = [];
|
|
64
|
+
ids.forEach(id => {
|
|
65
|
+
if (verifiedIds.indexOf(id) === -1) {
|
|
66
|
+
promises.push(common.isItem(id, srcAuthentication));
|
|
67
|
+
idLookup.push(id);
|
|
68
|
+
promises.push(common.isGroup(id, srcAuthentication));
|
|
69
|
+
idLookup.push(id);
|
|
69
70
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
});
|
|
72
|
+
Promise.all(promises).then((results) => {
|
|
73
|
+
results.forEach((isValid, i) => {
|
|
74
|
+
const id = idLookup[i];
|
|
75
|
+
if (isValid && verifiedIds.indexOf(id) < 0) {
|
|
76
|
+
verifiedIds.push(id);
|
|
77
|
+
// templatize the itemId--but only once per unique id
|
|
78
|
+
const regEx = new RegExp(id, "gm");
|
|
79
|
+
dataString = dataString.replace(regEx, "{{" + id + ".itemId}}");
|
|
80
|
+
// update the dependencies
|
|
81
|
+
if (itemTemplate.dependencies.indexOf(id) === -1) {
|
|
82
|
+
itemTemplate.dependencies.push(id);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
itemTemplate.data = JSON.parse(dataString);
|
|
87
|
+
resolve(itemTemplate);
|
|
88
|
+
}, (error) => reject(JSON.stringify(error)));
|
|
89
|
+
}
|
|
90
|
+
});
|
|
75
91
|
}
|
|
76
92
|
exports.convertNotebookToTemplate = convertNotebookToTemplate;
|
|
77
93
|
/**
|
package/dist/cjs/notebook.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notebook.js","sourceRoot":"","sources":["../../src/notebook.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,sEAAgD;AAChD,+CAA+C;AAC/C,oFAA8D;AAE9D;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACnC,QAAa,EACb,kBAAsC,EACtC,iBAAqC,EACrC,kBAAuB;IAEvB,6DAA6D;IAC7D,mEAAmE;IACnE,oCAAoC;IACpC,OAAO,eAAe,CAAC,qBAAqB,CAC1C,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,CACnB,CAAC;AACJ,CAAC;AAfD,sDAeC;AAED,gCAAgC;AAChC,oCAAoC;AACpC,SAAgB,sBAAsB,CACpC,QAA8B,EAC9B,kBAAuB,EACvB,yBAA6C,EAC7C,oBAAkD;IAElD,OAAO,eAAe,CAAC,sBAAsB,CAC3C,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,CACrB,CAAC;AACJ,CAAC;AAZD,wDAYC;AAED
|
|
1
|
+
{"version":3,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AgB,WAAW,CACzB,MAAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAA8B,EAC9B,SAAiC,EACjC,kBAAuB,EACvB,cAAkC;IAElC,OAAO,MAAM,CAAC,gCAAgC,CAC5C,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf,CAAC;AACJ,CAAC;AAdD,kCAcC"}
|
|
@@ -32,14 +32,3 @@ export declare function convertItemToTemplate(itemInfo: any, destAuthentication:
|
|
|
32
32
|
* @return List of feature layer ids or an empty list if there are no sources or sinks in the pipeline
|
|
33
33
|
*/
|
|
34
34
|
export declare function _getDataPipelineSourcesAndSinks(itemData: any): string[];
|
|
35
|
-
/**
|
|
36
|
-
* Encapsulates the rules for naming a form's data file.
|
|
37
|
-
* Chooses the first parameter that's defined and is not the string "undefined".
|
|
38
|
-
*
|
|
39
|
-
* @param itemName Template's item name
|
|
40
|
-
* @param dataFilename The data file name
|
|
41
|
-
* @param itemIdAsName A name constructed from the template's id suffixed with ".zip"
|
|
42
|
-
*
|
|
43
|
-
* @return A name for the data file
|
|
44
|
-
*/
|
|
45
|
-
export declare function _getFormDataFilename(itemName: string, dataFilename: string, itemIdAsName: string): string;
|
|
@@ -21,7 +21,6 @@ import * as quickcapture from "../quickcapture";
|
|
|
21
21
|
import * as webmap from "../webmap";
|
|
22
22
|
import * as webmappingapplication from "../webmappingapplication";
|
|
23
23
|
import * as workforce from "../workforce";
|
|
24
|
-
import * as formHelpers from "./formHelpers";
|
|
25
24
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
26
25
|
/**
|
|
27
26
|
* Converts an item into a template.
|
|
@@ -106,46 +105,8 @@ export function convertItemToTemplate(itemInfo, destAuthentication, srcAuthentic
|
|
|
106
105
|
case "Dashboard":
|
|
107
106
|
dashboard.convertItemToTemplate(itemTemplate, templateDictionary);
|
|
108
107
|
break;
|
|
109
|
-
case "Form":
|
|
110
|
-
// Store the form's data in the solution resources, not in template
|
|
111
|
-
itemTemplate.data = null;
|
|
112
|
-
// Add the form data to the template for a post-process resource upload
|
|
113
|
-
if (itemDataResponse) {
|
|
114
|
-
templateModifyingPromise = new Promise(
|
|
115
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises, no-async-promise-executor
|
|
116
|
-
async (resolve) => {
|
|
117
|
-
let zipObject = await common.blobToZipObject(itemDataResponse);
|
|
118
|
-
// Templatize the form's webhooks
|
|
119
|
-
const portal = await srcAuthentication.getPortal();
|
|
120
|
-
let sourceOrgUrl;
|
|
121
|
-
if (portal.urlKey) {
|
|
122
|
-
sourceOrgUrl = `https://${portal.urlKey}.maps.arcgis.com`;
|
|
123
|
-
}
|
|
124
|
-
else if (portal.portalHostname) {
|
|
125
|
-
sourceOrgUrl = `https://${portal.portalHostname}`;
|
|
126
|
-
}
|
|
127
|
-
if (sourceOrgUrl) {
|
|
128
|
-
zipObject = await formHelpers.templatizeFormWebHooks(zipObject, sourceOrgUrl);
|
|
129
|
-
}
|
|
130
|
-
itemTemplate.item.name = _getFormDataFilename(itemTemplate.item.name, itemDataResponse.name, `${itemTemplate.itemId}.zip`);
|
|
131
|
-
const templatizedFormData = await common.zipObjectToZipFile(zipObject, itemTemplate.item.name);
|
|
132
|
-
// Add the data file to the template so that it can be uploaded with the other resources in the solution
|
|
133
|
-
const storageName = common.convertItemResourceToStorageResource(itemTemplate.itemId, itemTemplate.item.name, common.SolutionTemplateFormatVersion, common.SolutionResourceType.data);
|
|
134
|
-
const dataFile = {
|
|
135
|
-
itemId: itemTemplate.itemId,
|
|
136
|
-
file: templatizedFormData,
|
|
137
|
-
folder: storageName.folder,
|
|
138
|
-
filename: itemTemplate.item.name
|
|
139
|
-
};
|
|
140
|
-
itemTemplate.dataFile = dataFile;
|
|
141
|
-
// Update the template's resources
|
|
142
|
-
itemTemplate.resources.push(storageName.folder + "/" + storageName.filename);
|
|
143
|
-
resolve(itemTemplate);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
break;
|
|
147
108
|
case "Notebook":
|
|
148
|
-
notebook.convertNotebookToTemplate(itemTemplate);
|
|
109
|
+
templateModifyingPromise = notebook.convertNotebookToTemplate(itemTemplate, srcAuthentication);
|
|
149
110
|
break;
|
|
150
111
|
case "Oriented Imagery Catalog":
|
|
151
112
|
templateModifyingPromise = oic.convertItemToTemplate(itemTemplate, destAuthentication, srcAuthentication);
|
|
@@ -229,21 +190,4 @@ export function _getDataPipelineSourcesAndSinks(itemData) {
|
|
|
229
190
|
});
|
|
230
191
|
return dependencies;
|
|
231
192
|
}
|
|
232
|
-
/**
|
|
233
|
-
* Encapsulates the rules for naming a form's data file.
|
|
234
|
-
* Chooses the first parameter that's defined and is not the string "undefined".
|
|
235
|
-
*
|
|
236
|
-
* @param itemName Template's item name
|
|
237
|
-
* @param dataFilename The data file name
|
|
238
|
-
* @param itemIdAsName A name constructed from the template's id suffixed with ".zip"
|
|
239
|
-
*
|
|
240
|
-
* @return A name for the data file
|
|
241
|
-
*/
|
|
242
|
-
export function _getFormDataFilename(itemName, dataFilename, itemIdAsName) {
|
|
243
|
-
const originalFilename = itemName || dataFilename;
|
|
244
|
-
const filename = originalFilename && originalFilename !== "undefined"
|
|
245
|
-
? originalFilename
|
|
246
|
-
: itemIdAsName;
|
|
247
|
-
return filename;
|
|
248
|
-
}
|
|
249
193
|
//# sourceMappingURL=convert-item-to-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-item-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-item-to-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,qBAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"convert-item-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-item-to-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,YAAY,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,qBAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAE1C,wHAAwH;AAExH;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAa,EACb,kBAAsC,EACtC,iBAAqC,EACrC,kBAAuB;IAEvB,OAAO,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3D,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,CAAC;QAEF,wBAAwB;QACxB,MAAM,cAAc,GAAG,MAAM,CAAC,kCAAkC,CAC9D,YAAY,CAAC,MAAM,EACnB,SAAS,EACT,iBAAiB,CAClB,CAAC;QAEF,iCAAiC;QACjC,IAAI,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACtC,IAAI,gBAAgB,GAAG,OAAO,CAAC,OAAO,C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AK,oBAAoB,EAAE;YAC9F,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,+BAA+B,CAAC,CAAA;YACtF,IAAI,gBAAgB,EAAE;gBACpB,YAAY,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;aACrC;SACF;IACH,CAAC,CACF,CAAC;IAEF,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
package/dist/esm/notebook.d.ts
CHANGED
|
@@ -29,9 +29,10 @@ export declare function createItemFromTemplate(template: common.IItemTemplate, t
|
|
|
29
29
|
* Converts a Python Notebook item to a template.
|
|
30
30
|
*
|
|
31
31
|
* @param itemTemplate template for the Python Notebook
|
|
32
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
32
33
|
* @returns templatized itemTemplate
|
|
33
34
|
*/
|
|
34
|
-
export declare function convertNotebookToTemplate(itemTemplate: common.IItemTemplate): common.IItemTemplate
|
|
35
|
+
export declare function convertNotebookToTemplate(itemTemplate: common.IItemTemplate, srcAuthentication: common.UserSession): Promise<common.IItemTemplate>;
|
|
35
36
|
/**
|
|
36
37
|
* Remove interpreter and papermill props
|
|
37
38
|
*
|
package/dist/esm/notebook.js
CHANGED
|
@@ -40,32 +40,48 @@ export function createItemFromTemplate(template, templateDictionary, destination
|
|
|
40
40
|
* Converts a Python Notebook item to a template.
|
|
41
41
|
*
|
|
42
42
|
* @param itemTemplate template for the Python Notebook
|
|
43
|
+
* @param srcAuthentication Credentials for requests to source items
|
|
43
44
|
* @returns templatized itemTemplate
|
|
44
45
|
*/
|
|
45
|
-
export function convertNotebookToTemplate(itemTemplate) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
46
|
+
export function convertNotebookToTemplate(itemTemplate, srcAuthentication) {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
// The templates data to process
|
|
49
|
+
const data = itemTemplate.data;
|
|
50
|
+
deleteProps(data);
|
|
51
|
+
let dataString = JSON.stringify(data);
|
|
52
|
+
const idTest = /[0-9A-F]{32}/gim;
|
|
53
|
+
if (data && idTest.test(dataString)) {
|
|
54
|
+
const ids = dataString.match(idTest);
|
|
55
|
+
const promises = [];
|
|
56
|
+
const verifiedIds = [];
|
|
57
|
+
const idLookup = [];
|
|
58
|
+
ids.forEach(id => {
|
|
59
|
+
if (verifiedIds.indexOf(id) === -1) {
|
|
60
|
+
promises.push(common.isItem(id, srcAuthentication));
|
|
61
|
+
idLookup.push(id);
|
|
62
|
+
promises.push(common.isGroup(id, srcAuthentication));
|
|
63
|
+
idLookup.push(id);
|
|
63
64
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
});
|
|
66
|
+
Promise.all(promises).then((results) => {
|
|
67
|
+
results.forEach((isValid, i) => {
|
|
68
|
+
const id = idLookup[i];
|
|
69
|
+
if (isValid && verifiedIds.indexOf(id) < 0) {
|
|
70
|
+
verifiedIds.push(id);
|
|
71
|
+
// templatize the itemId--but only once per unique id
|
|
72
|
+
const regEx = new RegExp(id, "gm");
|
|
73
|
+
dataString = dataString.replace(regEx, "{{" + id + ".itemId}}");
|
|
74
|
+
// update the dependencies
|
|
75
|
+
if (itemTemplate.dependencies.indexOf(id) === -1) {
|
|
76
|
+
itemTemplate.dependencies.push(id);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
itemTemplate.data = JSON.parse(dataString);
|
|
81
|
+
resolve(itemTemplate);
|
|
82
|
+
}, (error) => reject(JSON.stringify(error)));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
69
85
|
}
|
|
70
86
|
/**
|
|
71
87
|
* Remove interpreter and papermill props
|
package/dist/esm/notebook.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notebook.js","sourceRoot":"","sources":["../../src/notebook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,+CAA+C;AAC/C,OAAO,KAAK,eAAe,MAAM,4BAA4B,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAa,EACb,kBAAsC,EACtC,iBAAqC,EACrC,kBAAuB;IAEvB,6DAA6D;IAC7D,mEAAmE;IACnE,oCAAoC;IACpC,OAAO,eAAe,CAAC,qBAAqB,CAC1C,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,CACnB,CAAC;AACJ,CAAC;AAED,gCAAgC;AAChC,oCAAoC;AACpC,MAAM,UAAU,sBAAsB,CACpC,QAA8B,EAC9B,kBAAuB,EACvB,yBAA6C,EAC7C,oBAAkD;IAElD,OAAO,eAAe,CAAC,sBAAsB,CAC3C,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,CACrB,CAAC;AACJ,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"notebook.js","sourceRoot":"","sources":["../../src/notebook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAChD,+CAA+C;AAC/C,OAAO,KAAK,eAAe,MAAM,4BAA4B,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAa,EACb,kBAAsC,EACtC,iBAAqC,EACrC,kBAAuB;IAEvB,6DAA6D;IAC7D,mEAAmE;IACnE,oCAAoC;IACpC,OAAO,eAAe,CAAC,qBAAqB,CAC1C,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,CACnB,CAAC;AACJ,CAAC;AAED,gCAAgC;AAChC,oCAAoC;AACpC,MAAM,UAA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CAAC,CAAC,OAAO,CAAC,CAAC,IAAS,EAAE,EAAE;YACvC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;KACJ;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CACjC,gBAAsC,EACtC,gBAAsC,EACtC,kBAAuB,EACvB,cAAkC;IAElC,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,aAAa,GAAuB;YACxC,EAAE,EAAE,gBAAgB,CAAC,MAAM;YAC3B,GAAG,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG;YAC9B,IAAI,EAAE,MAAM,CAAC,UAAU,CACrB,gBAAgB,CAAC,IAAI,EACrB,gBAAgB,CAAC,MAAM,GAAG,QAAQ,CACnC;SACF,CAAC;QACF,MAAM;aACH,UAAU,CAAC,aAAa,EAAE,cAAc,CAAC;aACzC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,IAAY,EACZ,SAAgB,EAChB,QAA8B,EAC9B,SAAiC,EACjC,kBAAuB,EACvB,cAAkC;IAElC,OAAO,MAAM,CAAC,gCAAgC,CAC5C,MAAM,EACN,kBAAkB,EAClB,cAAc,CACf,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-simple-types",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.1",
|
|
4
4
|
"description": "Manages the creation and deployment of simple item types for @esri/solution.js.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -23,13 +23,13 @@
|
|
|
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.
|
|
27
|
-
"@esri/hub-sites": "^
|
|
28
|
-
"@esri/hub-teams": "^14.1.
|
|
29
|
-
"@esri/solution-common": "^5.
|
|
30
|
-
"@esri/solution-feature-layer": "^5.
|
|
31
|
-
"@esri/solution-file": "^5.
|
|
32
|
-
"@esri/solution-group": "^5.
|
|
26
|
+
"@esri/hub-common": "^14.157.0",
|
|
27
|
+
"@esri/hub-sites": "^15.0.0",
|
|
28
|
+
"@esri/hub-teams": "^14.1.1",
|
|
29
|
+
"@esri/solution-common": "^5.4.1",
|
|
30
|
+
"@esri/solution-feature-layer": "^5.4.1",
|
|
31
|
+
"@esri/solution-file": "^5.4.1",
|
|
32
|
+
"@esri/solution-group": "^5.4.1",
|
|
33
33
|
"@types/jasmine": "^5.1.4",
|
|
34
34
|
"fetch-mock": "^7.7.3",
|
|
35
35
|
"jasmine": "^5.1.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"esri",
|
|
91
91
|
"ES6"
|
|
92
92
|
],
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "34d872d5a1796ff00c8f6021992902694efe4dbf"
|
|
94
94
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2024 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 JSZip from "jszip";
|
|
17
|
-
/**
|
|
18
|
-
* Templatizes the URLs in webhooks in a form's zip object. Assumes ArcGIS Online.
|
|
19
|
-
*
|
|
20
|
-
* @param zipObject Form zip object to templatize; it is modified in place
|
|
21
|
-
* @param sourceOrgUrl URL of the source organization, e.g., "https://myorg.maps.arcgis.com"
|
|
22
|
-
* @returns Promise that resolves to the modified zip object
|
|
23
|
-
*/
|
|
24
|
-
export declare function templatizeFormWebHooks(zipObject: JSZip, sourceOrgUrl: string): Promise<JSZip>;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/** @license
|
|
3
|
-
* Copyright 2024 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.templatizeFormWebHooks = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const common = tslib_1.__importStar(require("@esri/solution-common"));
|
|
21
|
-
// ------------------------------------------------------------------------------------------------------------------ //
|
|
22
|
-
/**
|
|
23
|
-
* Templatizes the URLs in webhooks in a form's zip object. Assumes ArcGIS Online.
|
|
24
|
-
*
|
|
25
|
-
* @param zipObject Form zip object to templatize; it is modified in place
|
|
26
|
-
* @param sourceOrgUrl URL of the source organization, e.g., "https://myorg.maps.arcgis.com"
|
|
27
|
-
* @returns Promise that resolves to the modified zip object
|
|
28
|
-
*/
|
|
29
|
-
async function templatizeFormWebHooks(zipObject, sourceOrgUrl) {
|
|
30
|
-
const webhooks = await common.getWebHooksFromZipObject(zipObject);
|
|
31
|
-
if (webhooks.length > 0) {
|
|
32
|
-
webhooks.forEach((webhook) => {
|
|
33
|
-
// Templatize the webhook URL
|
|
34
|
-
let url = webhook.url;
|
|
35
|
-
const urlObj = new URL(url);
|
|
36
|
-
const server = `${urlObj.protocol}//${urlObj.host}`;
|
|
37
|
-
const workflowServer = "https://workflow.arcgis.com";
|
|
38
|
-
if (server === workflowServer) {
|
|
39
|
-
// Templatize organization
|
|
40
|
-
const partialPath = url.substring(workflowServer.length);
|
|
41
|
-
const partialPathParts = partialPath.split("/");
|
|
42
|
-
const orgId = partialPathParts[1];
|
|
43
|
-
url = url.replace(orgId, "{{user.orgId}}");
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
// Templatize server, but only if it matches the source org URL
|
|
47
|
-
url = url.replace(sourceOrgUrl, "{{portalBaseUrl}}");
|
|
48
|
-
}
|
|
49
|
-
webhook.url = url;
|
|
50
|
-
});
|
|
51
|
-
zipObject = await common.setWebHooksInZipObject(zipObject, webhooks);
|
|
52
|
-
}
|
|
53
|
-
// Return the modified zip object
|
|
54
|
-
return Promise.resolve(zipObject);
|
|
55
|
-
}
|
|
56
|
-
exports.templatizeFormWebHooks = templatizeFormWebHooks;
|
|
57
|
-
//# sourceMappingURL=formHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formHelpers.js","sourceRoot":"","sources":["../../../src/helpers/formHelpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,sEAAgD;AAGhD,wHAAwH;AAExH;;;;;;GAMG;AACI,KAAK,UAAU,sBAAsB,CAC1C,SAAgB,EA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
|
-
* 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 JSZip from "jszip";
|
|
17
|
-
/**
|
|
18
|
-
* Templatizes the URLs in webhooks in a form's zip object. Assumes ArcGIS Online.
|
|
19
|
-
*
|
|
20
|
-
* @param zipObject Form zip object to templatize; it is modified in place
|
|
21
|
-
* @param sourceOrgUrl URL of the source organization, e.g., "https://myorg.maps.arcgis.com"
|
|
22
|
-
* @returns Promise that resolves to the modified zip object
|
|
23
|
-
*/
|
|
24
|
-
export declare function templatizeFormWebHooks(zipObject: JSZip, sourceOrgUrl: string): Promise<JSZip>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/** @license
|
|
2
|
-
* Copyright 2024 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 * as common from "@esri/solution-common";
|
|
17
|
-
// ------------------------------------------------------------------------------------------------------------------ //
|
|
18
|
-
/**
|
|
19
|
-
* Templatizes the URLs in webhooks in a form's zip object. Assumes ArcGIS Online.
|
|
20
|
-
*
|
|
21
|
-
* @param zipObject Form zip object to templatize; it is modified in place
|
|
22
|
-
* @param sourceOrgUrl URL of the source organization, e.g., "https://myorg.maps.arcgis.com"
|
|
23
|
-
* @returns Promise that resolves to the modified zip object
|
|
24
|
-
*/
|
|
25
|
-
export async function templatizeFormWebHooks(zipObject, sourceOrgUrl) {
|
|
26
|
-
const webhooks = await common.getWebHooksFromZipObject(zipObject);
|
|
27
|
-
if (webhooks.length > 0) {
|
|
28
|
-
webhooks.forEach((webhook) => {
|
|
29
|
-
// Templatize the webhook URL
|
|
30
|
-
let url = webhook.url;
|
|
31
|
-
const urlObj = new URL(url);
|
|
32
|
-
const server = `${urlObj.protocol}//${urlObj.host}`;
|
|
33
|
-
const workflowServer = "https://workflow.arcgis.com";
|
|
34
|
-
if (server === workflowServer) {
|
|
35
|
-
// Templatize organization
|
|
36
|
-
const partialPath = url.substring(workflowServer.length);
|
|
37
|
-
const partialPathParts = partialPath.split("/");
|
|
38
|
-
const orgId = partialPathParts[1];
|
|
39
|
-
url = url.replace(orgId, "{{user.orgId}}");
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
// Templatize server, but only if it matches the source org URL
|
|
43
|
-
url = url.replace(sourceOrgUrl, "{{portalBaseUrl}}");
|
|
44
|
-
}
|
|
45
|
-
webhook.url = url;
|
|
46
|
-
});
|
|
47
|
-
zipObject = await common.setWebHooksInZipObject(zipObject, webhooks);
|
|
48
|
-
}
|
|
49
|
-
// Return the modified zip object
|
|
50
|
-
return Promise.resolve(zipObject);
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=formHelpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formHelpers.js","sourceRoot":"","sources":["../../../src/helpers/formHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;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