@esri/solutions-components 0.6.37 → 0.6.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. package/dist/cjs/calcite-alert_3.cjs.entry.js +1 -1
  2. package/dist/cjs/calcite-combobox_6.cjs.entry.js +1 -1
  3. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
  4. package/dist/cjs/card-manager_3.cjs.entry.js +4 -3
  5. package/dist/cjs/{downloadUtils-37d9aaf3.js → downloadUtils-d8e48fbd.js} +55 -12
  6. package/dist/cjs/{index.es-d1d9b140.js → index.es-6159eedc.js} +4 -3
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/map-select-tools_3.cjs.entry.js +4 -3
  9. package/dist/cjs/{mapViewUtils-96172223.js → mapViewUtils-f7bbc35b.js} +5 -2
  10. package/dist/cjs/public-notification.cjs.entry.js +5 -4
  11. package/dist/cjs/{clean-url-d5326abb.js → restHelpersGet-c94617cf.js} +398 -0
  12. package/dist/cjs/solution-configuration.cjs.entry.js +565 -565
  13. package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
  14. package/dist/cjs/{solution-store-714601a2.js → solution-store-b40c2f46.js} +19 -383
  15. package/dist/cjs/solutions-components.cjs.js +1 -1
  16. package/dist/collection/components/public-notification/public-notification.js +6 -5
  17. package/dist/collection/utils/downloadUtils.js +50 -8
  18. package/dist/collection/utils/downloadUtils.ts +62 -9
  19. package/dist/collection/utils/queryUtils.js +5 -2
  20. package/dist/collection/utils/queryUtils.ts +4 -2
  21. package/dist/components/downloadUtils.js +51 -8
  22. package/dist/components/public-notification.js +2 -2
  23. package/dist/components/queryUtils.js +5 -2
  24. package/dist/components/{clean-url.js → restHelpersGet.js} +392 -1
  25. package/dist/components/solution-configuration.js +552 -552
  26. package/dist/components/solution-store.js +2 -365
  27. package/dist/esm/calcite-alert_3.entry.js +1 -1
  28. package/dist/esm/calcite-combobox_6.entry.js +1 -1
  29. package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
  30. package/dist/esm/card-manager_3.entry.js +4 -3
  31. package/dist/esm/{downloadUtils-76379e4a.js → downloadUtils-d41ecba9.js} +53 -10
  32. package/dist/esm/{index.es-0d134a52.js → index.es-b226bf47.js} +4 -3
  33. package/dist/esm/loader.js +1 -1
  34. package/dist/esm/map-select-tools_3.entry.js +4 -3
  35. package/dist/esm/{mapViewUtils-08f6cfce.js → mapViewUtils-1e2befd7.js} +5 -2
  36. package/dist/esm/public-notification.entry.js +5 -4
  37. package/dist/esm/{clean-url-bce022e6.js → restHelpersGet-a5ec2192.js} +392 -1
  38. package/dist/esm/solution-configuration.entry.js +552 -552
  39. package/dist/esm/solution-contents_3.entry.js +2 -2
  40. package/dist/esm/{solution-store-3ee6c7a3.js → solution-store-17bb0a75.js} +2 -365
  41. package/dist/esm/solutions-components.js +1 -1
  42. package/dist/solutions-components/{p-9800e602.entry.js → p-091120c5.entry.js} +1 -1
  43. package/dist/solutions-components/p-1b14b687.entry.js +6 -0
  44. package/dist/solutions-components/p-20e627ed.entry.js +6 -0
  45. package/dist/solutions-components/{p-646e983f.entry.js → p-2d143359.entry.js} +1 -1
  46. package/dist/solutions-components/{p-ac7332b3.entry.js → p-40e95e2b.entry.js} +1 -1
  47. package/dist/solutions-components/p-420e1585.entry.js +36 -0
  48. package/dist/solutions-components/p-4807b2a1.js +36 -0
  49. package/dist/solutions-components/p-56a3b81e.entry.js +6 -0
  50. package/dist/solutions-components/p-5856dc4f.js +66 -0
  51. package/dist/solutions-components/p-89b4b401.js +145 -0
  52. package/dist/solutions-components/{p-4ecad91c.entry.js → p-973625f8.entry.js} +1 -1
  53. package/dist/solutions-components/{p-03130804.js → p-9ecb5d66.js} +1 -1
  54. package/dist/solutions-components/{p-b02eb8f4.js → p-a8661f1f.js} +30 -30
  55. package/dist/solutions-components/solutions-components.esm.js +1 -1
  56. package/dist/solutions-components/utils/downloadUtils.ts +62 -9
  57. package/dist/solutions-components/utils/queryUtils.ts +4 -2
  58. package/dist/types/components/public-notification/public-notification.d.ts +1 -1
  59. package/dist/types/components.d.ts +2 -2
  60. package/package.json +1 -1
  61. package/dist/esm/polyfills/core-js.js +0 -11
  62. package/dist/esm/polyfills/dom.js +0 -79
  63. package/dist/esm/polyfills/es5-html-element.js +0 -1
  64. package/dist/esm/polyfills/index.js +0 -34
  65. package/dist/esm/polyfills/system.js +0 -6
  66. package/dist/solutions-components/p-13b21d19.entry.js +0 -36
  67. package/dist/solutions-components/p-15070568.js +0 -36
  68. package/dist/solutions-components/p-81a0c88f.entry.js +0 -6
  69. package/dist/solutions-components/p-b7804687.entry.js +0 -6
  70. package/dist/solutions-components/p-d0544f24.js +0 -192
  71. package/dist/solutions-components/p-eba875d9.entry.js +0 -6
  72. package/dist/solutions-components/p-ecc95259.js +0 -20
