@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
@@ -7,8 +7,8 @@
|
|
7
7
|
|
8
8
|
const index = require('./index-a0cca96e.js');
|
9
9
|
const interfaces = require('./interfaces-09c4c40e.js');
|
10
|
-
const solutionResource = require('./solution-resource-
|
11
|
-
const restHelpersGet = require('./restHelpersGet-
|
10
|
+
const solutionResource = require('./solution-resource-57cf345b.js');
|
11
|
+
const restHelpersGet = require('./restHelpersGet-bf484fda.js');
|
12
12
|
|
13
13
|
/*! *****************************************************************************
|
14
14
|
Copyright (c) Microsoft Corporation.
|
@@ -278,7 +278,7 @@ function chunkArray(arr, size) {
|
|
278
278
|
}
|
279
279
|
|
280
280
|
/** @license
|
281
|
-
* Copyright
|
281
|
+
* Copyright 2021 Esri
|
282
282
|
*
|
283
283
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
284
284
|
* you may not use this file except in compliance with the License.
|
@@ -292,32 +292,25 @@ function chunkArray(arr, size) {
|
|
292
292
|
* See the License for the specific language governing permissions and
|
293
293
|
* limitations under the License.
|
294
294
|
*/
|
295
|
+
// ------------------------------------------------------------------------------------------------------------------ //
|
295
296
|
/**
|
296
|
-
*
|
297
|
+
* Generates IAssociatedFileCopyResults object.
|
297
298
|
*
|
298
|
-
* @param
|
299
|
-
*
|
300
|
-
* @param
|
301
|
-
* @
|
302
|
-
* @param additionalParams Updates that are put under the `params` property, which is not serialized
|
303
|
-
* @return
|
299
|
+
* @param fileInfo Info about item that was to be copied
|
300
|
+
* @param fetchedFromSource Status of fetching item from source
|
301
|
+
* @param copiedToDestination Status of copying item to destination
|
302
|
+
* @returns IAssociatedFileCopyResults object
|
304
303
|
*/
|
305
|
-
function
|
306
|
-
return
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
params: {
|
312
|
-
...(additionalParams ?? {}),
|
313
|
-
},
|
314
|
-
};
|
315
|
-
updateItem$1(updateOptions).then((response) => (response.success ? resolve(response) : reject(response)), (err) => reject(err));
|
316
|
-
});
|
304
|
+
function createCopyResults(fileInfo, fetchedFromSource, copiedToDestination) {
|
305
|
+
return {
|
306
|
+
...fileInfo,
|
307
|
+
fetchedFromSource,
|
308
|
+
copiedToDestination
|
309
|
+
};
|
317
310
|
}
|
318
311
|
|
319
312
|
/** @license
|
320
|
-
* Copyright
|
313
|
+
* Copyright 2018 Esri
|
321
314
|
*
|
322
315
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
323
316
|
* you may not use this file except in compliance with the License.
|
@@ -331,21 +324,28 @@ function updateItem(itemInfo, authentication, folderId, additionalParams) {
|
|
331
324
|
* See the License for the specific language governing permissions and
|
332
325
|
* limitations under the License.
|
333
326
|
*/
|
334
|
-
// ------------------------------------------------------------------------------------------------------------------ //
|
335
327
|
/**
|
336
|
-
*
|
328
|
+
* Updates an item.
|
337
329
|
*
|
338
|
-
* @param
|
339
|
-
*
|
340
|
-
* @param
|
341
|
-
* @
|
330
|
+
* @param itemInfo The base info of an item; note that this content will be serialized, which doesn't work
|
331
|
+
* for binary content
|
332
|
+
* @param authentication Credentials for request
|
333
|
+
* @param folderId Item's folder
|
334
|
+
* @param additionalParams Updates that are put under the `params` property, which is not serialized
|
335
|
+
* @return
|
342
336
|
*/
|
343
|
-
function
|
344
|
-
return {
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
337
|
+
function updateItem(itemInfo, authentication, folderId, additionalParams) {
|
338
|
+
return new Promise((resolve, reject) => {
|
339
|
+
const updateOptions = {
|
340
|
+
item: itemInfo,
|
341
|
+
folderId: folderId,
|
342
|
+
authentication: authentication,
|
343
|
+
params: {
|
344
|
+
...(additionalParams ?? {})
|
345
|
+
}
|
346
|
+
};
|
347
|
+
updateItem$1(updateOptions).then(response => (response.success ? resolve(response) : reject(response)), err => reject(err));
|
348
|
+
});
|
349
349
|
}
|
350
350
|
|
351
351
|
/** @license
|
@@ -439,7 +439,9 @@ function convertStorageResourceToItemResource(storageResourceFilename, storageVe
|
|
439
439
|
function copyResourceIntoZip(file, zipInfo) {
|
440
440
|
// Add it to the zip
|
441
441
|
if (file.folder) {
|
442
|
-
zipInfo.zip
|
442
|
+
zipInfo.zip
|
443
|
+
.folder(file.folder)
|
444
|
+
.file(file.filename, file.file, { binary: true });
|
443
445
|
}
|
444
446
|
else {
|
445
447
|
zipInfo.zip.file(file.filename, file.file, { binary: true });
|
@@ -473,7 +475,7 @@ function copyResourceIntoZip(file, zipInfo) {
|
|
473
475
|
* @returns A promise which resolves to the result of the copy
|
474
476
|
*/
|
475
477
|
function copyZipIntoItem(zipInfo, destinationItemId, destinationAuthentication) {
|
476
|
-
return new Promise(
|
478
|
+
return new Promise(resolve => {
|
477
479
|
zipInfo.zip
|
478
480
|
.generateAsync({ type: "blob" })
|
479
481
|
.then((content) => {
|
@@ -485,12 +487,13 @@ function copyZipIntoItem(zipInfo, destinationItemId, destinationAuthentication)
|
|
485
487
|
resource: zipfile,
|
486
488
|
authentication: destinationAuthentication,
|
487
489
|
params: {
|
488
|
-
archive: true
|
489
|
-
}
|
490
|
+
archive: true
|
491
|
+
}
|
490
492
|
};
|
491
493
|
return addItemResource(addResourceOptions);
|
492
494
|
})
|
493
|
-
.then(() => resolve(createCopyResults(zipInfo, true, true)), () => resolve(createCopyResults(zipInfo, true, false))
|
495
|
+
.then(() => resolve(createCopyResults(zipInfo, true, true)), () => resolve(createCopyResults(zipInfo, true, false)) // unable to add resource
|
496
|
+
);
|
494
497
|
});
|
495
498
|
}
|
496
499
|
|
@@ -521,7 +524,7 @@ function copyZipIntoItem(zipInfo, destinationItemId, destinationAuthentication)
|
|
521
524
|
* @returns A promise which resolves to a list of the result of the copies
|
522
525
|
*/
|
523
526
|
function copyFilesAsResources(files, destinationItemId, destinationAuthentication, filesPerZip = 40) {
|
524
|
-
return new Promise(
|
527
|
+
return new Promise(resolve => {
|
525
528
|
let awaitAllItems = [];
|
526
529
|
const zipInfos = [];
|
527
530
|
if (files.length > 0) {
|
@@ -536,9 +539,9 @@ function copyFilesAsResources(files, destinationItemId, destinationAuthenticatio
|
|
536
539
|
const zipInfo = {
|
537
540
|
filename: `resources${index}.zip`,
|
538
541
|
zip: new solutionResource.JSZip(),
|
539
|
-
filelist: []
|
542
|
+
filelist: []
|
540
543
|
};
|
541
|
-
awaitAllItems = awaitAllItems.concat(chunk.map(
|
544
|
+
awaitAllItems = awaitAllItems.concat(chunk.map(file => copyResourceIntoZip(file, zipInfo)));
|
542
545
|
zipInfos.push(zipInfo);
|
543
546
|
});
|
544
547
|
}
|
@@ -552,7 +555,8 @@ function copyFilesAsResources(files, destinationItemId, destinationAuthenticatio
|
|
552
555
|
// | true | true | file has been fetched and sent to AGO |
|
553
556
|
// | true | undefined | file has been fetched and will be sent via zip |
|
554
557
|
// Filter out copiedToDestination===undefined; we'll get their status when we send their zip
|
555
|
-
results = results.filter((result) => !(result.fetchedFromSource &&
|
558
|
+
results = results.filter((result) => !(result.fetchedFromSource &&
|
559
|
+
typeof result.copiedToDestination === "undefined"));
|
556
560
|
// Now send the resources to AGO
|
557
561
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
558
562
|
_copyAssociatedFileZips(zipInfos, destinationItemId, destinationAuthentication).then((zipResults) => {
|
@@ -576,7 +580,7 @@ function copyFilesAsResources(files, destinationItemId, destinationAuthenticatio
|
|
576
580
|
* @private
|
577
581
|
*/
|
578
582
|
function _copyAssociatedFileZips(zipInfos, destinationItemId, destinationAuthentication) {
|
579
|
-
return new Promise(
|
583
|
+
return new Promise(resolve => {
|
580
584
|
const results = [];
|
581
585
|
// Filter out empty zips, which can happen when none of the files in the chunk going into a zip
|
582
586
|
// can be fetched; e.g., the only file is metadata.xml, and the source item doesn't have metadata
|
@@ -602,7 +606,7 @@ function _copyAssociatedFileZips(zipInfos, destinationItemId, destinationAuthent
|
|
602
606
|
* @returns A promise which resolves to a list of the result of the copies
|
603
607
|
*/
|
604
608
|
function _sendZipsSeriallyToItem(zipInfos, destinationItemId, destinationAuthentication) {
|
605
|
-
return new Promise(
|
609
|
+
return new Promise(resolve => {
|
606
610
|
let allResults = [];
|
607
611
|
// Remove zip from bottom of list
|
608
612
|
const zipInfoToSend = zipInfos.pop();
|
@@ -615,7 +619,7 @@ function _sendZipsSeriallyToItem(zipInfos, destinationItemId, destinationAuthent
|
|
615
619
|
.then((response) => {
|
616
620
|
allResults = response;
|
617
621
|
// Stall a little to give AGO time to catch up
|
618
|
-
return new Promise(
|
622
|
+
return new Promise(resolveSleep => {
|
619
623
|
setTimeout(() => resolveSleep(), 1000);
|
620
624
|
});
|
621
625
|
})
|
@@ -658,7 +662,7 @@ function _sendZipsSeriallyToItem(zipInfos, destinationItemId, destinationAuthent
|
|
658
662
|
* @returns A promise which resolves to a list of the filenames under which the resource/metadata are stored
|
659
663
|
*/
|
660
664
|
function copyFilesToStorageItem(files, storageItemId, storageAuthentication) {
|
661
|
-
return new Promise(
|
665
|
+
return new Promise(resolve => {
|
662
666
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
663
667
|
void copyFilesAsResources(files, storageItemId, storageAuthentication).then((results) => {
|
664
668
|
resolve(results
|
@@ -678,7 +682,11 @@ function copyFilesToStorageItem(files, storageItemId, storageAuthentication) {
|
|
678
682
|
* @returns URL string
|
679
683
|
*/
|
680
684
|
function generateSourceResourceUrl(sourcePortalSharingUrl, itemId, sourceResourceFilename) {
|
681
|
-
return (restHelpersGet.checkUrlPathTermination(sourcePortalSharingUrl) +
|
685
|
+
return (restHelpersGet.checkUrlPathTermination(sourcePortalSharingUrl) +
|
686
|
+
"content/items/" +
|
687
|
+
itemId +
|
688
|
+
"/resources/" +
|
689
|
+
sourceResourceFilename);
|
682
690
|
}
|
683
691
|
/**
|
684
692
|
* Generates a list of full URLs and folder/filename combinations used to store the resources, metadata,
|
@@ -691,10 +699,10 @@ function generateSourceResourceUrl(sourcePortalSharingUrl, itemId, sourceResourc
|
|
691
699
|
* @returns List of item files' URLs and folder/filenames for storing the files
|
692
700
|
*/
|
693
701
|
function generateStorageFilePaths(portalSharingUrl, storageItemId, resourceFilenames = [], storageVersion = 0) {
|
694
|
-
return resourceFilenames.map(
|
702
|
+
return resourceFilenames.map(resourceFilename => {
|
695
703
|
return {
|
696
704
|
url: generateSourceResourceUrl(portalSharingUrl, storageItemId, resourceFilename),
|
697
|
-
...convertStorageResourceToItemResource(resourceFilename, storageVersion)
|
705
|
+
...convertStorageResourceToItemResource(resourceFilename, storageVersion)
|
698
706
|
};
|
699
707
|
});
|
700
708
|
}
|
@@ -703,7 +711,8 @@ function isSupportedFileType(filename) {
|
|
703
711
|
// .svgz, .geodatabase (https://developers.arcgis.com/rest/users-groups-and-items/add-resources.htm)
|
704
712
|
const filenameExtension = filename.match(/\.([a-z]+)$/i);
|
705
713
|
const supportedExtensions = "|.json|.xml|.txt|.png|.pbf|.zip|.jpeg|.jpg|.gif|.bmp|.gz|.svg|.svgz|.geodatabase|";
|
706
|
-
return !!filenameExtension &&
|
714
|
+
return (!!filenameExtension &&
|
715
|
+
supportedExtensions.indexOf("|" + filenameExtension[0] + "|") >= 0);
|
707
716
|
}
|
708
717
|
/**
|
709
718
|
* Gets the thumbnail of an item or group.
|
@@ -715,7 +724,7 @@ function isSupportedFileType(filename) {
|
|
715
724
|
function getThumbnailFromStorageItem(authentication, filePaths) {
|
716
725
|
let thumbnailUrl;
|
717
726
|
let thumbnailFilename;
|
718
|
-
filePaths.forEach(
|
727
|
+
filePaths.forEach(path => {
|
719
728
|
if (path.type === solutionResource.EFileType.Thumbnail) {
|
720
729
|
thumbnailUrl = path.url;
|
721
730
|
thumbnailFilename = path.filename;
|
@@ -738,7 +747,7 @@ function removeItemResourceFile(itemId, filename, authentication) {
|
|
738
747
|
return removeItemResource({
|
739
748
|
id: itemId,
|
740
749
|
resource: filename,
|
741
|
-
authentication: authentication
|
750
|
+
authentication: authentication
|
742
751
|
});
|
743
752
|
}
|
744
753
|
/**
|
@@ -753,16 +762,14 @@ function removeItemResourceFile(itemId, filename, authentication) {
|
|
753
762
|
function updateItemResourceFile(itemId, filename, resource, authentication) {
|
754
763
|
// Prefix has to be specified separately
|
755
764
|
const prefixedFilenameParts = filename.split("/");
|
756
|
-
const prefix = prefixedFilenameParts.length > 1
|
757
|
-
? prefixedFilenameParts.slice(0, prefixedFilenameParts.length - 1).join("/")
|
758
|
-
: undefined;
|
765
|
+
const prefix = prefixedFilenameParts.length > 1 ? prefixedFilenameParts.slice(0, prefixedFilenameParts.length - 1).join("/") : undefined;
|
759
766
|
const suffix = prefixedFilenameParts[prefixedFilenameParts.length - 1];
|
760
767
|
return updateItemResource({
|
761
768
|
id: itemId,
|
762
769
|
prefix: prefix,
|
763
770
|
name: suffix,
|
764
771
|
resource,
|
765
|
-
authentication: authentication
|
772
|
+
authentication: authentication
|
766
773
|
});
|
767
774
|
}
|
768
775
|
|