@esri/solutions-components 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/basemap-gallery_7.cjs.entry.js +2 -2
- package/dist/cjs/buffer-tools_3.cjs.entry.js +2 -2
- package/dist/cjs/calcite-action-pad_2.cjs.entry.js +2 -2
- package/dist/cjs/calcite-alert_4.cjs.entry.js +12 -10
- package/dist/cjs/calcite-block_5.cjs.entry.js +4 -4
- package/dist/cjs/calcite-dropdown-group_2.cjs.entry.js +2 -2
- package/dist/cjs/calcite-flow_6.cjs.entry.js +2 -2
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +5 -5
- package/dist/cjs/card-manager_3.cjs.entry.js +7 -6
- package/dist/cjs/{common-4d4cf291.js → common-61b41813.js} +1 -1
- package/dist/cjs/consent-manager.cjs.entry.js +2 -2
- package/dist/cjs/crowdsource-manager.cjs.entry.js +5 -6
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +2 -2
- package/dist/cjs/{downloadUtils-48ffc5b3.js → downloadUtils-b757205e.js} +5 -5
- package/dist/cjs/feature-list.cjs.entry.js +6 -6
- package/dist/cjs/{helpers-6f7660d4.js → helpers-1deec961.js} +1 -1
- package/dist/cjs/{index.es-9e361fa2.js → index.es-6c8b7d64.js} +5 -5
- package/dist/cjs/instant-apps-ckeditor-wrapper_3.cjs.entry.js +5 -5
- package/dist/cjs/instant-apps-control-panel.cjs.entry.js +2 -2
- package/dist/cjs/instant-apps-create.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-export-views.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-export.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-header.cjs.entry.js +2 -2
- package/dist/cjs/instant-apps-interactive-legend-classic.cjs.entry.js +3 -3
- package/dist/cjs/instant-apps-interactive-legend-count_2.cjs.entry.js +3 -3
- package/dist/cjs/instant-apps-interactive-legend-group-legend-element-caption.cjs.entry.js +3 -3
- package/dist/cjs/instant-apps-interactive-legend-group-legend-element_5.cjs.entry.js +3 -3
- package/dist/cjs/instant-apps-interactive-legend.cjs.entry.js +5 -5
- package/dist/cjs/instant-apps-keyboard-shortcuts.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-language-switcher.cjs.entry.js +6 -6
- package/dist/cjs/instant-apps-language-translator.cjs.entry.js +6 -6
- package/dist/cjs/instant-apps-measurement.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-popover.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-scoreboard.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-sign-in.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-splash.cjs.entry.js +4 -4
- package/dist/cjs/instant-apps-time-filter.cjs.entry.js +4 -4
- package/dist/cjs/{languageSwitcher-f0bb94fa.js → languageSwitcher-dc2dd354.js} +1 -1
- package/dist/cjs/{languageUtil-f22ce913.js → languageUtil-a3e1eafd.js} +1 -1
- package/dist/cjs/layout-manager.cjs.entry.js +2 -2
- package/dist/cjs/{loadModules-36d49819.js → loadModules-8567855e.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{locale-2dc1252d.js → locale-4e7fe921.js} +1 -1
- package/dist/cjs/{locale-239118c6.js → locale-a1bcb6eb.js} +2 -2
- package/dist/cjs/map-select-tools_3.cjs.entry.js +33 -24
- package/dist/cjs/{popupUtils-b771f498.js → popupUtils-2b5ec788.js} +2 -2
- package/dist/cjs/public-notification.cjs.entry.js +13 -10
- package/dist/cjs/{restHelpersGet-88ba0e25.js → restHelpersGet-bf484fda.js} +24 -20
- package/dist/cjs/solution-configuration.cjs.entry.js +6 -6
- package/dist/cjs/solution-contents_3.cjs.entry.js +6 -6
- package/dist/cjs/{solution-resource-16c7510c.js → solution-resource-57cf345b.js} +1 -1
- package/dist/cjs/{solution-store-747a28ab.js → solution-store-71bb46fa.js} +65 -58
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/cjs/spatial-ref.cjs.entry.js +4 -4
- package/dist/cjs/store-manager.cjs.entry.js +4 -4
- package/dist/cjs/{templates-2f44c01b.js → templates-e4b98319.js} +2 -2
- package/dist/cjs/{utils-e486aa01.js → utils-b43fe04f.js} +1 -1
- package/dist/collection/components/card-manager/card-manager.js +20 -1
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +3 -22
- package/dist/collection/components/edit-card/edit-card.js +21 -2
- package/dist/collection/components/info-card/info-card.js +21 -2
- package/dist/collection/components/map-select-tools/map-select-tools.js +81 -18
- package/dist/collection/components/public-notification/public-notification.js +62 -5
- package/dist/collection/components/refine-selection/refine-selection.js +1 -1
- package/dist/collection/utils/interfaces.ts +3 -0
- package/dist/collection/utils/pdfUtils.js +1 -1
- package/dist/collection/utils/pdfUtils.ts +1 -1
- package/dist/components/card-manager2.js +3 -1
- package/dist/components/crowdsource-manager.js +3 -5
- package/dist/components/downloadUtils.js +1 -1
- package/dist/components/edit-card2.js +4 -2
- package/dist/components/info-card2.js +4 -2
- package/dist/components/map-select-tools2.js +30 -18
- package/dist/components/public-notification.js +11 -5
- package/dist/components/refine-selection2.js +1 -1
- package/dist/components/restHelpersGet.js +23 -19
- package/dist/components/solution-resource.js +1 -1
- package/dist/components/solution-store.js +63 -56
- package/dist/esm/basemap-gallery_7.entry.js +2 -2
- package/dist/esm/buffer-tools_3.entry.js +2 -2
- package/dist/esm/calcite-action-pad_2.entry.js +2 -2
- package/dist/esm/calcite-alert_4.entry.js +12 -10
- package/dist/esm/calcite-block_5.entry.js +4 -4
- package/dist/esm/calcite-dropdown-group_2.entry.js +2 -2
- package/dist/esm/calcite-flow_6.entry.js +2 -2
- package/dist/esm/calcite-shell-panel_14.entry.js +5 -5
- package/dist/esm/card-manager_3.entry.js +7 -6
- package/dist/esm/{common-3b99e350.js → common-1618d62f.js} +1 -1
- package/dist/esm/consent-manager.entry.js +2 -2
- package/dist/esm/crowdsource-manager.entry.js +5 -6
- package/dist/esm/crowdsource-reporter.entry.js +2 -2
- package/dist/esm/{downloadUtils-abb8cda2.js → downloadUtils-16c51b10.js} +5 -5
- package/dist/esm/feature-list.entry.js +6 -6
- package/dist/esm/{helpers-62213648.js → helpers-2298687e.js} +1 -1
- package/dist/esm/{index.es-9283e62c.js → index.es-d950915a.js} +5 -5
- package/dist/esm/instant-apps-ckeditor-wrapper_3.entry.js +5 -5
- package/dist/esm/instant-apps-control-panel.entry.js +2 -2
- package/dist/esm/instant-apps-create.entry.js +4 -4
- package/dist/esm/instant-apps-export-views.entry.js +4 -4
- package/dist/esm/instant-apps-export.entry.js +4 -4
- package/dist/esm/instant-apps-header.entry.js +2 -2
- package/dist/esm/instant-apps-interactive-legend-classic.entry.js +3 -3
- package/dist/esm/instant-apps-interactive-legend-count_2.entry.js +3 -3
- package/dist/esm/instant-apps-interactive-legend-group-legend-element-caption.entry.js +3 -3
- package/dist/esm/instant-apps-interactive-legend-group-legend-element_5.entry.js +3 -3
- package/dist/esm/instant-apps-interactive-legend.entry.js +5 -5
- package/dist/esm/instant-apps-keyboard-shortcuts.entry.js +4 -4
- package/dist/esm/instant-apps-language-switcher.entry.js +6 -6
- package/dist/esm/instant-apps-language-translator.entry.js +6 -6
- package/dist/esm/instant-apps-measurement.entry.js +4 -4
- package/dist/esm/instant-apps-popover.entry.js +4 -4
- package/dist/esm/instant-apps-scoreboard.entry.js +4 -4
- package/dist/esm/instant-apps-sign-in.entry.js +4 -4
- package/dist/esm/instant-apps-splash.entry.js +4 -4
- package/dist/esm/instant-apps-time-filter.entry.js +4 -4
- package/dist/esm/{languageSwitcher-b665499d.js → languageSwitcher-9db90f1e.js} +1 -1
- package/dist/esm/{languageUtil-a3e6adf6.js → languageUtil-2b6e191a.js} +1 -1
- package/dist/esm/layout-manager.entry.js +2 -2
- package/dist/esm/{loadModules-9c062d08.js → loadModules-03ba7abe.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{locale-e758c2ee.js → locale-7162b55a.js} +1 -1
- package/dist/esm/{locale-35ebf4af.js → locale-adb5ff0b.js} +2 -2
- package/dist/esm/map-select-tools_3.entry.js +33 -24
- package/dist/esm/{popupUtils-9b2b0aba.js → popupUtils-44f11275.js} +2 -2
- package/dist/esm/public-notification.entry.js +13 -10
- package/dist/esm/{restHelpersGet-788d7f7b.js → restHelpersGet-0a15c2f4.js} +24 -20
- package/dist/esm/solution-configuration.entry.js +6 -6
- package/dist/esm/solution-contents_3.entry.js +6 -6
- package/dist/esm/{solution-resource-966f8511.js → solution-resource-ab63a236.js} +1 -1
- package/dist/esm/{solution-store-0586e891.js → solution-store-e2690620.js} +65 -58
- package/dist/esm/solutions-components.js +1 -1
- package/dist/esm/spatial-ref.entry.js +4 -4
- package/dist/esm/store-manager.entry.js +4 -4
- package/dist/esm/{templates-9330d7b8.js → templates-9556eb87.js} +2 -2
- package/dist/esm/{utils-72a48b01.js → utils-178e7afe.js} +1 -1
- package/dist/solutions-components/{p-71452a4e.entry.js → p-002c97df.entry.js} +1 -1
- package/dist/solutions-components/{p-08b0e478.js → p-00b26aac.js} +2 -2
- package/dist/solutions-components/{p-f2ac5d0e.js → p-1904654e.js} +1 -1
- package/dist/solutions-components/{p-e9aba912.entry.js → p-1b9aa18e.entry.js} +1 -1
- package/dist/solutions-components/p-235bf02e.entry.js +6 -0
- package/dist/solutions-components/{p-beeccd19.entry.js → p-24b3aedc.entry.js} +1 -1
- package/dist/solutions-components/p-2727a29c.entry.js +6 -0
- package/dist/solutions-components/{p-f067a46c.js → p-2fa78dd8.js} +1 -1
- package/dist/solutions-components/{p-c742acd9.js → p-2fc63144.js} +1 -1
- package/dist/solutions-components/{p-65283b75.entry.js → p-3438cbc4.entry.js} +1 -1
- package/dist/solutions-components/{p-1176ec70.entry.js → p-38cfa3cd.entry.js} +1 -1
- package/dist/solutions-components/p-3b426576.entry.js +6 -0
- package/dist/solutions-components/{p-de30afd0.entry.js → p-425a1dab.entry.js} +1 -1
- package/dist/solutions-components/{p-29962ae5.entry.js → p-4848b48f.entry.js} +1 -1
- package/dist/solutions-components/{p-73ef6866.js → p-4b3cc01f.js} +3 -3
- package/dist/solutions-components/{p-65581d83.js → p-4cd4cb85.js} +1 -1
- package/dist/solutions-components/{p-2d03b0d7.entry.js → p-5b818d29.entry.js} +1 -1
- package/dist/solutions-components/{p-787a4789.entry.js → p-5c999087.entry.js} +1 -1
- package/dist/solutions-components/{p-32f5c6ec.entry.js → p-69cfa9e6.entry.js} +1 -1
- package/dist/solutions-components/{p-51cfb4a6.entry.js → p-6b30ca36.entry.js} +1 -1
- package/dist/solutions-components/{p-4b843bc0.entry.js → p-6de944af.entry.js} +1 -1
- package/dist/solutions-components/{p-4a0838c0.entry.js → p-78712b70.entry.js} +1 -1
- package/dist/solutions-components/{p-ee87a7b0.entry.js → p-7af4c00e.entry.js} +3 -3
- package/dist/solutions-components/{p-09d62c22.js → p-7bfecd07.js} +1 -1
- package/dist/solutions-components/{p-07053ee3.entry.js → p-80e6c7cb.entry.js} +1 -1
- package/dist/solutions-components/{p-ef493a84.entry.js → p-86e6b5b3.entry.js} +1 -1
- package/dist/solutions-components/{p-81f62cf5.entry.js → p-88d4db61.entry.js} +1 -1
- package/dist/solutions-components/{p-13f83a1a.entry.js → p-8a6fa619.entry.js} +1 -1
- package/dist/solutions-components/{p-e05894a6.entry.js → p-8b999a2b.entry.js} +1 -1
- package/dist/solutions-components/{p-614edd9f.entry.js → p-8e8b92b4.entry.js} +1 -1
- package/dist/solutions-components/{p-a759e0e5.js → p-90d6755b.js} +1 -1
- package/dist/solutions-components/{p-f4828ba4.entry.js → p-932f22b5.entry.js} +1 -1
- package/dist/solutions-components/{p-afad4f05.js → p-a091bc9a.js} +1 -1
- package/dist/solutions-components/{p-a7b05a79.entry.js → p-a22b8cc1.entry.js} +1 -1
- package/dist/solutions-components/{p-a7710355.js → p-a860f365.js} +8 -7
- package/dist/solutions-components/{p-2cff27c5.js → p-a8e6463b.js} +2 -2
- package/dist/solutions-components/{p-7efb5ef0.entry.js → p-a9818be2.entry.js} +1 -1
- package/dist/solutions-components/{p-3e84a420.entry.js → p-ab2adcaf.entry.js} +1 -1
- package/dist/solutions-components/{p-4c0b8e55.entry.js → p-abc9e858.entry.js} +1 -1
- package/dist/solutions-components/{p-af2c8aa9.js → p-ac122d9e.js} +1 -1
- package/dist/solutions-components/{p-ed9b7fa1.entry.js → p-b19ca04e.entry.js} +1 -1
- package/dist/solutions-components/{p-fb0fdc0d.entry.js → p-b7cec3bd.entry.js} +1 -1
- package/dist/solutions-components/p-b80bcd0b.entry.js +6 -0
- package/dist/solutions-components/{p-92744164.entry.js → p-b850796d.entry.js} +1 -1
- package/dist/solutions-components/{p-7c583516.js → p-badcaf04.js} +1 -1
- package/dist/solutions-components/{p-a2150807.entry.js → p-c6473b38.entry.js} +1 -1
- package/dist/solutions-components/{p-f341b87e.entry.js → p-d57736d0.entry.js} +1 -1
- package/dist/solutions-components/{p-09b47605.js → p-d7868dd4.js} +1 -1
- package/dist/solutions-components/{p-f7d822f7.entry.js → p-d8047d8f.entry.js} +1 -1
- package/dist/solutions-components/{p-386429a4.entry.js → p-dc17b638.entry.js} +1 -1
- package/dist/solutions-components/{p-02d3d3e9.entry.js → p-e3e593db.entry.js} +2 -2
- package/dist/solutions-components/{p-00786a30.entry.js → p-edd70ba3.entry.js} +1 -1
- package/dist/solutions-components/{p-6f836c0a.entry.js → p-ef6567ae.entry.js} +1 -1
- package/dist/solutions-components/{p-0bf41dfd.entry.js → p-f59b4183.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/interfaces.ts +3 -0
- package/dist/solutions-components/utils/pdfUtils.ts +1 -1
- package/dist/types/components/card-manager/card-manager.d.ts +4 -0
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +0 -4
- package/dist/types/components/edit-card/edit-card.d.ts +4 -0
- package/dist/types/components/info-card/info-card.d.ts +4 -0
- package/dist/types/components/map-select-tools/map-select-tools.d.ts +12 -0
- package/dist/types/components/public-notification/public-notification.d.ts +12 -0
- package/dist/types/components.d.ts +72 -8
- package/dist/types/utils/interfaces.d.ts +3 -0
- package/package.json +1 -1
- package/dist/solutions-components/p-2977bdbf.entry.js +0 -6
- package/dist/solutions-components/p-d0432926.entry.js +0 -6
- package/dist/solutions-components/p-d1fd4a53.entry.js +0 -6
- package/dist/solutions-components/p-f26423c7.entry.js +0 -6
- package/dist/solutions-components_commit.txt +0 -8
- /package/dist/cjs/{esri-loader-a56cbcbe.js → esri-loader-08dc41bd.js} +0 -0
- /package/dist/esm/{esri-loader-781d738a.js → esri-loader-c6842c6b.js} +0 -0
- /package/dist/solutions-components/{p-6a68306c.js → p-0a24ad5f.js} +0 -0
- /package/dist/solutions-components/{p-659678f1.js → p-9fe07c30.js} +0 -0
@@ -5,8 +5,8 @@
|
|
5
5
|
*/
|
6
6
|
import { c as createStore } from './index-1dc14abf.js';
|
7
7
|
import { d as EUpdateType, C as CSpatialRefCustomizingPrefix } from './interfaces-659e3836.js';
|
8
|
-
import { E as EFileType, J as JSZip, S as SolutionTemplateFormatVersion } from './solution-resource-
|
9
|
-
import { c as cleanUrl, r as request, d as blobToFile, f as checkUrlPathTermination, h as getThumbnailFile, i as getItemDataAsJson, b as getPropWithDefault, s as setCreateProp, a as getProp, j as setProp } from './restHelpersGet-
|
8
|
+
import { E as EFileType, J as JSZip, S as SolutionTemplateFormatVersion } from './solution-resource-ab63a236.js';
|
9
|
+
import { c as cleanUrl, r as request, d as blobToFile, f as checkUrlPathTermination, h as getThumbnailFile, i as getItemDataAsJson, b as getPropWithDefault, s as setCreateProp, a as getProp, j as setProp } from './restHelpersGet-0a15c2f4.js';
|
10
10
|
|
11
11
|
/*! *****************************************************************************
|
12
12
|
Copyright (c) Microsoft Corporation.
|
@@ -276,7 +276,7 @@ function chunkArray(arr, size) {
|
|
276
276
|
}
|
277
277
|
|
278
278
|
/** @license
|
279
|
-
* Copyright
|
279
|
+
* Copyright 2021 Esri
|
280
280
|
*
|
281
281
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
282
282
|
* you may not use this file except in compliance with the License.
|
@@ -290,32 +290,25 @@ function chunkArray(arr, size) {
|
|
290
290
|
* See the License for the specific language governing permissions and
|
291
291
|
* limitations under the License.
|
292
292
|
*/
|
293
|
+
// ------------------------------------------------------------------------------------------------------------------ //
|
293
294
|
/**
|
294
|
-
*
|
295
|
+
* Generates IAssociatedFileCopyResults object.
|
295
296
|
*
|
296
|
-
* @param
|
297
|
-
*
|
298
|
-
* @param
|
299
|
-
* @
|
300
|
-
* @param additionalParams Updates that are put under the `params` property, which is not serialized
|
301
|
-
* @return
|
297
|
+
* @param fileInfo Info about item that was to be copied
|
298
|
+
* @param fetchedFromSource Status of fetching item from source
|
299
|
+
* @param copiedToDestination Status of copying item to destination
|
300
|
+
* @returns IAssociatedFileCopyResults object
|
302
301
|
*/
|
303
|
-
function
|
304
|
-
return
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
params: {
|
310
|
-
...(additionalParams ?? {}),
|
311
|
-
},
|
312
|
-
};
|
313
|
-
updateItem$1(updateOptions).then((response) => (response.success ? resolve(response) : reject(response)), (err) => reject(err));
|
314
|
-
});
|
302
|
+
function createCopyResults(fileInfo, fetchedFromSource, copiedToDestination) {
|
303
|
+
return {
|
304
|
+
...fileInfo,
|
305
|
+
fetchedFromSource,
|
306
|
+
copiedToDestination
|
307
|
+
};
|
315
308
|
}
|
316
309
|
|
317
310
|
/** @license
|
318
|
-
* Copyright
|
311
|
+
* Copyright 2018 Esri
|
319
312
|
*
|
320
313
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
321
314
|
* you may not use this file except in compliance with the License.
|
@@ -329,21 +322,28 @@ function updateItem(itemInfo, authentication, folderId, additionalParams) {
|
|
329
322
|
* See the License for the specific language governing permissions and
|
330
323
|
* limitations under the License.
|
331
324
|
*/
|
332
|
-
// ------------------------------------------------------------------------------------------------------------------ //
|
333
325
|
/**
|
334
|
-
*
|
326
|
+
* Updates an item.
|
335
327
|
*
|
336
|
-
* @param
|
337
|
-
*
|
338
|
-
* @param
|
339
|
-
* @
|
328
|
+
* @param itemInfo The base info of an item; note that this content will be serialized, which doesn't work
|
329
|
+
* for binary content
|
330
|
+
* @param authentication Credentials for request
|
331
|
+
* @param folderId Item's folder
|
332
|
+
* @param additionalParams Updates that are put under the `params` property, which is not serialized
|
333
|
+
* @return
|
340
334
|
*/
|
341
|
-
function
|
342
|
-
return {
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
335
|
+
function updateItem(itemInfo, authentication, folderId, additionalParams) {
|
336
|
+
return new Promise((resolve, reject) => {
|
337
|
+
const updateOptions = {
|
338
|
+
item: itemInfo,
|
339
|
+
folderId: folderId,
|
340
|
+
authentication: authentication,
|
341
|
+
params: {
|
342
|
+
...(additionalParams ?? {})
|
343
|
+
}
|
344
|
+
};
|
345
|
+
updateItem$1(updateOptions).then(response => (response.success ? resolve(response) : reject(response)), err => reject(err));
|
346
|
+
});
|
347
347
|
}
|
348
348
|
|
349
349
|
/** @license
|
@@ -437,7 +437,9 @@ function convertStorageResourceToItemResource(storageResourceFilename, storageVe
|
|
437
437
|
function copyResourceIntoZip(file, zipInfo) {
|
438
438
|
// Add it to the zip
|
439
439
|
if (file.folder) {
|
440
|
-
zipInfo.zip
|
440
|
+
zipInfo.zip
|
441
|
+
.folder(file.folder)
|
442
|
+
.file(file.filename, file.file, { binary: true });
|
441
443
|
}
|
442
444
|
else {
|
443
445
|
zipInfo.zip.file(file.filename, file.file, { binary: true });
|
@@ -471,7 +473,7 @@ function copyResourceIntoZip(file, zipInfo) {
|
|
471
473
|
* @returns A promise which resolves to the result of the copy
|
472
474
|
*/
|
473
475
|
function copyZipIntoItem(zipInfo, destinationItemId, destinationAuthentication) {
|
474
|
-
return new Promise(
|
476
|
+
return new Promise(resolve => {
|
475
477
|
zipInfo.zip
|
476
478
|
.generateAsync({ type: "blob" })
|
477
479
|
.then((content) => {
|
@@ -483,12 +485,13 @@ function copyZipIntoItem(zipInfo, destinationItemId, destinationAuthentication)
|
|
483
485
|
resource: zipfile,
|
484
486
|
authentication: destinationAuthentication,
|
485
487
|
params: {
|
486
|
-
archive: true
|
487
|
-
}
|
488
|
+
archive: true
|
489
|
+
}
|
488
490
|
};
|
489
491
|
return addItemResource(addResourceOptions);
|
490
492
|
})
|
491
|
-
.then(() => resolve(createCopyResults(zipInfo, true, true)), () => resolve(createCopyResults(zipInfo, true, false))
|
493
|
+
.then(() => resolve(createCopyResults(zipInfo, true, true)), () => resolve(createCopyResults(zipInfo, true, false)) // unable to add resource
|
494
|
+
);
|
492
495
|
});
|
493
496
|
}
|
494
497
|
|
@@ -519,7 +522,7 @@ function copyZipIntoItem(zipInfo, destinationItemId, destinationAuthentication)
|
|
519
522
|
* @returns A promise which resolves to a list of the result of the copies
|
520
523
|
*/
|
521
524
|
function copyFilesAsResources(files, destinationItemId, destinationAuthentication, filesPerZip = 40) {
|
522
|
-
return new Promise(
|
525
|
+
return new Promise(resolve => {
|
523
526
|
let awaitAllItems = [];
|
524
527
|
const zipInfos = [];
|
525
528
|
if (files.length > 0) {
|
@@ -534,9 +537,9 @@ function copyFilesAsResources(files, destinationItemId, destinationAuthenticatio
|
|
534
537
|
const zipInfo = {
|
535
538
|
filename: `resources${index}.zip`,
|
536
539
|
zip: new JSZip(),
|
537
|
-
filelist: []
|
540
|
+
filelist: []
|
538
541
|
};
|
539
|
-
awaitAllItems = awaitAllItems.concat(chunk.map(
|
542
|
+
awaitAllItems = awaitAllItems.concat(chunk.map(file => copyResourceIntoZip(file, zipInfo)));
|
540
543
|
zipInfos.push(zipInfo);
|
541
544
|
});
|
542
545
|
}
|
@@ -550,7 +553,8 @@ function copyFilesAsResources(files, destinationItemId, destinationAuthenticatio
|
|
550
553
|
// | true | true | file has been fetched and sent to AGO |
|
551
554
|
// | true | undefined | file has been fetched and will be sent via zip |
|
552
555
|
// Filter out copiedToDestination===undefined; we'll get their status when we send their zip
|
553
|
-
results = results.filter((result) => !(result.fetchedFromSource &&
|
556
|
+
results = results.filter((result) => !(result.fetchedFromSource &&
|
557
|
+
typeof result.copiedToDestination === "undefined"));
|
554
558
|
// Now send the resources to AGO
|
555
559
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
556
560
|
_copyAssociatedFileZips(zipInfos, destinationItemId, destinationAuthentication).then((zipResults) => {
|
@@ -574,7 +578,7 @@ function copyFilesAsResources(files, destinationItemId, destinationAuthenticatio
|
|
574
578
|
* @private
|
575
579
|
*/
|
576
580
|
function _copyAssociatedFileZips(zipInfos, destinationItemId, destinationAuthentication) {
|
577
|
-
return new Promise(
|
581
|
+
return new Promise(resolve => {
|
578
582
|
const results = [];
|
579
583
|
// Filter out empty zips, which can happen when none of the files in the chunk going into a zip
|
580
584
|
// can be fetched; e.g., the only file is metadata.xml, and the source item doesn't have metadata
|
@@ -600,7 +604,7 @@ function _copyAssociatedFileZips(zipInfos, destinationItemId, destinationAuthent
|
|
600
604
|
* @returns A promise which resolves to a list of the result of the copies
|
601
605
|
*/
|
602
606
|
function _sendZipsSeriallyToItem(zipInfos, destinationItemId, destinationAuthentication) {
|
603
|
-
return new Promise(
|
607
|
+
return new Promise(resolve => {
|
604
608
|
let allResults = [];
|
605
609
|
// Remove zip from bottom of list
|
606
610
|
const zipInfoToSend = zipInfos.pop();
|
@@ -613,7 +617,7 @@ function _sendZipsSeriallyToItem(zipInfos, destinationItemId, destinationAuthent
|
|
613
617
|
.then((response) => {
|
614
618
|
allResults = response;
|
615
619
|
// Stall a little to give AGO time to catch up
|
616
|
-
return new Promise(
|
620
|
+
return new Promise(resolveSleep => {
|
617
621
|
setTimeout(() => resolveSleep(), 1000);
|
618
622
|
});
|
619
623
|
})
|
@@ -656,7 +660,7 @@ function _sendZipsSeriallyToItem(zipInfos, destinationItemId, destinationAuthent
|
|
656
660
|
* @returns A promise which resolves to a list of the filenames under which the resource/metadata are stored
|
657
661
|
*/
|
658
662
|
function copyFilesToStorageItem(files, storageItemId, storageAuthentication) {
|
659
|
-
return new Promise(
|
663
|
+
return new Promise(resolve => {
|
660
664
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
661
665
|
void copyFilesAsResources(files, storageItemId, storageAuthentication).then((results) => {
|
662
666
|
resolve(results
|
@@ -676,7 +680,11 @@ function copyFilesToStorageItem(files, storageItemId, storageAuthentication) {
|
|
676
680
|
* @returns URL string
|
677
681
|
*/
|
678
682
|
function generateSourceResourceUrl(sourcePortalSharingUrl, itemId, sourceResourceFilename) {
|
679
|
-
return (checkUrlPathTermination(sourcePortalSharingUrl) +
|
683
|
+
return (checkUrlPathTermination(sourcePortalSharingUrl) +
|
684
|
+
"content/items/" +
|
685
|
+
itemId +
|
686
|
+
"/resources/" +
|
687
|
+
sourceResourceFilename);
|
680
688
|
}
|
681
689
|
/**
|
682
690
|
* Generates a list of full URLs and folder/filename combinations used to store the resources, metadata,
|
@@ -689,10 +697,10 @@ function generateSourceResourceUrl(sourcePortalSharingUrl, itemId, sourceResourc
|
|
689
697
|
* @returns List of item files' URLs and folder/filenames for storing the files
|
690
698
|
*/
|
691
699
|
function generateStorageFilePaths(portalSharingUrl, storageItemId, resourceFilenames = [], storageVersion = 0) {
|
692
|
-
return resourceFilenames.map(
|
700
|
+
return resourceFilenames.map(resourceFilename => {
|
693
701
|
return {
|
694
702
|
url: generateSourceResourceUrl(portalSharingUrl, storageItemId, resourceFilename),
|
695
|
-
...convertStorageResourceToItemResource(resourceFilename, storageVersion)
|
703
|
+
...convertStorageResourceToItemResource(resourceFilename, storageVersion)
|
696
704
|
};
|
697
705
|
});
|
698
706
|
}
|
@@ -701,7 +709,8 @@ function isSupportedFileType(filename) {
|
|
701
709
|
// .svgz, .geodatabase (https://developers.arcgis.com/rest/users-groups-and-items/add-resources.htm)
|
702
710
|
const filenameExtension = filename.match(/\.([a-z]+)$/i);
|
703
711
|
const supportedExtensions = "|.json|.xml|.txt|.png|.pbf|.zip|.jpeg|.jpg|.gif|.bmp|.gz|.svg|.svgz|.geodatabase|";
|
704
|
-
return !!filenameExtension &&
|
712
|
+
return (!!filenameExtension &&
|
713
|
+
supportedExtensions.indexOf("|" + filenameExtension[0] + "|") >= 0);
|
705
714
|
}
|
706
715
|
/**
|
707
716
|
* Gets the thumbnail of an item or group.
|
@@ -713,7 +722,7 @@ function isSupportedFileType(filename) {
|
|
713
722
|
function getThumbnailFromStorageItem(authentication, filePaths) {
|
714
723
|
let thumbnailUrl;
|
715
724
|
let thumbnailFilename;
|
716
|
-
filePaths.forEach(
|
725
|
+
filePaths.forEach(path => {
|
717
726
|
if (path.type === EFileType.Thumbnail) {
|
718
727
|
thumbnailUrl = path.url;
|
719
728
|
thumbnailFilename = path.filename;
|
@@ -736,7 +745,7 @@ function removeItemResourceFile(itemId, filename, authentication) {
|
|
736
745
|
return removeItemResource({
|
737
746
|
id: itemId,
|
738
747
|
resource: filename,
|
739
|
-
authentication: authentication
|
748
|
+
authentication: authentication
|
740
749
|
});
|
741
750
|
}
|
742
751
|
/**
|
@@ -751,16 +760,14 @@ function removeItemResourceFile(itemId, filename, authentication) {
|
|
751
760
|
function updateItemResourceFile(itemId, filename, resource, authentication) {
|
752
761
|
// Prefix has to be specified separately
|
753
762
|
const prefixedFilenameParts = filename.split("/");
|
754
|
-
const prefix = prefixedFilenameParts.length > 1
|
755
|
-
? prefixedFilenameParts.slice(0, prefixedFilenameParts.length - 1).join("/")
|
756
|
-
: undefined;
|
763
|
+
const prefix = prefixedFilenameParts.length > 1 ? prefixedFilenameParts.slice(0, prefixedFilenameParts.length - 1).join("/") : undefined;
|
757
764
|
const suffix = prefixedFilenameParts[prefixedFilenameParts.length - 1];
|
758
765
|
return updateItemResource({
|
759
766
|
id: itemId,
|
760
767
|
prefix: prefix,
|
761
768
|
name: suffix,
|
762
769
|
resource,
|
763
|
-
authentication: authentication
|
770
|
+
authentication: authentication
|
764
771
|
});
|
765
772
|
}
|
766
773
|
|