@@ -3,6 +3,8 @@
3
3
  * Licensed under the Apache License, Version 2.0
4
4
  * http://www.apache.org/licenses/LICENSE-2.0
5
5
  */
6
+ import './solution-resource.js';
7
+
6
8
  /*! *****************************************************************************
7
9
  Copyright (c) Microsoft Corporation.
8
10
 
@@ -564,4 +566,393 @@ function cleanUrl(url) {
564
566
  return url;
565
567
  }
566
568
 
567
- export { ArcGISAuthError as A, NODEJS_DEFAULT_REFERER_HEADER as N, __assign as _, cleanUrl as c, encodeQueryString as e, request as r };
569
+ /** @license
570
+ * Copyright 2020 Esri
571
+ *
572
+ * Licensed under the Apache License, Version 2.0 (the "License");
573
+ * you may not use this file except in compliance with the License.
574
+ * You may obtain a copy of the License at
575
+ *
576
+ * http://www.apache.org/licenses/LICENSE-2.0
577
+ *
578
+ * Unless required by applicable law or agreed to in writing, software
579
+ * distributed under the License is distributed on an "AS IS" BASIS,
580
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
581
+ * See the License for the specific language governing permissions and
582
+ * limitations under the License.
583
+ */
584
+ /**
585
+ * Supplies the File constructor for Microsoft Legacy Edge.
586
+ *
587
+ * @param fileBits Contents for file
588
+ * @param fileName Name for file
589
+ * @param options Bucket of options, euch as `type` for the MIME type; defaults to empty string for `type`
590
+ * @returns File or, for Microsoft Legacy Edge, Blob
591
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/File/File
592
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob
593
+ */
594
+ function new_File(fileBits, fileName, options) {
595
+ let file;
596
+ try {
597
+ // Modern browser
598
+ file = new File(fileBits, fileName, options);
599
+ }
600
+ catch (error) {
601
+ // Microsoft Legacy Edge
602
+ /* istanbul ignore next */
603
+ file = (function () {
604
+ if (typeof options === "undefined") {
605
+ // Microsoft Legacy Edge fails in karma if options is not defined
606
+ options = {
607
+ type: ""
608
+ };
609
+ }
610
+ const blob = new Blob(fileBits, options);
611
+ blob.lastModified = new Date();
612
+ blob.name = fileName;
613
+ return blob;
614
+ })();
615
+ }
616
+ return file;
617
+ }
618
+
619
+ /** @license
620
+ * Copyright 2018 Esri
621
+ *
622
+ * Licensed under the Apache License, Version 2.0 (the "License");
623
+ * you may not use this file except in compliance with the License.
624
+ * You may obtain a copy of the License at
625
+ *
626
+ * http://www.apache.org/licenses/LICENSE-2.0
627
+ *
628
+ * Unless required by applicable law or agreed to in writing, software
629
+ * distributed under the License is distributed on an "AS IS" BASIS,
630
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
631
+ * See the License for the specific language governing permissions and
632
+ * limitations under the License.
633
+ */
634
+ /**
635
+ * Extracts JSON from a Blob.
636
+ *
637
+ * @param blob Blob to use as source
638
+ * @returns A promise that will resolve with JSON or null
639
+ */
640
+ function blobToJson(blob) {
641
+ return new Promise(resolve => {
642
+ blobToText(blob).then(blobContents => {
643
+ try {
644
+ resolve(JSON.parse(blobContents));
645
+ }
646
+ catch (err) {
647
+ resolve(null);
648
+ }
649
+ }, () => resolve(null));
650
+ });
651
+ }
652
+ /**
653
+ * Converts a Blob to a File.
654
+ *
655
+ * @param blob Blob to use as source
656
+ * @param filename Name to use for file
657
+ * @param mimeType MIME type to override blob's MIME type
658
+ * @returns File created out of Blob and filename
659
+ */
660
+ function blobToFile(blob, filename, mimeType) {
661
+ return blob
662
+ ? new_File([blob], filename ? filename : "", {
663
+ type: mimeType || blob.type
664
+ })
665
+ : null;
666
+ }
667
+ /**
668
+ * Extracts text from a Blob.
669
+ *
670
+ * @param blob Blob to use as source
671
+ * @returns A promise that will resolve with text read from blob
672
+ */
673
+ function blobToText(blob) {
674
+ return new Promise(resolve => {
675
+ const reader = new FileReader();
676
+ reader.onload = function (evt) {
677
+ // Disable needed because Node requires cast
678
+ // tslint:disable-next-line: no-unnecessary-type-assertion
679
+ const blobContents = evt.target.result;
680
+ resolve(blobContents ? blobContents : ""); // not handling ArrayContents variant
681
+ };
682
+ reader.readAsText(blob);
683
+ });
684
+ }
685
+ /**
686
+ * Checks that a URL path ends with a slash.
687
+ *
688
+ * @param url URL to check
689
+ * @returns URL, appended with slash if missing
690
+ */
691
+ function checkUrlPathTermination(url) {
692
+ return url ? (url.endsWith("/") ? url : url + "/") : url;
693
+ }
694
+ /**
695
+ * Gets a property out of a deeply nested object.
696
+ * Does not handle anything but nested object graph
697
+ *
698
+ * @param obj Object to retrieve value from
699
+ * @param path Path into an object, e.g., "data.values.webmap", where "data" is a top-level property
700
+ * in obj
701
+ * @returns Value at end of path
702
+ */
703
+ function getProp(obj, path) {
704
+ return path.split(".").reduce(function (prev, curr) {
705
+ /* istanbul ignore next no need to test undefined scenario */
706
+ return prev ? prev[curr] : undefined;
707
+ }, obj);
708
+ }
709
+ /**
710
+ * Sets a deeply nested property of an object.
711
+ * Creates the full path if it does not exist.
712
+ *
713
+ * @param obj Object to set value of
714
+ * @param path Path into an object, e.g., "data.values.webmap", where "data" is a top-level property in obj
715
+ * @param value The value to set at the end of the path
716
+ */
717
+ function setCreateProp(obj, path, value) {
718
+ const pathParts = path.split(".");
719
+ pathParts.reduce((a, b, c) => {
720
+ if (c === pathParts.length - 1) {
721
+ a[b] = value;
722
+ return value;
723
+ }
724
+ else {
725
+ if (!a[b]) {
726
+ a[b] = {};
727
+ }
728
+ return a[b];
729
+ }
730
+ }, obj);
731
+ }
732
+
733
+ /**
734
+ * Gets a Blob from a web site.
735
+ *
736
+ * @param url Address of Blob
737
+ * @param authentication Credentials for the request
738
+ * @param requestOptions - Options for the request, including parameters relevant to the endpoint.
739
+ * @returns Promise that will resolve with Blob or an AGO-style JSON failure response
740
+ */
741
+ function getBlob(url, authentication, requestOptions = {}) {
742
+ if (!url) {
743
+ return Promise.reject("Url must be provided");
744
+ }
745
+ const blobRequestOptions = {
746
+ authentication: authentication,
747
+ rawResponse: true,
748
+ ...requestOptions
749
+ };
750
+ return request(url, blobRequestOptions).then(response => {
751
+ return response.blob();
752
+ });
753
+ }
754
+
755
+ /** @license
756
+ * Copyright 2018 Esri
757
+ *
758
+ * Licensed under the Apache License, Version 2.0 (the "License");
759
+ * you may not use this file except in compliance with the License.
760
+ * You may obtain a copy of the License at
761
+ *
762
+ * http://www.apache.org/licenses/LICENSE-2.0
763
+ *
764
+ * Unless required by applicable law or agreed to in writing, software
765
+ * distributed under the License is distributed on an "AS IS" BASIS,
766
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
767
+ * See the License for the specific language governing permissions and
768
+ * limitations under the License.
769
+ */
770
+ // ------------------------------------------------------------------------------------------------------------------ //
771
+ const ZIP_FILE_HEADER_SIGNATURE = "PK";
772
+ /**
773
+ * Gets a Blob from a web site and casts it as a file using the supplied name.
774
+ *
775
+ * @param url Address of Blob
776
+ * @param filename Name to use for file
777
+ * @param authentication Credentials for the request
778
+ * @returns Promise that will resolve with a File, undefined if the Blob is null, or an AGO-style JSON failure response
779
+ */
780
+ function getBlobAsFile(url, filename, authentication, ignoreErrors = [], mimeType) {
781
+ return new Promise((resolve, reject) => {
782
+ // Get the blob from the URL
783
+ getBlobCheckForError(url, authentication, ignoreErrors).then(blob => !blob ? resolve(null) : resolve(blobToFile(blob, filename, mimeType)), reject);
784
+ });
785
+ }
786
+ /**
787
+ * Gets a Blob from a web site and checks for a JSON error packet in the Blob.
788
+ *
789
+ * @param url Address of Blob
790
+ * @param authentication Credentials for the request
791
+ * @param ignoreErrors List of HTTP error codes that should be ignored
792
+ * @returns Promise that will resolve with Blob or an AGO-REST JSON failure response
793
+ */
794
+ function getBlobCheckForError(url, authentication, ignoreErrors = []) {
795
+ return new Promise((resolve, reject) => {
796
+ // Get the blob from the URL
797
+ getBlob(url, authentication).then(blob => {
798
+ // Reclassify text/plain blobs as needed
799
+ _fixTextBlobType(blob).then(adjustedBlob => {
800
+ if (adjustedBlob.type === "application/json") {
801
+ // Blob may be an error
802
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
803
+ blobToJson(adjustedBlob).then((json) => {
804
+ // Check for valid JSON with an error
805
+ if (json?.error) {
806
+ const code = json.error.code;
807
+ if (code !== undefined && ignoreErrors.indexOf(code) >= 0) {
808
+ resolve(null); // Error, but ignored
809
+ }
810
+ else {
811
+ reject(json); // Other error; fail with error
812
+ }
813
+ }
814
+ else {
815
+ resolve(adjustedBlob);
816
+ }
817
+ });
818
+ }
819
+ else {
820
+ resolve(adjustedBlob);
821
+ }
822
+ }, reject);
823
+ }, reject);
824
+ });
825
+ }
826
+ /**
827
+ * Gets the data information of an AGO item in its JSON form.
828
+ *
829
+ * @param itemId Id of an item whose data information is sought
830
+ * @param filename Name to use for file
831
+ * @param authentication Credentials for the request to AGO
832
+ * @returns Promise that will resolve with JSON, or an AGO-style JSON failure response
833
+ */
834
+ function getItemDataAsJson(itemId, authentication) {
835
+ return new Promise(resolve => {
836
+ getItemDataBlob(itemId, authentication).then(blob => resolve(blobToJson(blob)), () => resolve(null));
837
+ });
838
+ }
839
+ /**
840
+ * Gets the data information of an AGO item in its raw (Blob) form.
841
+ *
842
+ * @param itemId Id of an item whose data information is sought
843
+ * @param authentication Credentials for the request to AGO
844
+ * @returns A promise that will resolve with the data Blob or null if the item doesn't have a data section
845
+ */
846
+ function getItemDataBlob(itemId, authentication) {
847
+ return new Promise(resolve => {
848
+ const url = getItemDataBlobUrl(itemId, authentication);
849
+ getBlobCheckForError(url, authentication, [400, 500]).then(blob => resolve(_fixTextBlobType(blob)), () => resolve(null));
850
+ });
851
+ }
852
+ /**
853
+ * Gets the URL to the data information of an AGO item in its raw (Blob) form.
854
+ *
855
+ * @param itemId Id of an item whose data information is sought
856
+ * @param authentication Credentials for the request to AGO
857
+ * @returns URL string
858
+ */
859
+ function getItemDataBlobUrl(itemId, authentication) {
860
+ return `${getPortalSharingUrlFromAuth(authentication)}/content/items/${itemId}/data`;
861
+ }
862
+ /**
863
+ * Gets a JSON from a web site.
864
+ *
865
+ * @param url Address of JSON
866
+ * @param authentication Credentials for the request
867
+ * @returns Promise that will resolve with JSON
868
+ */
869
+ function getJson(url, authentication) {
870
+ // Get the blob from the URL
871
+ const requestOptions = { httpMethod: "GET" };
872
+ return getBlob(url, authentication, requestOptions)
873
+ .then(blob => {
874
+ // Reclassify text/plain blobs as needed
875
+ return _fixTextBlobType(blob);
876
+ })
877
+ .then(adjustedBlob => {
878
+ if (adjustedBlob.type === "application/json") {
879
+ // Blob may be an error
880
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
881
+ return blobToJson(adjustedBlob);
882
+ }
883
+ else {
884
+ return Promise.resolve(null);
885
+ }
886
+ });
887
+ }
888
+ /**
889
+ * Extracts the portal sharing url from a supplied authentication.
890
+ *
891
+ * @param authentication Credentials for the request to AGO
892
+ * @returns Portal sharing url to be used in API requests, defaulting to `https://www.arcgis.com/sharing/rest`
893
+ */
894
+ function getPortalSharingUrlFromAuth(authentication) {
895
+ // If auth was passed, use that portal
896
+ return getProp(authentication, "portal") || "https://www.arcgis.com/sharing/rest";
897
+ }
898
+ function getThumbnailFile(url, filename, authentication) {
899
+ return new Promise(resolve => {
900
+ getBlobAsFile(url, filename, authentication, [500]).then(resolve, () => resolve(null));
901
+ });
902
+ }
903
+ // ------------------------------------------------------------------------------------------------------------------ //
904
+ /**
905
+ * Fixes the types of Blobs incorrectly typed as text/plain.
906
+ *
907
+ * @param blob Blob to check
908
+ * @returns Promise resolving to original Blob, unless it's originally typed as text/plain but is
909
+ * really JSON, ZIP, or XML
910
+ * @private
911
+ */
912
+ function _fixTextBlobType(blob) {
913
+ return new Promise((resolve, reject) => {
914
+ if (blob &&
915
+ blob.size > 0 &&
916
+ (blob.type.startsWith("text/plain") ||
917
+ blob.type.startsWith("application/json"))) {
918
+ blobToText(blob).then(blobText => {
919
+ // Convertible to JSON?
920
+ try {
921
+ JSON.parse(blobText);
922
+ // Yes; reclassify as JSON
923
+ resolve(new Blob([blob], { type: "application/json" }));
924
+ }
925
+ catch (ignored) {
926
+ // Nope; test for ZIP file
927
+ if (blobText.length > 4 &&
928
+ blobText.substr(0, 4) === ZIP_FILE_HEADER_SIGNATURE) {
929
+ // Yes; reclassify as ZIP
930
+ resolve(new Blob([blob], { type: "application/zip" }));
931
+ }
932
+ else if (blobText.startsWith("<")) {
933
+ // Reclassify as XML; since the blob started out as text/plain, it's more likely that is
934
+ // meant to be human-readable, so we'll use text/xml instead of application/xml
935
+ resolve(new Blob([blob], { type: "text/xml" }));
936
+ }
937
+ else {
938
+ // Leave as text
939
+ resolve(blob);
940
+ }
941
+ }
942
+ },
943
+ // Faulty blob
944
+ reject);
945
+ }
946
+ else {
947
+ // Empty or not typed as plain text, so simply return
948
+ if (blob) {
949
+ resolve(blob);
950
+ }
951
+ else {
952
+ reject();
953
+ }
954
+ }
955
+ });
956
+ }
957
+
958
+ export { ArcGISAuthError as A, NODEJS_DEFAULT_REFERER_HEADER as N, __assign as _, getProp as a, blobToFile as b, cleanUrl as c, checkUrlPathTermination as d, encodeQueryString as e, getThumbnailFile as f, getJson as g, getItemDataAsJson as h, request as r, setCreateProp as s };