@esri/solution-simple-types 5.2.1 → 5.2.3

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.
Files changed (61) hide show
  1. package/README.md +4 -7
  2. package/dist/esm/helpers/convert-item-to-template.d.ts +1 -2
  3. package/dist/esm/helpers/convert-item-to-template.js +24 -14
  4. package/dist/esm/helpers/convert-item-to-template.js.map +1 -1
  5. package/dist/{cjs/helpers/create-item-from-template.d.ts → esm/helpers/formHelpers.d.ts} +11 -3
  6. package/dist/esm/helpers/formHelpers.js +53 -0
  7. package/dist/esm/helpers/formHelpers.js.map +1 -0
  8. package/dist/esm/notebook.d.ts +1 -2
  9. package/dist/esm/notebook.js +2 -3
  10. package/dist/esm/notebook.js.map +1 -1
  11. package/dist/esm/quickcapture.d.ts +1 -2
  12. package/dist/esm/quickcapture.js +2 -3
  13. package/dist/esm/quickcapture.js.map +1 -1
  14. package/dist/esm/simple-types.d.ts +1 -2
  15. package/dist/esm/simple-types.js +2 -3
  16. package/dist/esm/simple-types.js.map +1 -1
  17. package/package.json +7 -7
  18. package/dist/cjs/dashboard.d.ts +0 -93
  19. package/dist/cjs/dashboard.js +0 -353
  20. package/dist/cjs/dashboard.js.map +0 -1
  21. package/dist/cjs/helpers/convert-item-to-template.d.ts +0 -46
  22. package/dist/cjs/helpers/convert-item-to-template.js +0 -236
  23. package/dist/cjs/helpers/convert-item-to-template.js.map +0 -1
  24. package/dist/cjs/helpers/create-item-from-template.js +0 -154
  25. package/dist/cjs/helpers/create-item-from-template.js.map +0 -1
  26. package/dist/cjs/helpers/notebook-helpers.d.ts +0 -19
  27. package/dist/cjs/helpers/notebook-helpers.js +0 -25
  28. package/dist/cjs/helpers/notebook-helpers.js.map +0 -1
  29. package/dist/cjs/helpers/quickcapture-helpers.d.ts +0 -18
  30. package/dist/cjs/helpers/quickcapture-helpers.js +0 -23
  31. package/dist/cjs/helpers/quickcapture-helpers.js.map +0 -1
  32. package/dist/cjs/helpers/simple-type-helpers.d.ts +0 -18
  33. package/dist/cjs/helpers/simple-type-helpers.js +0 -23
  34. package/dist/cjs/helpers/simple-type-helpers.js.map +0 -1
  35. package/dist/cjs/helpers/update-notebook-data.d.ts +0 -17
  36. package/dist/cjs/helpers/update-notebook-data.js +0 -28
  37. package/dist/cjs/helpers/update-notebook-data.js.map +0 -1
  38. package/dist/cjs/index.d.ts +0 -27
  39. package/dist/cjs/index.js +0 -37
  40. package/dist/cjs/index.js.map +0 -1
  41. package/dist/cjs/notebook.d.ts +0 -66
  42. package/dist/cjs/notebook.js +0 -134
  43. package/dist/cjs/notebook.js.map +0 -1
  44. package/dist/cjs/oic.d.ts +0 -53
  45. package/dist/cjs/oic.js +0 -171
  46. package/dist/cjs/oic.js.map +0 -1
  47. package/dist/cjs/quickcapture.d.ts +0 -76
  48. package/dist/cjs/quickcapture.js +0 -144
  49. package/dist/cjs/quickcapture.js.map +0 -1
  50. package/dist/cjs/simple-types.d.ts +0 -57
  51. package/dist/cjs/simple-types.js +0 -95
  52. package/dist/cjs/simple-types.js.map +0 -1
  53. package/dist/cjs/webmap.d.ts +0 -102
  54. package/dist/cjs/webmap.js +0 -318
  55. package/dist/cjs/webmap.js.map +0 -1
  56. package/dist/cjs/webmappingapplication.d.ts +0 -176
  57. package/dist/cjs/webmappingapplication.js +0 -675
  58. package/dist/cjs/webmappingapplication.js.map +0 -1
  59. package/dist/cjs/workforce.d.ts +0 -34
  60. package/dist/cjs/workforce.js +0 -45
  61. package/dist/cjs/workforce.js.map +0 -1
