@esri/hub-common 14.157.0 → 14.159.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/content/_internal/computeProps.js +61 -0
- package/dist/esm/content/_internal/computeProps.js.map +1 -1
- package/dist/esm/content/_internal/fetchEditableContentEnrichments.js +55 -0
- package/dist/esm/content/_internal/fetchEditableContentEnrichments.js.map +1 -0
- package/dist/esm/content/_internal/fetchItemScheduleEnrichment.js +28 -0
- package/dist/esm/content/_internal/fetchItemScheduleEnrichment.js.map +1 -0
- package/dist/esm/content/edit.js +2 -1
- package/dist/esm/content/edit.js.map +1 -1
- package/dist/esm/content/{fetch.js → fetchContent.js} +2 -49
- package/dist/esm/content/fetchContent.js.map +1 -0
- package/dist/esm/content/fetchHubContent.js +26 -0
- package/dist/esm/content/fetchHubContent.js.map +1 -0
- package/dist/esm/content/index.js +3 -1
- package/dist/esm/content/index.js.map +1 -1
- package/dist/esm/content/modelToHubEditableContent.js +16 -0
- package/dist/esm/content/modelToHubEditableContent.js.map +1 -0
- package/dist/esm/content/types.js.map +1 -1
- package/dist/esm/core/fetchHubEntity.js +1 -1
- package/dist/esm/core/fetchHubEntity.js.map +1 -1
- package/dist/esm/downloads/_internal/_types.js +5 -8
- package/dist/esm/downloads/_internal/_types.js.map +1 -1
- package/dist/esm/downloads/_internal/canUseExportImageFlow.js +7 -1
- package/dist/esm/downloads/_internal/canUseExportImageFlow.js.map +1 -1
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFile.js +77 -0
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFile.js.map +1 -0
- package/dist/esm/downloads/_internal/file-url-fetchers/{fetchExportItemDownloadFileUrl.js → fetchExportItemDownloadFile.js} +6 -3
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchExportItemDownloadFile.js.map +1 -0
- package/dist/esm/downloads/_internal/file-url-fetchers/{fetchHubApiDownloadFileUrl.js → fetchHubApiDownloadFile.js} +6 -3
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchHubApiDownloadFile.js.map +1 -0
- package/dist/esm/downloads/_internal/format-fetchers/getCreateReplicaFormats.js +1 -0
- package/dist/esm/downloads/_internal/format-fetchers/getCreateReplicaFormats.js.map +1 -1
- package/dist/esm/downloads/_internal/format-fetchers/getExportImageFormats.js +16 -6
- package/dist/esm/downloads/_internal/format-fetchers/getExportImageFormats.js.map +1 -1
- package/dist/esm/downloads/canUseCreateReplica.js +1 -0
- package/dist/esm/downloads/canUseCreateReplica.js.map +1 -1
- package/dist/esm/downloads/canUseHubDownloadSystem.js +1 -0
- package/dist/esm/downloads/canUseHubDownloadSystem.js.map +1 -1
- package/dist/esm/downloads/{fetchDownloadFileUrl.js → fetchDownloadFile.js} +8 -8
- package/dist/esm/downloads/fetchDownloadFile.js.map +1 -0
- package/dist/esm/downloads/fetchDownloadFormats.js +2 -1
- package/dist/esm/downloads/fetchDownloadFormats.js.map +1 -1
- package/dist/esm/downloads/index.js +1 -1
- package/dist/esm/downloads/index.js.map +1 -1
- package/dist/esm/downloads/types.js +4 -4
- package/dist/esm/downloads/types.js.map +1 -1
- package/dist/esm/events/_internal/PropertyMapper.js +0 -1
- package/dist/esm/events/_internal/PropertyMapper.js.map +1 -1
- package/dist/esm/events/_internal/getPropertyMap.js +8 -0
- package/dist/esm/events/_internal/getPropertyMap.js.map +1 -1
- package/dist/esm/events/api/orval/api/orval-events.js.map +1 -1
- package/dist/esm/items/_enrichments.js.map +1 -1
- package/dist/node/content/_internal/computeProps.js +61 -0
- package/dist/node/content/_internal/computeProps.js.map +1 -1
- package/dist/node/content/_internal/fetchEditableContentEnrichments.js +59 -0
- package/dist/node/content/_internal/fetchEditableContentEnrichments.js.map +1 -0
- package/dist/node/content/_internal/fetchItemScheduleEnrichment.js +32 -0
- package/dist/node/content/_internal/fetchItemScheduleEnrichment.js.map +1 -0
- package/dist/node/content/edit.js +3 -2
- package/dist/node/content/edit.js.map +1 -1
- package/dist/node/content/{fetch.js → fetchContent.js} +2 -50
- package/dist/node/content/{fetch.js.map → fetchContent.js.map} +1 -1
- package/dist/node/content/fetchHubContent.js +29 -0
- package/dist/node/content/fetchHubContent.js.map +1 -0
- package/dist/node/content/index.js +3 -1
- package/dist/node/content/index.js.map +1 -1
- package/dist/node/content/modelToHubEditableContent.js +20 -0
- package/dist/node/content/modelToHubEditableContent.js.map +1 -0
- package/dist/node/content/types.js.map +1 -1
- package/dist/node/core/fetchHubEntity.js +12 -12
- package/dist/node/core/fetchHubEntity.js.map +1 -1
- package/dist/node/downloads/_internal/_types.js +5 -8
- package/dist/node/downloads/_internal/_types.js.map +1 -1
- package/dist/node/downloads/_internal/canUseExportImageFlow.js +7 -1
- package/dist/node/downloads/_internal/canUseExportImageFlow.js.map +1 -1
- package/dist/node/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFile.js +81 -0
- package/dist/node/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFile.js.map +1 -0
- package/dist/node/downloads/_internal/file-url-fetchers/{fetchExportItemDownloadFileUrl.js → fetchExportItemDownloadFile.js} +8 -5
- package/dist/node/downloads/_internal/file-url-fetchers/fetchExportItemDownloadFile.js.map +1 -0
- package/dist/node/downloads/_internal/file-url-fetchers/{fetchHubApiDownloadFileUrl.js → fetchHubApiDownloadFile.js} +8 -5
- package/dist/node/downloads/_internal/file-url-fetchers/fetchHubApiDownloadFile.js.map +1 -0
- package/dist/node/downloads/_internal/format-fetchers/getCreateReplicaFormats.js +1 -0
- package/dist/node/downloads/_internal/format-fetchers/getCreateReplicaFormats.js.map +1 -1
- package/dist/node/downloads/_internal/format-fetchers/getExportImageFormats.js +16 -6
- package/dist/node/downloads/_internal/format-fetchers/getExportImageFormats.js.map +1 -1
- package/dist/node/downloads/canUseCreateReplica.js +1 -0
- package/dist/node/downloads/canUseCreateReplica.js.map +1 -1
- package/dist/node/downloads/canUseHubDownloadSystem.js +1 -0
- package/dist/node/downloads/canUseHubDownloadSystem.js.map +1 -1
- package/dist/node/downloads/{fetchDownloadFileUrl.js → fetchDownloadFile.js} +10 -10
- package/dist/node/downloads/fetchDownloadFile.js.map +1 -0
- package/dist/node/downloads/fetchDownloadFormats.js +2 -1
- package/dist/node/downloads/fetchDownloadFormats.js.map +1 -1
- package/dist/node/downloads/index.js +1 -1
- package/dist/node/downloads/index.js.map +1 -1
- package/dist/node/downloads/types.js +4 -4
- package/dist/node/downloads/types.js.map +1 -1
- package/dist/node/events/_internal/PropertyMapper.js +0 -1
- package/dist/node/events/_internal/PropertyMapper.js.map +1 -1
- package/dist/node/events/_internal/getPropertyMap.js +8 -0
- package/dist/node/events/_internal/getPropertyMap.js.map +1 -1
- package/dist/node/events/api/orval/api/orval-events.js.map +1 -1
- package/dist/node/items/_enrichments.js.map +1 -1
- package/dist/types/content/_fetch.d.ts +1 -2
- package/dist/types/content/_internal/fetchEditableContentEnrichments.d.ts +16 -0
- package/dist/types/content/_internal/fetchItemScheduleEnrichment.d.ts +15 -0
- package/dist/types/content/fetchContent.d.ts +24 -0
- package/dist/types/content/fetchHubContent.d.ts +10 -0
- package/dist/types/content/index.d.ts +3 -1
- package/dist/types/content/modelToHubEditableContent.d.ts +12 -0
- package/dist/types/core/types/IHubEditableContent.d.ts +69 -0
- package/dist/types/core/types/IHubEvent.d.ts +8 -0
- package/dist/types/downloads/_internal/_types.d.ts +2 -1
- package/dist/types/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFile.d.ts +10 -0
- package/dist/types/downloads/_internal/file-url-fetchers/{fetchExportItemDownloadFileUrl.d.ts → fetchExportItemDownloadFile.d.ts} +2 -2
- package/dist/types/downloads/_internal/file-url-fetchers/{fetchHubApiDownloadFileUrl.d.ts → fetchHubApiDownloadFile.d.ts} +2 -2
- package/dist/types/downloads/_internal/format-fetchers/getExportImageFormats.d.ts +3 -4
- package/dist/types/downloads/fetchDownloadFile.d.ts +8 -0
- package/dist/types/downloads/index.d.ts +1 -1
- package/dist/types/downloads/types.d.ts +19 -6
- package/dist/types/events/api/orval/api/orval-events.d.ts +176 -156
- package/dist/types/items/_enrichments.d.ts +6 -2
- package/package.json +1 -1
- package/dist/esm/content/fetch.js.map +0 -1
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFileUrl.js +0 -46
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFileUrl.js.map +0 -1
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchExportItemDownloadFileUrl.js.map +0 -1
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchHubApiDownloadFileUrl.js.map +0 -1
- package/dist/esm/downloads/fetchDownloadFileUrl.js.map +0 -1
- package/dist/node/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFileUrl.js +0 -50
- package/dist/node/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFileUrl.js.map +0 -1
- package/dist/node/downloads/_internal/file-url-fetchers/fetchExportItemDownloadFileUrl.js.map +0 -1
- package/dist/node/downloads/_internal/file-url-fetchers/fetchHubApiDownloadFileUrl.js.map +0 -1
- package/dist/node/downloads/fetchDownloadFileUrl.js.map +0 -1
- package/dist/types/content/fetch.d.ts +0 -33
- package/dist/types/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFileUrl.d.ts +0 -12
- package/dist/types/downloads/fetchDownloadFileUrl.d.ts +0 -8
|
@@ -6,6 +6,7 @@ import { isDiscussable } from "../../discussions";
|
|
|
6
6
|
import { hasServiceCapability, ServiceCapabilities, } from "../hostedServiceUtils";
|
|
7
7
|
import { computeBaseProps } from "../../core/_internal/computeBaseProps";
|
|
8
8
|
import { getProp } from "../../objects";
|
|
9
|
+
import { isService } from "../../resources/_internal/_validate-url-helpers";
|
|
9
10
|
export function computeProps(model, content, requestOptions, enrichments = {}) {
|
|
10
11
|
let token;
|
|
11
12
|
if (requestOptions.authentication) {
|
|
@@ -32,6 +33,11 @@ export function computeProps(model, content, requestOptions, enrichments = {}) {
|
|
|
32
33
|
content.isDiscussable = isDiscussable(content);
|
|
33
34
|
// when we receive a schedule from the enrichments, we want to use it, otherwise default to automatic
|
|
34
35
|
content.schedule = enrichments.schedule;
|
|
36
|
+
// calculate extendedProps
|
|
37
|
+
content.extendedProps = isService(content.url)
|
|
38
|
+
? getServiceExtendedProps(model.item, enrichments, requestOptions)
|
|
39
|
+
: getContentExtendedProps(model.item, enrichments, requestOptions);
|
|
40
|
+
// TODO: Remove once .serverQueryCapability, .serverExtractCapability, and .serverExtractFormats are removed
|
|
35
41
|
if (enrichments.server) {
|
|
36
42
|
content.serverQueryCapability = hasServiceCapability(ServiceCapabilities.QUERY, enrichments.server);
|
|
37
43
|
content.serverExtractCapability = hasServiceCapability(ServiceCapabilities.EXTRACT, enrichments.server);
|
|
@@ -39,9 +45,64 @@ export function computeProps(model, content, requestOptions, enrichments = {}) {
|
|
|
39
45
|
content.serverExtractFormats =
|
|
40
46
|
extractFormatsList && extractFormatsList.split(",");
|
|
41
47
|
}
|
|
48
|
+
// TODO: remove once .additionalResources is removed
|
|
42
49
|
if (enrichments.metadata) {
|
|
43
50
|
content.additionalResources = getAdditionalResources(model.item, enrichments.metadata, requestOptions);
|
|
44
51
|
}
|
|
45
52
|
return content;
|
|
46
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* @private
|
|
56
|
+
*
|
|
57
|
+
* Compute the extended props for a service-backed item (i.e., feature, map, or image service)
|
|
58
|
+
*
|
|
59
|
+
* @param item
|
|
60
|
+
* @param enrichments
|
|
61
|
+
* @param requestOptions
|
|
62
|
+
* @returns extended props for a service-backed item
|
|
63
|
+
*/
|
|
64
|
+
function getServiceExtendedProps(item, enrichments, requestOptions) {
|
|
65
|
+
const baseProps = getBaseExtendedProps(item, enrichments, requestOptions);
|
|
66
|
+
const result = Object.assign(Object.assign({}, baseProps), { kind: "service" });
|
|
67
|
+
if (enrichments.server) {
|
|
68
|
+
result.server = enrichments.server;
|
|
69
|
+
result.serverQueryCapability = hasServiceCapability(ServiceCapabilities.QUERY, enrichments.server);
|
|
70
|
+
result.serverExtractCapability = hasServiceCapability(ServiceCapabilities.EXTRACT, enrichments.server);
|
|
71
|
+
const extractFormatsList = getProp(enrichments, "server.supportedExportFormats");
|
|
72
|
+
result.serverExtractFormats =
|
|
73
|
+
extractFormatsList && extractFormatsList.split(",");
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @private
|
|
79
|
+
*
|
|
80
|
+
* Compute the extended props for content items not backed by a service
|
|
81
|
+
*
|
|
82
|
+
* @param item
|
|
83
|
+
* @param enrichments
|
|
84
|
+
* @param requestOptions
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
function getContentExtendedProps(item, enrichments, requestOptions) {
|
|
88
|
+
const baseProps = getBaseExtendedProps(item, enrichments, requestOptions);
|
|
89
|
+
return Object.assign(Object.assign({}, baseProps), { kind: "content" });
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @private
|
|
93
|
+
*
|
|
94
|
+
* Compute the extended props common to all content items.
|
|
95
|
+
*
|
|
96
|
+
* @param item
|
|
97
|
+
* @param enrichments
|
|
98
|
+
* @param requestOptions
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
function getBaseExtendedProps(item, enrichments, requestOptions) {
|
|
102
|
+
return {
|
|
103
|
+
kind: null,
|
|
104
|
+
metadata: enrichments.metadata,
|
|
105
|
+
additionalResources: getAdditionalResources(item, enrichments.metadata, requestOptions),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
47
108
|
//# sourceMappingURL=computeProps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeProps.js","sourceRoot":"","sources":["../../../../src/content/_internal/computeProps.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB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AAoB,CAC3B,IAAW,EACX,WAA2C,EAC3C,cAA+B;IAE/B,OAAO;QACL,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,WAAW,CAAC,QAAQ;QAC9B,mBAAmB,EAAE,sBAAsB,CACzC,IAAI,EACJ,WAAW,CAAC,QAAQ,EACpB,cAAoC,CACrC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { fetchItemEnrichments, } from "../../items/_enrichments";
|
|
2
|
+
import { isService } from "../../resources/_internal/_validate-url-helpers";
|
|
3
|
+
import { fetchItemScheduleEnrichment } from "./fetchItemScheduleEnrichment";
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
*
|
|
7
|
+
* Fetches the enrichments for a content item to be converted into an IHubEditableContent object.
|
|
8
|
+
* If no enrichment keys are provided, the default enrichments will be fetched. Default enrichments
|
|
9
|
+
* vary by item type.
|
|
10
|
+
*
|
|
11
|
+
* @param item item to fetch enrichments for
|
|
12
|
+
* @param requestOptions
|
|
13
|
+
* @param enrichments optional override for the enrichments to fetch
|
|
14
|
+
* @returns a hash of enrichments
|
|
15
|
+
*/
|
|
16
|
+
export async function fetchEditableContentEnrichments(item, requestOptions, enrichments) {
|
|
17
|
+
const result = {};
|
|
18
|
+
if (!enrichments) {
|
|
19
|
+
enrichments = getDefaultEnrichmentKeys(item);
|
|
20
|
+
}
|
|
21
|
+
// NOTE: Enrichments for IHubEditableContent can be fetched one of two ways:
|
|
22
|
+
//
|
|
23
|
+
// 1: Via `fetchItemEnrichments()`. This was the old way that we used to fetch enrichments
|
|
24
|
+
// in the `fetchContent()` era. Since the code still works and has great error handling,
|
|
25
|
+
// there's no reason to re-invent the wheel.
|
|
26
|
+
// 2. Via ad-hoc fetch functions. We typically use this for new enrichments that are not
|
|
27
|
+
// supported by `fetchItemEnrichments()` (e.g. schedule)
|
|
28
|
+
//
|
|
29
|
+
// Eventually we'll want to move all new enrichments to the `fetchItemEnrichments()` subsystem,
|
|
30
|
+
// but before we do we'll need to evaluate any impacts that would have on existing code, since
|
|
31
|
+
// `fetchContent()` is still widely used in the codebase.
|
|
32
|
+
const adHocEnrichments = ["schedule"];
|
|
33
|
+
const fetchItemEnrichmentKeys = enrichments.filter((e) => !adHocEnrichments.includes(e));
|
|
34
|
+
if (fetchItemEnrichmentKeys.length) {
|
|
35
|
+
// TODO: Abstract this into a helper function that can be used by enrichContentSearchResult()
|
|
36
|
+
const itemOrServerEnrichments = await fetchItemEnrichments(item, fetchItemEnrichmentKeys, requestOptions);
|
|
37
|
+
fetchItemEnrichmentKeys.forEach((key) => {
|
|
38
|
+
result[key] = itemOrServerEnrichments[key];
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
// Fetch the schedule separately if it's requested
|
|
42
|
+
// TODO: should we add scheduling to the fetchItemEnrichments() subsystem?
|
|
43
|
+
if (enrichments.includes("schedule")) {
|
|
44
|
+
result.schedule = await fetchItemScheduleEnrichment(item, requestOptions);
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
function getDefaultEnrichmentKeys(item) {
|
|
49
|
+
const enrichments = ["metadata", "schedule"];
|
|
50
|
+
if (isService(item.url)) {
|
|
51
|
+
enrichments.push("server");
|
|
52
|
+
}
|
|
53
|
+
return enrichments;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=fetchEditableContentEnrichments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchEditableContentEnrichments.js","sourceRoot":"","sources":["../../../../src/content/_internal/fetchEditableContentEnrichments.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAI5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,I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,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getSchedule, isDownloadSchedulingAvailable } from "../manageSchedule";
|
|
2
|
+
/**
|
|
3
|
+
* @private
|
|
4
|
+
*
|
|
5
|
+
* Fetches the schedule enrichment for a content item. The enrichment will only be fetched if the item
|
|
6
|
+
* is eligible for download scheduling and the user has permission to view the schedule. In cases
|
|
7
|
+
* where the schedule cannot be fetched, the function will return undefined.
|
|
8
|
+
*
|
|
9
|
+
* @param item
|
|
10
|
+
* @param requestOptions
|
|
11
|
+
* @returns the schedule enrichment or undefined
|
|
12
|
+
*/
|
|
13
|
+
export async function fetchItemScheduleEnrichment(item, requestOptions) {
|
|
14
|
+
let result;
|
|
15
|
+
if (isDownloadSchedulingAvailable(requestOptions, item.access)) {
|
|
16
|
+
try {
|
|
17
|
+
// fetch schedule and add it to enrichments if it exists in schedule API
|
|
18
|
+
const { schedule } = await getSchedule(item.id, requestOptions);
|
|
19
|
+
result = schedule || { mode: "automatic" };
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
/* tslint:disable no-console */
|
|
23
|
+
console.warn("Failed to fetch schedule for item", item.id, error);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=fetchItemScheduleEnrichment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchItemScheduleEnrichment.js","sourceRoot":"","sources":["../../../../src/content/_internal/fetchItemScheduleEnrichment.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAK/E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,IAAW,EACX,cAA+B;IAE/B,IAAI,MAAoB,CAAC;IACzB,IACE,6BAA6B,CAC3B,cAAoC,EACpC,IAAI,CAAC,MAAM,CACZ,EACD;QACA,IAAI;YACF,wEAAwE;YACxE,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,WAAW,CACpC,IAAI,CAAC,EAAE,EACP,cAAqC,CACtC,CAAC;YACF,MAAM,GAAG,QAAQ,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;SAC5C;QAAC,OAAO,KAAK,EAAE;YACd,+BAA+B;YAC/B,OAAO,CAAC,IAAI,CAAC,mCAAmC,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SACnE;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/esm/content/edit.js
CHANGED
|
@@ -5,7 +5,7 @@ import { PropertyMapper } from "../core/_internal/PropertyMapper";
|
|
|
5
5
|
import { getPropertyMap } from "./_internal/getPropertyMap";
|
|
6
6
|
import { cloneObject } from "../util";
|
|
7
7
|
import { setDiscussableKeyword } from "../discussions";
|
|
8
|
-
import { modelToHubEditableContent } from "./
|
|
8
|
+
import { modelToHubEditableContent } from "./modelToHubEditableContent";
|
|
9
9
|
import { getService, parseServiceUrl, } from "@esri/arcgis-rest-feature-layer";
|
|
10
10
|
import { updateServiceDefinition } from "@esri/arcgis-rest-service-admin";
|
|
11
11
|
import { hasServiceCapability, isHostedFeatureServiceMainEntity, ServiceCapabilities, toggleServiceCapability, } from "./hostedServiceUtils";
|
|
@@ -100,6 +100,7 @@ export async function updateContent(content, requestOptions) {
|
|
|
100
100
|
const currentDefinition = await getService(Object.assign(Object.assign({}, requestOptions), { url: content.url }));
|
|
101
101
|
const currentServerExtractEnabled = hasServiceCapability(ServiceCapabilities.EXTRACT, currentDefinition);
|
|
102
102
|
// To avoid over-updating the service, we only fire an update call if Extract has changed
|
|
103
|
+
// TODO: Change the edit flow and entity schema to read from `extendedProps.serverExtractCapability`
|
|
103
104
|
if (currentServerExtractEnabled !== content.serverExtractCapability) {
|
|
104
105
|
const updatedDefinition = toggleServiceCapability(ServiceCapabilities.EXTRACT, currentDefinition);
|
|
105
106
|
const updatedServiceCapabilities = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../src/content/edit.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,OAAO,EACP,UAAU,GACX,MAAM,0BAA0B,CAAC;AAGlC,4EAA4E;AAC5E,OAAO,EACL,WAAW,EACX,WAAW,GAEZ,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../src/content/edit.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,OAAO,EACP,UAAU,GACX,MAAM,0BAA0B,CAAC;AAGlC,4EAA4E;AAC5E,OAAO,EACL,WAAW,EACX,WAAW,GAEZ,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACL,UAAU,EAEV,eAAe,GAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EACL,oBAAoB,EACpB,gCAAgC,EAChC,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,6BAA6B,EAC7B,mBAAmB,GACpB,MAA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AAQ,0CAAE,MAAM,CAAC;IAEzC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -7,13 +7,7 @@ import { maybeConcat } from "../utils/_array";
|
|
|
7
7
|
import { addContextToSlug, isSlug, parseDatasetId } from "./slugs";
|
|
8
8
|
import { fetchHubEnrichmentsById, fetchHubEnrichmentsBySlug, getContentEnrichments, } from "./_fetch";
|
|
9
9
|
import { canUseHubApiForItem } from "./_internal/internalContentUtils";
|
|
10
|
-
import { composeContent, getItemLayer, getProxyUrl
|
|
11
|
-
import { PropertyMapper } from "../core/_internal/PropertyMapper";
|
|
12
|
-
import { getPropertyMap } from "./_internal/getPropertyMap";
|
|
13
|
-
import { computeProps } from "./_internal/computeProps";
|
|
14
|
-
import { setProp } from "../objects";
|
|
15
|
-
import { getSchedule, isDownloadSchedulingAvailable } from "./manageSchedule";
|
|
16
|
-
import { isMapOrFeatureServerUrl } from "../urls";
|
|
10
|
+
import { composeContent, getItemLayer, getProxyUrl } from "./compose";
|
|
17
11
|
const hasFeatures = (contentType) => ["Feature Layer", "Table"].includes(contentType);
|
|
18
12
|
const maybeFetchLayerEnrichments = async (itemAndEnrichments, options) => {
|
|
19
13
|
const { item } = itemAndEnrichments;
|
|
@@ -143,45 +137,4 @@ export const fetchContent = async (identifier, options) => {
|
|
|
143
137
|
: content.recordCount;
|
|
144
138
|
return content;
|
|
145
139
|
};
|
|
146
|
-
|
|
147
|
-
* fetch a content entity by identifier
|
|
148
|
-
* @param identifier
|
|
149
|
-
* @param requestOptions
|
|
150
|
-
* @returns content entity
|
|
151
|
-
*/
|
|
152
|
-
export const fetchHubContent = async (identifier, requestOptions) => {
|
|
153
|
-
// NOTE: b/c we have to support slugs we use fetchContent() to get the item
|
|
154
|
-
// by telling it to not fetch any enrichments which we then fetch as needed after we have the item
|
|
155
|
-
const options = Object.assign(Object.assign({}, requestOptions), { enrichments: [] });
|
|
156
|
-
const { item, access } = await fetchContent(identifier, options);
|
|
157
|
-
// we must normalize the underlying item type to account
|
|
158
|
-
// for older items (e.g. sites that are type "Web Mapping
|
|
159
|
-
// Application") before we map the model to a Hub Entity
|
|
160
|
-
const type = normalizeItemType(item);
|
|
161
|
-
setProp("type", type, item);
|
|
162
|
-
const model = { item };
|
|
163
|
-
const entityEnrichments = {};
|
|
164
|
-
const enrichmentKeys = ["metadata"];
|
|
165
|
-
isMapOrFeatureServerUrl(item.url) && enrichmentKeys.push("server");
|
|
166
|
-
const itemAndServerEnrichments = await fetchItemEnrichments(item, enrichmentKeys, requestOptions);
|
|
167
|
-
entityEnrichments.metadata = itemAndServerEnrichments.metadata;
|
|
168
|
-
entityEnrichments.server = itemAndServerEnrichments.server;
|
|
169
|
-
// TODO: should we add scheduling to the fetchItemEnrichments() subsystem?
|
|
170
|
-
if (isDownloadSchedulingAvailable(requestOptions, access)) {
|
|
171
|
-
try {
|
|
172
|
-
// fetch schedule and add it to enrichments if it exists in schedule API
|
|
173
|
-
entityEnrichments.schedule = (await getSchedule(item.id, requestOptions)).schedule || { mode: "automatic" };
|
|
174
|
-
}
|
|
175
|
-
catch (error) {
|
|
176
|
-
/* tslint:disable no-console */
|
|
177
|
-
console.warn("Failed to fetch schedule for item", item.id, error);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return modelToHubEditableContent(model, requestOptions, entityEnrichments);
|
|
181
|
-
};
|
|
182
|
-
export function modelToHubEditableContent(model, requestOptions, enrichments) {
|
|
183
|
-
const mapper = new PropertyMapper(getPropertyMap());
|
|
184
|
-
const content = mapper.storeToEntity(model, {});
|
|
185
|
-
return computeProps(model, content, requestOptions, enrichments);
|
|
186
|
-
}
|
|
187
|
-
//# sourceMappingURL=fetch.js.map
|
|
140
|
+
//# sourceMappingURL=fetchContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchContent.js","sourceRoot":"","sources":["../../../src/content/fetchContent.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,aAAa,GAC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MAAM,kBAAkB,CACtB,gBAAgB,CAAC,UAAU,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,CAAC,EACjD,OAAO,CACR;QACH,CAAC,CAAC,MAAM,gBAAgB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAChD,0FAA0F;IAC1F,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAChC,oEAAoE;IACpE,8EAA8E;IAC9E,sEAAsE;IACtE,4EAA4E;IAC5E,iFAAiF;IACjF,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;IAC9C,OAAO,CAAC,WAAW;QACjB,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,cAAc,CAAC;YAChE,CAAC,CAAC,sEAAsE;gBACtE,MAAM,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC;YACjD,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC;IAC1B,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { fetchContent } from "./fetchContent";
|
|
2
|
+
import { fetchEditableContentEnrichments } from "./_internal/fetchEditableContentEnrichments";
|
|
3
|
+
import { normalizeItemType } from "./compose";
|
|
4
|
+
import { setProp } from "../objects/set-prop";
|
|
5
|
+
import { modelToHubEditableContent } from "./modelToHubEditableContent";
|
|
6
|
+
/**
|
|
7
|
+
* fetch a content entity by identifier
|
|
8
|
+
* @param identifier
|
|
9
|
+
* @param requestOptions
|
|
10
|
+
* @returns content entity
|
|
11
|
+
*/
|
|
12
|
+
export const fetchHubContent = async (identifier, requestOptions, enrichments) => {
|
|
13
|
+
// NOTE: b/c we have to support slugs, we use fetchContent() to get the item
|
|
14
|
+
// by telling it to not fetch any enrichments. We then can fetch enrichments
|
|
15
|
+
// as needed after we have the item
|
|
16
|
+
const options = Object.assign(Object.assign({}, requestOptions), { enrichments: [] });
|
|
17
|
+
const { item } = await fetchContent(identifier, options);
|
|
18
|
+
const editableContentEnrichments = await fetchEditableContentEnrichments(item, requestOptions, enrichments);
|
|
19
|
+
// we must normalize the underlying item type to account
|
|
20
|
+
// for older items (e.g. sites that are type "Web Mapping
|
|
21
|
+
// Application") before we map the model to a Hub Entity
|
|
22
|
+
const type = normalizeItemType(item);
|
|
23
|
+
setProp("type", type, item);
|
|
24
|
+
return modelToHubEditableContent({ item }, requestOptions, editableContentEnrichments);
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=fetchHubContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchHubContent.js","sourceRoot":"","sources":["../../../src/content/fetchHubContent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,6CAA6C,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,UAAkB,EAClB,cAA+B,EAC/B,WAAyC,EACX,EAAE;IAChC,4EAA4E;IAC5E,4EAA4E;IAC5E,mCAAmC;IACnC,MAAM,OAAO,GAAG,gCACX,cAAc,KACjB,WAAW,EAAE,EAAE,GACQ,CAAC;IAC1B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAEzD,MAAM,0BAA0B,GAAG,MAAM,+BAA+B,CACtE,IAAI,EACJ,cAAc,EACd,WAAW,CACZ,CAAC;IAEF,wDAAwD;IACxD,yDAAyD;IACzD,wDAAwD;IACxD,MAAM,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAE5B,OAAO,yBAAyB,CAC9B,EAAE,IAAI,EAAE,EACR,cAAc,EACd,0BAA0B,CAC3B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -3,7 +3,9 @@ export * from "./get-family";
|
|
|
3
3
|
export * from "./compose";
|
|
4
4
|
export * from "./contentUtils";
|
|
5
5
|
export * from "./edit";
|
|
6
|
-
export * from "./
|
|
6
|
+
export * from "./fetchContent";
|
|
7
|
+
export * from "./fetchHubContent";
|
|
8
|
+
export * from "./modelToHubEditableContent";
|
|
7
9
|
export * from "./get-family";
|
|
8
10
|
export * from "./HubContent";
|
|
9
11
|
export * from "./search";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/content/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PropertyMapper } from "../core/_internal/PropertyMapper";
|
|
2
|
+
import { getPropertyMap } from "./_internal/getPropertyMap";
|
|
3
|
+
import { computeProps } from "./_internal/computeProps";
|
|
4
|
+
/**
|
|
5
|
+
* Converts an Imodel to a Hub editable content object
|
|
6
|
+
*
|
|
7
|
+
* @param model IModel to convert
|
|
8
|
+
* @param requestOptions
|
|
9
|
+
* @param enrichments hash of enrichments to apply to the content
|
|
10
|
+
*/
|
|
11
|
+
export function modelToHubEditableContent(model, requestOptions, enrichments) {
|
|
12
|
+
const mapper = new PropertyMapper(getPropertyMap());
|
|
13
|
+
const content = mapper.storeToEntity(model, {});
|
|
14
|
+
return computeProps(model, content, requestOptions, enrichments);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=modelToHubEditableContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modelToHubEditableContent.js","sourceRoot":"","sources":["../../../src/content/modelToHubEditableContent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAa,EACb,cAA+B,EAC/B,WAAuC;IAEvC,MAAM,MAAM,GAAG,IAAI,cAAc,CAC/B,cAAc,EAAE,CACjB,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,CAAwB,CAAC;IACvE,OAAO,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/content/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/content/types.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,kCAAiB,CAAA;AACnB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAED,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,kCAAe,CAAA;IACf,sCAAmB,CAAA;IACnB,gCAAa,CAAA;AACf,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fetchDiscussion } from "../discussions/fetch";
|
|
2
|
-
import { fetchHubContent } from "../content/
|
|
2
|
+
import { fetchHubContent } from "../content/fetchHubContent";
|
|
3
3
|
import { fetchInitiative } from "../initiatives/HubInitiatives";
|
|
4
4
|
import { fetchPage } from "../pages/HubPages";
|
|
5
5
|
import { fetchProject } from "../projects/fetch";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchHubEntity.js","sourceRoot":"","sources":["../../../src/core/fetchHubEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"fetchHubEntity.js","sourceRoot":"","sources":["../../../src/core/fetchHubEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAInD,OAAO,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BAAiB,CAAC,CAAC;YACpE,MAAM;QACR,KAAK,QAAQ;YACX,MAAM,GAAG,MAAM,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAClE,MAAM;QACR,KAAK,OAAO;YACV,MAAM,GAAG,MAAM,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;YACjE,MAAM;QACR,KAAK,oBAAoB;YACvB,MAAM,GAAG,MAAM,uBAAuB,CACpC,UAAU,EACV,OAAO,CAAC,cAAc,CACvB,CAAC;YACF,MAAM;QACR,KAAK,MAAM;YACT,MAAM;gBACJ,UAAU,KAAK,MAAM;oBACnB,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,WAAW,CAAC;oBAC3C,CAAC,CAAC,MAAM,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;KACnE;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -13,20 +13,17 @@ export const EXPORT_ITEM_FORMATS = [
|
|
|
13
13
|
];
|
|
14
14
|
/**
|
|
15
15
|
* Formats supported by the /exportImage endpoint of Image Services.
|
|
16
|
+
* Listed in the default order of appearance in the UI.
|
|
16
17
|
*/
|
|
17
18
|
export const EXPORT_IMAGE_FORMATS = [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
ServiceDownloadFormat.
|
|
21
|
-
ServiceDownloadFormat.GIF,
|
|
19
|
+
// Temporary exclusion until we hammer out the details of how to support it.
|
|
20
|
+
// Unlike jpg or png, tiff downloads require exact geospatial parameters to be set.
|
|
21
|
+
// ServiceDownloadFormat.TIFF,
|
|
22
22
|
ServiceDownloadFormat.JPG,
|
|
23
|
-
ServiceDownloadFormat.JPG_PNG,
|
|
24
|
-
ServiceDownloadFormat.LERC,
|
|
25
23
|
ServiceDownloadFormat.PNG,
|
|
24
|
+
ServiceDownloadFormat.PNG8,
|
|
26
25
|
ServiceDownloadFormat.PNG24,
|
|
27
26
|
ServiceDownloadFormat.PNG32,
|
|
28
|
-
ServiceDownloadFormat.PNG8,
|
|
29
|
-
ServiceDownloadFormat.TIFF,
|
|
30
27
|
];
|
|
31
28
|
/**
|
|
32
29
|
* Formats supported by the paging operation endpoint of the Hub Download API.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../../src/downloads/_internal/_types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,qBAAqB,CAAC,GAAG;IACzB,qBAAqB,CAAC,GAAG;IACzB,qBAAqB,CAAC,SAAS;IAC/B,qBAAqB,CAAC,QAAQ;IAC9B,qBAAqB,CAAC,OAAO;IAC7B,qBAAqB,CAAC,KAAK;IAC3B,qBAAqB,CAAC,kBAAkB;CAChC,CAAC;AAIX
|
|
1
|
+
{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../../../src/downloads/_internal/_types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,qBAAqB,CAAC,GAAG;IACzB,qBAAqB,CAAC,GAAG;IACzB,qBAAqB,CAAC,SAAS;IAC/B,qBAAqB,CAAC,QAAQ;IAC9B,qBAAqB,CAAC,OAAO;IAC7B,qBAAqB,CAAC,KAAK;IAC3B,qBAAqB,CAAC,kBAAkB;CAChC,CAAC;AAIX;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,4EAA4E;IAC5E,mFAAmF;IACnF,8BAA8B;IAE9B,qBAAqB,CAAC,GAAG;IACzB,qBAAqB,CAAC,GAAG;IACzB,qBAAqB,CAAC,IAAI;IAC1B,qBAAqB,CAAC,KAAK;IAC3B,qBAAqB,CAAC,KAAK;CAWnB,CAAC;AAGX;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,qBAAqB,CAAC,GAAG;IACzB,qBAAqB,CAAC,SAAS;IAC/B,qBAAqB,CAAC,OAAO;IAC7B,qBAAqB,CAAC,GAAG;CACjB,CAAC;AAGX;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,qBAAqB,CAAC,GAAG;IACzB,qBAAqB,CAAC,SAAS;IAC/B,qBAAqB,CAAC,OAAO;IAC7B,qBAAqB,CAAC,QAAQ;IAC9B,qBAAqB,CAAC,kBAAkB;IACxC,qBAAqB,CAAC,KAAK;IAC3B,qBAAqB,CAAC,WAAW;IACjC,qBAAqB,CAAC,MAAM;IAC5B,qBAAqB,CAAC,IAAI;IAC1B,qBAAqB,CAAC,GAAG;CACjB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ItemType } from "../../types";
|
|
1
2
|
/**
|
|
2
3
|
* @private
|
|
3
4
|
* Determines if the export image flow can be used for the given entity.
|
|
@@ -5,6 +6,11 @@
|
|
|
5
6
|
* @returns whether the export image flow can be used
|
|
6
7
|
*/
|
|
7
8
|
export function canUseExportImageFlow(entity) {
|
|
8
|
-
|
|
9
|
+
const { type, typeKeywords = [] } = entity;
|
|
10
|
+
// Tiled Imagery services cannot be downloaded. This typeKeyword check
|
|
11
|
+
// is one way to distinguish between tiled and non-tiled imagery services.
|
|
12
|
+
// TODO: Consider checking item.url instead so reference items are also excluded.
|
|
13
|
+
return (type === ItemType["Image Service"] &&
|
|
14
|
+
!typeKeywords.includes("Tiled Imagery"));
|
|
9
15
|
}
|
|
10
16
|
//# sourceMappingURL=canUseExportImageFlow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canUseExportImageFlow.js","sourceRoot":"","sources":["../../../../src/downloads/_internal/canUseExportImageFlow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"canUseExportImageFlow.js","sourceRoot":"","sources":["../../../../src/downloads/_internal/canUseExportImageFlow.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA2B;IAC/D,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IAC3C,sEAAsE;IACtE,0EAA0E;IAC1E,iFAAiF;IACjF,OAAO,CACL,IAAI,KAAK,QAAQ,CAAC,eAAe,CAAC;QAClC,CAAC,YAAY,CAAC,QAAQ,CAAC,eAAe,CAAC,CACxC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { request } from "@esri/arcgis-rest-request";
|
|
2
|
+
import { DownloadOperationStatus, ServiceDownloadFormat, } from "../../types";
|
|
3
|
+
import HubError from "../../../HubError";
|
|
4
|
+
import { getProp } from "../../../objects/get-prop";
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
*
|
|
8
|
+
* Fetches a download file url from an Image Service via the exportImage endpoint.
|
|
9
|
+
*
|
|
10
|
+
* @param options options for refining / filtering the resulting download file
|
|
11
|
+
* @returns a blob containing the download file
|
|
12
|
+
*/
|
|
13
|
+
export async function fetchExportImageDownloadFile(options) {
|
|
14
|
+
validateOptions(options);
|
|
15
|
+
const { entity, format, context, progressCallback } = options;
|
|
16
|
+
progressCallback && progressCallback(DownloadOperationStatus.PENDING);
|
|
17
|
+
const extent = getExportImageExtent(options);
|
|
18
|
+
const { xmin, xmax, ymin, ymax } = extent;
|
|
19
|
+
// TODO: do we need to handle latestWkid as well?
|
|
20
|
+
const { wkid } = extent.spatialReference;
|
|
21
|
+
const requestOptions = Object.assign({}, context.requestOptions);
|
|
22
|
+
requestOptions.httpMethod = "GET";
|
|
23
|
+
requestOptions.params = {
|
|
24
|
+
bbox: `${xmin},${ymin},${xmax},${ymax}`,
|
|
25
|
+
bboxSR: `${wkid}`,
|
|
26
|
+
f: "image",
|
|
27
|
+
format,
|
|
28
|
+
mosaicRule: '{"ascending":true,"mosaicMethod":"esriMosaicNorthwest","mosaicOperation":"MT_FIRST"}',
|
|
29
|
+
};
|
|
30
|
+
// TODO: Figure out whether we want to leverage the server's maxImageWidth and maxImageHeight.
|
|
31
|
+
// While it results in higher quality images, it also creates a lot of variability in the result
|
|
32
|
+
// when we filter an image by extent.
|
|
33
|
+
//
|
|
34
|
+
// const { maxImageHeight, maxImageWidth } =
|
|
35
|
+
// getProp(entity, "extendedProps.server") || {};
|
|
36
|
+
// if (maxImageWidth && maxImageHeight) {
|
|
37
|
+
// requestOptions.params.size = `${maxImageWidth},${maxImageHeight}`;
|
|
38
|
+
// }
|
|
39
|
+
const blob = await request(`${entity.url}/exportImage`, requestOptions);
|
|
40
|
+
progressCallback && progressCallback(DownloadOperationStatus.COMPLETED);
|
|
41
|
+
return {
|
|
42
|
+
type: "blob",
|
|
43
|
+
blob,
|
|
44
|
+
filename: getBlobFilename(entity, format),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function validateOptions(options) {
|
|
48
|
+
const { geometry } = options;
|
|
49
|
+
if (geometry && geometry.type !== "extent") {
|
|
50
|
+
throw new HubError("fetchExportImageDownloadFileUrl", "Only extent geometric filters are supported for this type of download");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function getExportImageExtent(options) {
|
|
54
|
+
const { entity, geometry } = options;
|
|
55
|
+
const serverExtent = getProp(entity, "extendedProps.server.extent");
|
|
56
|
+
// TODO: Factor in entity.extent if it exists AND is a valid 4326 bbox
|
|
57
|
+
let result = null;
|
|
58
|
+
if (geometry) {
|
|
59
|
+
result = geometry;
|
|
60
|
+
}
|
|
61
|
+
else if (serverExtent) {
|
|
62
|
+
result = serverExtent;
|
|
63
|
+
}
|
|
64
|
+
if (!result) {
|
|
65
|
+
throw new HubError("fetchExportImageDownloadFileUrl", "Extent required for this download operation");
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
function getBlobFilename(entity, format) {
|
|
70
|
+
const name = entity.name || getProp(entity, "extendedProps.server.name");
|
|
71
|
+
const extension = format.includes(ServiceDownloadFormat.PNG)
|
|
72
|
+
? // NOTE: the png family of formats (png8, png24, etc.) share the same extension
|
|
73
|
+
ServiceDownloadFormat.PNG
|
|
74
|
+
: format;
|
|
75
|
+
return `${name}.${extension}`;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=fetchExportImageDownloadFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchExportImageDownloadFile.js","sourceRoot":"","sources":["../../../../../src/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EACL,uBAAuB,EAGvB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AACrB,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIpD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,OAAkC;IAElC,eAAe,CAAC,OAAO,CAAC,CAAC;IAEzB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAC9D,gBAAgB,IAAI,gBAAgB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAEtE,MAAM,MAAM,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAC1C,iDAAiD;IACjD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,gBAAgB,CAAC;IAEzC,MAAM,cAAc,qBAAQ,OAAO,CAAC,cAAc,CAAE,CAAC;IACrD,cAAc,CAAC,UAAU,GAAG,KAAK,C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ACX,MAAM,IAAI,QAAQ,CAChB,iCAAiC,EACjC,6CAA6C,CAC9C,CAAC;KACH;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,eAAe,CACtB,MAA2B,EAC3B,MAAyB;IAEzB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;IACzE,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAAC,GAAG,CAAC;QAC1D,CAAC,CAAC,+EAA+E;YAC/E,qBAAqB,CAAC,GAAG;QAC3B,CAAC,CAAC,MAAM,CAAC;IACX,OAAO,GAAG,IAAI,IAAI,SAAS,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -21,7 +21,7 @@ import { getProp } from "../../../objects/get-prop";
|
|
|
21
21
|
* @param options options for refining / filtering the resulting download file
|
|
22
22
|
* @returns a url to download the file
|
|
23
23
|
*/
|
|
24
|
-
export async function
|
|
24
|
+
export async function fetchExportItemDownloadFile(options) {
|
|
25
25
|
validateOptions(options);
|
|
26
26
|
const { entity, format, context, progressCallback, pollInterval } = options;
|
|
27
27
|
progressCallback && progressCallback(DownloadOperationStatus.PENDING);
|
|
@@ -35,7 +35,10 @@ export async function fetchExportItemDownloadFileUrl(options) {
|
|
|
35
35
|
// TODO: Once the job is completed, we still need to set the special typekeywords needed to find the item later.
|
|
36
36
|
// Also, I _think_ we can only do one layer at a time (at least with the current typeKeywords schema we're using)
|
|
37
37
|
progressCallback && progressCallback(DownloadOperationStatus.COMPLETED);
|
|
38
|
-
return
|
|
38
|
+
return {
|
|
39
|
+
type: "url",
|
|
40
|
+
href: getExportItemDataUrl(exportItemId, context),
|
|
41
|
+
};
|
|
39
42
|
}
|
|
40
43
|
function validateOptions(options) {
|
|
41
44
|
const { geometry, where } = options;
|
|
@@ -76,4 +79,4 @@ async function pollForJobCompletion(exportedItemId, jobId, context, pollInterval
|
|
|
76
79
|
return pollForJobCompletion(exportedItemId, jobId, context, pollInterval, progressCallback);
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
|
-
//# sourceMappingURL=
|
|
82
|
+
//# sourceMappingURL=fetchExportItemDownloadFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchExportItemDownloadFile.js","sourceRoot":"","sources":["../../../../../src/downloads/_internal/file-url-fetchers/fetchExportItemDownloadFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,aAAa,GACd,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,uBAAuB,EAIvB,mBAAmB,EACnB,qBAAqB,GAEtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,QAAQ,MAAM,mBAAmB,CAAC;AAGzC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAkC;IAElC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAC5E,gBAAgB,IAAI,gBAAgB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACtE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,MAAM,UAAU,CAAC;QAC/C,EAAE,EAAE,MAAM,CAAC,EAAE;QACb,YAAY,EAAE,oBAAoB,CAAC,MAA0B,CAAC;QAC9D,gBAAgB,EAAE,mBAAmB,CAAC,OAAO,CAAC;QAC9C,cAAc,EAAE,OAAO,CAAC,iBAAiB,CAAC,cAAc;KACzD,CAAC,CAAC;IAEH,MAAM,oBAAoB,CACxB,YAAY,EACZ,KAAK,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,CACjB,CAAC;IAEF,gHAAgH;IACh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Ac;QAClB,KAAK;QACL,OAAO,EAAE,QAAQ;QACjB,cAAc,EAAE,OAAO,CAAC,iBAAiB,CAAC,cAAc;KACzD,CAAC,CAAC;IAEH,IAAI,MAAM,KAAK,QAAQ,EAAE;QACvB,MAAM,IAAI,QAAQ,CAAC,gCAAgC,EAAE,mBAAmB,CAAC,CAAC;KAC3E;IAED,IAAI,MAAM,KAAK,WAAW,EAAE;QAC1B,gBAAgB,IAAI,gBAAgB,CAAC,uBAAuB,CAAC,UAAU,CAAC,CAAC;QACzE,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC;QAClE,OAAO,oBAAoB,CACzB,cAAc,EACd,KAAK,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,CACjB,CAAC;KACH;AACH,CAAC"}
|
|
@@ -15,7 +15,7 @@ import { ArcgisHubDownloadError, DownloadOperationStatus, ServiceDownloadFormat,
|
|
|
15
15
|
* @param options options for refining / filtering the resulting download file
|
|
16
16
|
* @returns a url to download the file
|
|
17
17
|
*/
|
|
18
|
-
export async function
|
|
18
|
+
export async function fetchHubApiDownloadFile(options) {
|
|
19
19
|
validateOptions(options);
|
|
20
20
|
const requestUrl = getDownloadApiRequestUrl(options);
|
|
21
21
|
const { pollInterval, progressCallback } = options;
|
|
@@ -86,7 +86,10 @@ async function pollDownloadApi(requestUrl, pollInterval, progressCallback) {
|
|
|
86
86
|
progressCallback && progressCallback(operationStatus, progressInPercent);
|
|
87
87
|
// Operation complete, return the download URL
|
|
88
88
|
if (resultUrl) {
|
|
89
|
-
return
|
|
89
|
+
return {
|
|
90
|
+
type: "url",
|
|
91
|
+
href: resultUrl,
|
|
92
|
+
};
|
|
90
93
|
}
|
|
91
94
|
// Operation still in progress, poll again
|
|
92
95
|
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
@@ -133,4 +136,4 @@ function toDownloadOperationStatus(status) {
|
|
|
133
136
|
return (createReplicaStatusMap[status] ||
|
|
134
137
|
pagingJobStatusMap[status]);
|
|
135
138
|
}
|
|
136
|
-
//# sourceMappingURL=
|
|
139
|
+
//# sourceMappingURL=fetchHubApiDownloadFile.js.map
|