@@ -1,353 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2018 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._updateReferences = exports._getDatasourceInfo = exports._templatizeByDatasource = exports._templatize = exports._updateDatasourceReferences = exports.postProcessFieldReferences = exports._getDatasourceDependencies = exports._extractDependencies = exports.convertItemToTemplate = void 0;
19
- const tslib_1 = require("tslib");
20
- const common = tslib_1.__importStar(require("@esri/solution-common"));
21
- /**
22
- * Converts a dashboard item to a template.
23
- *
24
- * @param itemTemplate Template for the dashboard item
25
- * @param templateDictionary Hash of key details used for variable replacement
26
- * @returns templatized itemTemplate
27
- */
28
- function convertItemToTemplate(itemTemplate, templateDictionary) {
29
- return _extractDependencies(itemTemplate, templateDictionary);
30
- }
31
- exports.convertItemToTemplate = convertItemToTemplate;
32
- /**
33
- * Templatizes all itemIds and updates the dependency array
34
- *
35
- * @param itemTemplate Template for the dashboard item
36
- * @param templateDictionary Hash of key details used for variable replacement
37
- * @returns The updated itemTemplate
38
- * @private
39
- */
40
- function _extractDependencies(itemTemplate, templateDictionary) {
41
- // get dependencies from any
42
- const updatePaths = [
43
- "data.desktopView.header",
44
- "data.desktopView.headerPanel.selectors",
45
- "data.desktopView.leftPanel.selectors",
46
- "data.desktopView.sidebar",
47
- "data.desktopView.urlParameters",
48
- "data.desktopView.widgets",
49
- "data.header",
50
- "data.headerPanel.selectors",
51
- "data.leftPanel.selectors",
52
- "data.mobileView.header",
53
- "data.mobileView.headerPanel.selectors",
54
- "data.mobileView.leftPanel.selectors",
55
- "data.mobileView.sidebar",
56
- "data.mobileView.urlParameters",
57
- "data.mobileView.widgets",
58
- "data.sidebar",
59
- "data.urlParameters",
60
- "data.widgets"
61
- ];
62
- updatePaths.forEach(path => {
63
- const objs = common.getProp(itemTemplate, path);
64
- if (Array.isArray(objs)) {
65
- objs.forEach(obj => {
66
- /* istanbul ignore else */
67
- if (obj.type === "mapWidget") {
68
- /* istanbul ignore else */
69
- if (itemTemplate.dependencies.indexOf(obj.itemId) < 0) {
70
- itemTemplate.dependencies.push(obj.itemId);
71
- }
72
- obj.itemId = common.templatizeTerm(obj.itemId, obj.itemId, ".itemId");
73
- }
74
- /* istanbul ignore else */
75
- if (Array.isArray(obj.datasets)) {
76
- _getDatasourceDependencies(obj, itemTemplate, templateDictionary);
77
- }
78
- });
79
- }
80
- });
81
- return itemTemplate;
82
- }
83
- exports._extractDependencies = _extractDependencies;
84
- /**
85
- * Templatize datasource itemIds and update the dependency array
86
- *
87
- * @param obj A widget, selector, or urlParameter that contains a datasets collection
88
- * @param itemTemplate Template for the dashboard item
89
- * @param templateDictionary Hash of key details used for variable replacement
90
- * @private
91
- */
92
- function _getDatasourceDependencies(obj, itemTemplate, templateDictionary) {
93
- obj.datasets.forEach((dataset) => {
94
- // when the datasource has an itemId it's an external datasource except if the datasource type is "arcadeDataSource"
95
- const dataSourceType = common.getProp(dataset, "dataSource.type");
96
- if (dataSourceType !== "arcadeDataSource") {
97
- const itemId = common.getProp(dataset, "dataSource.itemId");
98
- if (itemId) {
99
- if (itemTemplate.dependencies.indexOf(itemId) < 0) {
100
- itemTemplate.dependencies.push(itemId);
101
- }
102
- const layerId = common.getProp(dataset, "dataSource.layerId");
103
- common.cacheLayerInfo(layerId?.toString(), itemId, "", templateDictionary);
104
- dataset.dataSource.itemId = common.templatizeTerm(itemId, itemId, ".itemId");
105
- }
106
- }
107
- });
108
- }
109
- exports._getDatasourceDependencies = _getDatasourceDependencies;
110
- /**
111
- * Templatize field references for datasources and widgets.
112
- *
113
- * @param solutionTemplate The solution item template
114
- * @param datasourceInfos A list of datasource info objects that contain key values to templatize field references
115
- * @returns The solutionTemplate with templatized field references
116
- */
117
- function postProcessFieldReferences(solutionTemplate, datasourceInfos) {
118
- const updatePaths = [
119
- "data.desktopView.header",
120
- "data.desktopView.headerPanel.selectors",
121
- "data.desktopView.leftPanel.selectors",
122
- "data.desktopView.sidebar",
123
- "data.desktopView.urlParameters",
124
- "data.desktopView.widgets",
125
- "data.header",
126
- "data.headerPanel.selectors",
127
- "data.leftPanel.selectors",
128
- "data.mobileView.header",
129
- "data.mobileView.headerPanel.selectors",
130
- "data.mobileView.leftPanel.selectors",
131
- "data.mobileView.sidebar",
132
- "data.mobileView.urlParameters",
133
- "data.mobileView.widgets",
134
- "data.sidebar",
135
- "data.urlParameters",
136
- "data.widgets"
137
- ];
138
- // dashboards reference datasets from other widgets
139
- // add reference IDs to the appropriate datasourceInfos
140
- updatePaths.forEach(path => {
141
- const objs = common.getProp(solutionTemplate, path);
142
- _updateDatasourceReferences(objs, datasourceInfos);
143
- });
144
- // after we know the potential references go ahead and templatize
145
- updatePaths.forEach(path => {
146
- _templatize(solutionTemplate, path, datasourceInfos);
147
- });
148
- return solutionTemplate;
149
- }
150
- exports.postProcessFieldReferences = postProcessFieldReferences;
151
- /**
152
- * Add all dataset ids to the appropriate datasource info object so we can navigate any relative references
153
- *
154
- * @param objs Thes can be widgets, selectors, or urlParameters
155
- * @param datasourceInfos A list of objects that contain key details about the datasources from the application
156
- * @private
157
- */
158
- function _updateDatasourceReferences(objs, datasourceInfos) {
159
- // objects can be events or widgets
160
- /* istanbul ignore else */
161
- if (objs && Array.isArray(objs)) {
162
- objs.forEach(obj => {
163
- if (Array.isArray(obj.datasets)) {
164
- obj.datasets.forEach((dataset) => {
165
- // when the datasource has an itemId it's an external datasource
166
- const itemId = common.cleanItemId(common.getProp(dataset, "dataSource.itemId"));
167
- if (itemId) {
168
- const layerId = common.cleanLayerId(common.getProp(dataset, "dataSource.layerId"));
169
- datasourceInfos.some(ds => {
170
- if (ds.itemId === itemId && ds.layerId === layerId) {
171
- _updateReferences(ds, obj.id);
172
- return true;
173
- }
174
- else {
175
- return false;
176
- }
177
- });
178
- }
179
- else {
180
- // add placeholder for map layer datasource info so we can know the items that reference them
181
- // needed when item field reference are derived from another widgets datasource eg. <dashboardWidgetId>#datasetname
182
- const id = common.getProp(dataset, "dataSource.id");
183
- if (id) {
184
- const dashboardLayerId = id.split("#")[1];
185
- datasourceInfos.some(ds => {
186
- if (ds.ids.indexOf(dashboardLayerId) > -1) {
187
- _updateReferences(ds, obj.id);
188
- return true;
189
- }
190
- else {
191
- return false;
192
- }
193
- });
194
- }
195
- }
196
- });
197
- }
198
- });
199
- }
200
- }
201
- exports._updateDatasourceReferences = _updateDatasourceReferences;
202
- /**
203
- * Templatize all datasets and/or events for the objects at the given path
204
- *
205
- * @param itemTemplate Template for the dashboard item
206
- * @param path A property path to an array of objects that could contain datasets or events
207
- * @param datasourceInfos A list of objects that contain key details about the datasources from the application
208
- * @private
209
- */
210
- function _templatize(itemTemplate, path, datasourceInfos) {
211
- const obj = common.getProp(itemTemplate, path);
212
- /* istanbul ignore else */
213
- if (obj) {
214
- common.setProp(itemTemplate, path, _templatizeByDatasource(obj, datasourceInfos));
215
- }
216
- }
217
- exports._templatize = _templatize;
218
- /**
219
- * For any service dataset datasource templatize all field references
220
- *
221
- * @param objs A list of objects that can contain field references
222
- * @param datasourceInfos A list of objects that contain key details about the datasources from the application
223
- * @returns An updated list of objects with templatized field references
224
- * @private
225
- */
226
- function _templatizeByDatasource(objs, datasourceInfos) {
227
- if (Array.isArray(objs)) {
228
- return objs.map(obj => {
229
- let _obj = obj;
230
- if (Array.isArray(_obj.events)) {
231
- // Events can be associated with datasets but they can also be associated with a target
232
- // In some cases an event will have a source and a target.
233
- // Handle these specifically first to ensure that it has the correct layer reference
234
- _obj.events = _obj.events.map((event) => {
235
- const _event = event;
236
- /* istanbul ignore else */
237
- if (Array.isArray(_event.actions)) {
238
- _event.actions = _event.actions.map((action) => {
239
- const _action = action;
240
- if (_action.fieldMap &&
241
- _action.targetId &&
242
- _action.targetId.indexOf("#") > -1) {
243
- const datasourceInfo = _getDatasourceInfo(_action, datasourceInfos);
244
- /* istanbul ignore else */
245
- if (datasourceInfo) {
246
- const fields = common.getProp(datasourceInfo, "fields");
247
- const basePath = common.getProp(datasourceInfo, "basePath");
248
- /* istanbul ignore else */
249
- if (Array.isArray(fields) && basePath) {
250
- _action.fieldMap = _action.fieldMap.map((m) => {
251
- const _m = m;
252
- _m.targetName = common.templatizeFieldReferences(_m.targetName, fields, basePath);
253
- return _m;
254
- });
255
- }
256
- }
257
- }
258
- return _action;
259
- });
260
- }
261
- return _event;
262
- });
263
- }
264
- if (Array.isArray(_obj.datasets)) {
265
- _obj.datasets = _obj.datasets.map((dataset) => {
266
- let _dataset = dataset;
267
- if (_dataset.type === "serviceDataset") {
268
- const datasourceInfo = _getDatasourceInfo(dataset, datasourceInfos);
269
- /* istanbul ignore else */
270
- if (datasourceInfo) {
271
- const fields = common.getProp(datasourceInfo, "fields");
272
- const basePath = common.getProp(datasourceInfo, "basePath");
273
- /* istanbul ignore else */
274
- if (Array.isArray(fields) && basePath) {
275
- _obj = common.templatizeFieldReferences(_obj, fields, basePath);
276
- _dataset = common.templatizeFieldReferences(_dataset, fields, basePath);
277
- }
278
- }
279
- }
280
- return _dataset;
281
- });
282
- return _obj;
283
- }
284
- else
285
- return _obj;
286
- });
287
- }
288
- else {
289
- return objs;
290
- }
291
- }
292
- exports._templatizeByDatasource = _templatizeByDatasource;
293
- /**
294
- * Find the appropriate datasource info object from the datasourceInfo collection
295
- *
296
- * @param obj Can be a Dataset or an event
297
- * @param datasourceInfos A list of objects that contain key details about the datasources from the application
298
- * @returns The supporting datasource info for the given object
299
- * @private
300
- */
301
- function _getDatasourceInfo(obj, datasourceInfos) {
302
- let info;
303
- // the datasource will have an id property when it's referencing a map layer
304
- // the fields collection will already be defined
305
- const id = common.getProp(obj, "dataSource.id") || common.getProp(obj, "targetId");
306
- if (id) {
307
- const dashboardLayerId = id.split("#")[1];
308
- if (!datasourceInfos.some(di => {
309
- info = di.ids.indexOf(dashboardLayerId) > -1 ? di : info;
310
- return di.ids.indexOf(dashboardLayerId) > -1;
311
- })) {
312
- // in some cases the id will not contain a layer name...it will have the dashboard id for another widget
313
- // in that case lookup the datasource from referenced widget
314
- const dashboardWidgetId = id.split("#")[0];
315
- datasourceInfos.some(di => {
316
- const references = di.references || [];
317
- const hasRef = references.indexOf(dashboardWidgetId) > -1;
318
- info = hasRef ? di : info;
319
- return hasRef;
320
- });
321
- }
322
- }
323
- else {
324
- // otherwise match the itemId and the layerId to get the correct fields and path
325
- const itemId = common.cleanItemId(common.getProp(obj, "dataSource.itemId"));
326
- const layerId = common.cleanLayerId(common.getProp(obj, "dataSource.layerId"));
327
- /* istanbul ignore else */
328
- if (itemId) {
329
- datasourceInfos.some(di => {
330
- const matches = itemId === di.itemId && layerId === di.layerId;
331
- info = matches ? di : info;
332
- return matches;
333
- });
334
- }
335
- }
336
- return info;
337
- }
338
- exports._getDatasourceInfo = _getDatasourceInfo;
339
- /**
340
- * Verifies if the datasource info contains the given id and adds it if not
341
- *
342
- * @param ds The datasource info to add the reference to
343
- * @param id The id from dashboard object, commonly another widget
344
- * @private
345
- */
346
- function _updateReferences(ds, id) {
347
- ds.references = Array.isArray(ds.references) ? ds.references : [];
348
- if (ds.references.indexOf(id) < 0) {
349
- ds.references.push(id);
350
- }
351
- }
352
- exports._updateReferences = _updateReferences;
353
- //# sourceMappingURL=dashboard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/dashboard.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,sEAAgD;AA2DhD;;;;;;GAMG;AACH,SAAgB,qBAAqB,CACnC,YAAkC,EAClC,kBAAuB;IAEvB,OAAO,oBAAoB,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAC;AAChE,CAAC;AALD,sDAKC;AAED;;;;;;;GAOG;AACH,SAAgB,oBAAoB,CAClC,YAAkC,EAClC,kBAAuB;IAEvB,4BAA4B;IAC5B,MAAM,WAAW,GAAa;QAC5B,yBAAyB;QACzB,wCAAwC;QACxC,sCAAsC;QACtC,0BAA0B;QAC1B,gCAAgC;QAChC,0BAA0B;QAC1B,aAAa;QACb,4BAA4B;QAC5B,0BAA0B;QA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KAAK,EAAE,CAAC,MAAM,IAAI,OAAO,KAAK,EAAE,CAAC,OAAO,CAAC;gBACxE,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC3B,OAAO,OAAO,CAAC;YACjB,CAAC,CAAC,CAAC;SACJ;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AA7CD,gDA6CC;AAED;;;;;;GAMG;AACH,SAAgB,iBAAiB,CAC/B,EAA0B,EAC1B,EAAU;IAEV,EAAE,CAAC,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE;QACjC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KACxB;AACH,CAAC;AARD,8CAQC"}
@@ -1,46 +0,0 @@
1
- /** @license
2
- * Copyright 2020 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
- * Converts an item into a template.
19
- *
20
- * @param solutionItemId The solution to contain the template
21
- * @param itemInfo Info about the item
22
- * @param destAuthentication Credentials for requests to the destination organization
23
- * @param srcAuthentication Credentials for requests to source items
24
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
25
- *
26
- * @returns A promise that will resolve when the template has been created
27
- */
28
- export declare function convertItemToTemplate(solutionItemId: string, itemInfo: any, destAuthentication: common.UserSession, srcAuthentication: common.UserSession, templateDictionary: any): Promise<common.IItemTemplate>;
29
- /**
30
- * Extracts the feature layer ids for a Data Pipeline's sources and sinks.
31
- *
32
- * @param itemData Data Pipeline's data section
33
- * @return List of feature layer ids or an empty list if there are no sources or sinks in the pipeline
34
- */
35
- export declare function _getDataPipelineSourcesAndSinks(itemData: any): string[];
36
- /**
37
- * Encapsulates the rules for naming a form's data file.
38
- * Chooses the first parameter that's defined and is not the string "undefined".
39
- *
40
- * @param itemName Template's item name
41
- * @param dataFilename The data file name
42
- * @param itemIdAsName A name constructed from the template's id suffixed with ".zip"
43
- *
44
- * @return A name for the data file
45
- */
46
- export declare function _getFormDataFilename(itemName: string, dataFilename: string, itemIdAsName: string): string;
@@ -1,236 +0,0 @@
1
- "use strict";
2
- /** @license
3
- * Copyright 2020 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._getFormDataFilename = exports._getDataPipelineSourcesAndSinks = exports.convertItemToTemplate = void 0;
19
- const tslib_1 = require("tslib");
20
- const common = tslib_1.__importStar(require("@esri/solution-common"));
21
- const dashboard = tslib_1.__importStar(require("../dashboard"));
22
- const notebook = tslib_1.__importStar(require("../notebook"));
23
- const oic = tslib_1.__importStar(require("../oic"));
24
- const quickcapture = tslib_1.__importStar(require("../quickcapture"));
25
- const webmap = tslib_1.__importStar(require("../webmap"));
26
- const webmappingapplication = tslib_1.__importStar(require("../webmappingapplication"));
27
- const workforce = tslib_1.__importStar(require("../workforce"));
28
- /**
29
- * Converts an item into a template.
30
- *
31
- * @param solutionItemId The solution to contain the template
32
- * @param itemInfo Info about the item
33
- * @param destAuthentication Credentials for requests to the destination organization
34
- * @param srcAuthentication Credentials for requests to source items
35
- * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements
36
- *
37
- * @returns A promise that will resolve when the template has been created
38
- */
39
- function convertItemToTemplate(solutionItemId, itemInfo, destAuthentication, srcAuthentication, templateDictionary) {
40
- return new Promise((resolve, reject) => {
41
- // Init template
42
- const itemTemplate = common.createInitializedItemTemplate(itemInfo);
43
- // Templatize item info property values
44
- itemTemplate.item.id = common.templatizeTerm(itemTemplate.item.id, itemTemplate.item.id, ".itemId");
45
- // Request related items
46
- const relatedPromise = common.getItemRelatedItemsInSameDirection(itemTemplate.itemId, "forward", srcAuthentication);
47
- // Perform type-specific handling
48
- let dataPromise = Promise.resolve({});
49
- let resourcesPromise = Promise.resolve([]);
50
- switch (itemInfo.type) {
51
- case "Dashboard":
52
- case "Data Pipeline":
53
- case "Feature Collection":
54
- case "Feature Service":
55
- case "Hub Initiative":
56
- case "Hub Page":
57
- case "Hub Site Application":
58
- case "Insights Model":
59
- case "Oriented Imagery Catalog":
60
- case "Project Package":
61
- case "Workforce Project":
62
- case "Web Map":
63
- case "Web Mapping Application":
64
- case "Web Scene":
65
- case "Notebook":
66
- dataPromise = new Promise(resolveJSON => {
67
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
68
- common
69
- .getItemDataAsJson(itemTemplate.itemId, srcAuthentication)
70
- .then(json => resolveJSON(json));
71
- });
72
- break;
73
- case "Form":
74
- dataPromise = common.getItemDataAsFile(itemTemplate.itemId, itemTemplate.item.name, srcAuthentication);
75
- break;
76
- case "QuickCapture Project":
77
- // Fetch all of the resources to get the config
78
- resourcesPromise = common.getItemResourcesFiles(itemTemplate.itemId, srcAuthentication);
79
- break;
80
- }
81
- // Errors are handled as resolved empty values; this means that there's no `reject` clause to handle, hence:
82
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
83
- Promise.all([dataPromise, relatedPromise, resourcesPromise]).then(responses => {
84
- const [itemDataResponse, relatedItemsResponse, resourcesResponse] = responses;
85
- // need to pre-process for velocity urls before they could be templatized by other processors
86
- itemTemplate.data = common.updateVelocityReferences(itemDataResponse, itemInfo.type, templateDictionary);
87
- const relationships = relatedItemsResponse;
88
- // Save the mappings to related items & add those items to the dependencies, but not WMA Code Attachments
89
- itemTemplate.dependencies = [];
90
- itemTemplate.relatedItems = [];
91
- relationships.forEach(relationship => {
92
- /* istanbul ignore else */
93
- if (relationship.relationshipType !== "WMA2Code") {
94
- itemTemplate.relatedItems.push(relationship);
95
- relationship.relatedItemIds.forEach(relatedItemId => {
96
- if (itemTemplate.dependencies.indexOf(relatedItemId) < 0) {
97
- itemTemplate.dependencies.push(relatedItemId);
98
- }
99
- });
100
- }
101
- });
102
- // Add Data Pipeline source and sink feature layers to dependencies
103
- if (itemInfo.type === "Data Pipeline") {
104
- itemTemplate.dependencies = itemTemplate.dependencies.concat(_getDataPipelineSourcesAndSinks(itemDataResponse));
105
- }
106
- // Create the template
107
- let templateModifyingPromise = Promise.resolve(itemTemplate);
108
- switch (itemInfo.type) {
109
- case "Dashboard":
110
- dashboard.convertItemToTemplate(itemTemplate, templateDictionary);
111
- break;
112
- case "Form":
113
- // Store the form's data in the solution resources, not in template
114
- itemTemplate.data = null;
115
- // Add the form data to the template for a post-process resource upload
116
- if (itemDataResponse) {
117
- itemTemplate.item.name = _getFormDataFilename(itemTemplate.item.name, itemDataResponse.name, `${itemTemplate.itemId}.zip`);
118
- const storageName = common.convertItemResourceToStorageResource(itemTemplate.itemId, itemTemplate.item.name, common.SolutionTemplateFormatVersion, common.SolutionResourceType.data);
119
- // Add the data file to the template so that it can be uploaded with the other resources in the solution
120
- const dataFile = {
121
- itemId: itemTemplate.itemId,
122
- file: itemDataResponse,
123
- folder: storageName.folder,
124
- filename: itemTemplate.item.name
125
- };
126
- itemTemplate.dataFile = dataFile;
127
- // Update the template's resources
128
- itemTemplate.resources.push(storageName.folder + "/" + storageName.filename);
129
- }
130
- break;
131
- case "Notebook":
132
- notebook.convertNotebookToTemplate(itemTemplate);
133
- break;
134
- case "Oriented Imagery Catalog":
135
- templateModifyingPromise = oic.convertItemToTemplate(itemTemplate, destAuthentication, srcAuthentication);
136
- break;
137
- case "QuickCapture Project":
138
- // Save all of the resources that we've fetched so as to not fetch them again
139
- itemTemplate.resources = resourcesResponse;
140
- // Get the QC config
141
- templateModifyingPromise = new Promise(
142
- // eslint-disable-next-line @typescript-eslint/no-misused-promises, no-async-promise-executor
143
- async (qcResolve) => {
144
- // Remove the qc.project.json file from the list of resources
145
- let qcProjectFile = null;
146
- let iQcProjectFile = -1;
147
- if (resourcesResponse) {
148
- resourcesResponse.some((file, i) => {
149
- const haveConfigFile = file.name === "qc.project.json";
150
- if (haveConfigFile) {
151
- qcProjectFile = file;
152
- iQcProjectFile = i;
153
- }
154
- return haveConfigFile;
155
- });
156
- // Discard the qc.project.json file
157
- if (iQcProjectFile >= 0) {
158
- resourcesResponse.splice(iQcProjectFile, 1);
159
- }
160
- }
161
- // Copy the qc.project.json file into the data section
162
- if (qcProjectFile) {
163
- itemTemplate.data = {
164
- application: {
165
- ...await common.blobToJson(qcProjectFile),
166
- },
167
- name: "qc.project.json"
168
- };
169
- }
170
- // Save the basemap dependency
171
- if (itemTemplate.data.application?.basemap?.type === "Web Map") {
172
- itemTemplate.dependencies.push(itemTemplate.data.application.basemap.itemId);
173
- }
174
- // Create the template
175
- const updatedTemplate = quickcapture.convertQuickCaptureToTemplate(itemTemplate);
176
- qcResolve(updatedTemplate);
177
- });
178
- break;
179
- case "Vector Tile Service":
180
- case "Web Map":
181
- case "Web Scene":
182
- templateModifyingPromise = webmap.convertItemToTemplate(itemTemplate, destAuthentication, srcAuthentication, templateDictionary);
183
- break;
184
- case "Web Mapping Application":
185
- if (itemDataResponse) {
186
- templateModifyingPromise = webmappingapplication.convertItemToTemplate(itemTemplate, destAuthentication, srcAuthentication, templateDictionary);
187
- }
188
- break;
189
- case "Workforce Project":
190
- templateModifyingPromise = workforce.convertItemToTemplate(itemTemplate, destAuthentication, srcAuthentication, templateDictionary);
191
- break;
192
- }
193
- templateModifyingPromise.then(resolve, err => reject(common.fail(err)));
194
- });
195
- });
196
- }
197
- exports.convertItemToTemplate = convertItemToTemplate;
198
- /**
199
- * Extracts the feature layer ids for a Data Pipeline's sources and sinks.
200
- *
201
- * @param itemData Data Pipeline's data section
202
- * @return List of feature layer ids or an empty list if there are no sources or sinks in the pipeline
203
- */
204
- function _getDataPipelineSourcesAndSinks(itemData) {
205
- const dependencies = [];
206
- const sourcesAndSinks = (itemData?.inputs ?? []).concat(itemData?.outputs ?? []);
207
- sourcesAndSinks.forEach(sourceOrSink => {
208
- if (sourceOrSink.type === "FeatureServiceSource" || sourceOrSink.type === "FeatureServiceSink") {
209
- const featureServiceId = common.getProp(sourceOrSink, "parameters.layer.value.itemId");
210
- if (featureServiceId) {
211
- dependencies.push(featureServiceId);
212
- }
213
- }
214
- });
215
- return dependencies;
216
- }
217
- exports._getDataPipelineSourcesAndSinks = _getDataPipelineSourcesAndSinks;
218
- /**
219
- * Encapsulates the rules for naming a form's data file.
220
- * Chooses the first parameter that's defined and is not the string "undefined".
221
- *
222
- * @param itemName Template's item name
223
- * @param dataFilename The data file name
224
- * @param itemIdAsName A name constructed from the template's id suffixed with ".zip"
225
- *
226
- * @return A name for the data file
227
- */
228
- function _getFormDataFilename(itemName, dataFilename, itemIdAsName) {
229
- const originalFilename = itemName || dataFilename;
230
- const filename = originalFilename && originalFilename !== "undefined"
231
- ? originalFilename
232
- : itemIdAsName;
233
- return filename;
234
- }
235
- exports._getFormDataFilename = _getFormDataFilename;
236
- //# sourceMappingURL=convert-item-to-template.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"convert-item-to-template.js","sourceRoot":"","sources":["../../../src/helpers/convert-item-to-template.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;AAEH,s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