@esri/hub-common 14.121.2 → 14.122.1
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/ArcGISContextManager.js +2 -0
- package/dist/esm/ArcGISContextManager.js.map +1 -1
- package/dist/esm/content/_internal/ContentBusinessRules.js +6 -0
- package/dist/esm/content/_internal/ContentBusinessRules.js.map +1 -1
- package/dist/esm/content/_internal/computeProps.js +8 -1
- package/dist/esm/content/_internal/computeProps.js.map +1 -1
- package/dist/esm/content/_internal/internalContentUtils.js.map +1 -1
- package/dist/esm/content/fetch.js +2 -2
- package/dist/esm/content/fetch.js.map +1 -1
- package/dist/esm/core/types/ISystemStatus.js +1 -0
- package/dist/esm/core/types/ISystemStatus.js.map +1 -1
- package/dist/esm/downloads/_internal/_types.js +55 -0
- package/dist/esm/downloads/_internal/_types.js.map +1 -0
- package/dist/esm/downloads/_internal/canCreateExportItem.js +15 -0
- package/dist/esm/downloads/_internal/canCreateExportItem.js.map +1 -0
- package/dist/esm/downloads/_internal/canUseExportImageFlow.js +10 -0
- package/dist/esm/downloads/_internal/canUseExportImageFlow.js.map +1 -0
- package/dist/esm/downloads/_internal/canUseExportItemFlow.js +11 -0
- package/dist/esm/downloads/_internal/canUseExportItemFlow.js.map +1 -0
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFileUrl.js +46 -0
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFileUrl.js.map +1 -0
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchExportItemDownloadFileUrl.js +79 -0
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchExportItemDownloadFileUrl.js.map +1 -0
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchHubApiDownloadFileUrl.js +136 -0
- package/dist/esm/downloads/_internal/file-url-fetchers/fetchHubApiDownloadFileUrl.js.map +1 -0
- package/dist/esm/downloads/_internal/format-fetchers/fetchAvailableExportItemFormats.js +56 -0
- package/dist/esm/downloads/_internal/format-fetchers/fetchAvailableExportItemFormats.js.map +1 -0
- package/dist/esm/downloads/_internal/format-fetchers/fetchExportItemFormats.js +28 -0
- package/dist/esm/downloads/_internal/format-fetchers/fetchExportItemFormats.js.map +1 -0
- package/dist/esm/downloads/_internal/format-fetchers/getAllExportItemFormats.js +12 -0
- package/dist/esm/downloads/_internal/format-fetchers/getAllExportItemFormats.js.map +1 -0
- package/dist/esm/downloads/_internal/format-fetchers/getCreateReplicaFormats.js +14 -0
- package/dist/esm/downloads/_internal/format-fetchers/getCreateReplicaFormats.js.map +1 -0
- package/dist/esm/downloads/_internal/format-fetchers/getExportImageFormats.js +11 -0
- package/dist/esm/downloads/_internal/format-fetchers/getExportImageFormats.js.map +1 -0
- package/dist/esm/downloads/_internal/format-fetchers/getHubDownloadApiFormats.js +18 -0
- package/dist/esm/downloads/_internal/format-fetchers/getHubDownloadApiFormats.js.map +1 -0
- package/dist/esm/downloads/_internal/format-fetchers/getPagingJobFormats.js +10 -0
- package/dist/esm/downloads/_internal/format-fetchers/getPagingJobFormats.js.map +1 -0
- package/dist/esm/downloads/_internal/getExportItemDataUrl.js +14 -0
- package/dist/esm/downloads/_internal/getExportItemDataUrl.js.map +1 -0
- package/dist/esm/downloads/build-existing-exports-portal-query.js +1 -37
- package/dist/esm/downloads/build-existing-exports-portal-query.js.map +1 -1
- package/dist/esm/downloads/canUseCreateReplica.js +13 -0
- package/dist/esm/downloads/canUseCreateReplica.js.map +1 -0
- package/dist/esm/downloads/canUseHubDownloadApi.js +15 -0
- package/dist/esm/downloads/canUseHubDownloadApi.js.map +1 -0
- package/dist/esm/downloads/fetchDownloadFileUrl.js +29 -0
- package/dist/esm/downloads/fetchDownloadFileUrl.js.map +1 -0
- package/dist/esm/downloads/fetchDownloadFormats.js +37 -0
- package/dist/esm/downloads/fetchDownloadFormats.js.map +1 -0
- package/dist/esm/downloads/index.js +5 -0
- package/dist/esm/downloads/index.js.map +1 -1
- package/dist/esm/downloads/types.js +97 -0
- package/dist/esm/downloads/types.js.map +1 -0
- package/dist/node/ArcGISContextManager.js +2 -0
- package/dist/node/ArcGISContextManager.js.map +1 -1
- package/dist/node/content/_internal/ContentBusinessRules.js +6 -0
- package/dist/node/content/_internal/ContentBusinessRules.js.map +1 -1
- package/dist/node/content/_internal/computeProps.js +7 -0
- package/dist/node/content/_internal/computeProps.js.map +1 -1
- package/dist/node/content/_internal/internalContentUtils.js.map +1 -1
- package/dist/node/content/fetch.js +2 -2
- package/dist/node/content/fetch.js.map +1 -1
- package/dist/node/core/types/ISystemStatus.js +1 -0
- package/dist/node/core/types/ISystemStatus.js.map +1 -1
- package/dist/node/downloads/_internal/_types.js +58 -0
- package/dist/node/downloads/_internal/_types.js.map +1 -0
- package/dist/node/downloads/_internal/canCreateExportItem.js +19 -0
- package/dist/node/downloads/_internal/canCreateExportItem.js.map +1 -0
- package/dist/node/downloads/_internal/canUseExportImageFlow.js +14 -0
- package/dist/node/downloads/_internal/canUseExportImageFlow.js.map +1 -0
- package/dist/node/downloads/_internal/canUseExportItemFlow.js +15 -0
- package/dist/node/downloads/_internal/canUseExportItemFlow.js.map +1 -0
- package/dist/node/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFileUrl.js +50 -0
- package/dist/node/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFileUrl.js.map +1 -0
- package/dist/node/downloads/_internal/file-url-fetchers/fetchExportItemDownloadFileUrl.js +83 -0
- package/dist/node/downloads/_internal/file-url-fetchers/fetchExportItemDownloadFileUrl.js.map +1 -0
- package/dist/node/downloads/_internal/file-url-fetchers/fetchHubApiDownloadFileUrl.js +140 -0
- package/dist/node/downloads/_internal/file-url-fetchers/fetchHubApiDownloadFileUrl.js.map +1 -0
- package/dist/node/downloads/_internal/format-fetchers/fetchAvailableExportItemFormats.js +60 -0
- package/dist/node/downloads/_internal/format-fetchers/fetchAvailableExportItemFormats.js.map +1 -0
- package/dist/node/downloads/_internal/format-fetchers/fetchExportItemFormats.js +32 -0
- package/dist/node/downloads/_internal/format-fetchers/fetchExportItemFormats.js.map +1 -0
- package/dist/node/downloads/_internal/format-fetchers/getAllExportItemFormats.js +16 -0
- package/dist/node/downloads/_internal/format-fetchers/getAllExportItemFormats.js.map +1 -0
- package/dist/node/downloads/_internal/format-fetchers/getCreateReplicaFormats.js +18 -0
- package/dist/node/downloads/_internal/format-fetchers/getCreateReplicaFormats.js.map +1 -0
- package/dist/node/downloads/_internal/format-fetchers/getExportImageFormats.js +15 -0
- package/dist/node/downloads/_internal/format-fetchers/getExportImageFormats.js.map +1 -0
- package/dist/node/downloads/_internal/format-fetchers/getHubDownloadApiFormats.js +22 -0
- package/dist/node/downloads/_internal/format-fetchers/getHubDownloadApiFormats.js.map +1 -0
- package/dist/node/downloads/_internal/format-fetchers/getPagingJobFormats.js +14 -0
- package/dist/node/downloads/_internal/format-fetchers/getPagingJobFormats.js.map +1 -0
- package/dist/node/downloads/_internal/getExportItemDataUrl.js +18 -0
- package/dist/node/downloads/_internal/getExportItemDataUrl.js.map +1 -0
- package/dist/node/downloads/build-existing-exports-portal-query.js +3 -39
- package/dist/node/downloads/build-existing-exports-portal-query.js.map +1 -1
- package/dist/node/downloads/canUseCreateReplica.js +17 -0
- package/dist/node/downloads/canUseCreateReplica.js.map +1 -0
- package/dist/node/downloads/canUseHubDownloadApi.js +19 -0
- package/dist/node/downloads/canUseHubDownloadApi.js.map +1 -0
- package/dist/node/downloads/fetchDownloadFileUrl.js +33 -0
- package/dist/node/downloads/fetchDownloadFileUrl.js.map +1 -0
- package/dist/node/downloads/fetchDownloadFormats.js +41 -0
- package/dist/node/downloads/fetchDownloadFormats.js.map +1 -0
- package/dist/node/downloads/index.js +5 -0
- package/dist/node/downloads/index.js.map +1 -1
- package/dist/node/downloads/types.js +101 -0
- package/dist/node/downloads/types.js.map +1 -0
- package/dist/types/content/_internal/ContentBusinessRules.d.ts +1 -1
- package/dist/types/content/_internal/internalContentUtils.d.ts +7 -0
- package/dist/types/core/types/IHubEditableContent.d.ts +10 -0
- package/dist/types/core/types/ISystemStatus.d.ts +1 -1
- package/dist/types/downloads/_internal/_types.d.ts +22 -0
- package/dist/types/downloads/_internal/canCreateExportItem.d.ts +13 -0
- package/dist/types/downloads/_internal/canUseExportImageFlow.d.ts +8 -0
- package/dist/types/downloads/_internal/canUseExportItemFlow.d.ts +8 -0
- package/dist/types/downloads/_internal/file-url-fetchers/fetchExportImageDownloadFileUrl.d.ts +12 -0
- package/dist/types/downloads/_internal/file-url-fetchers/fetchExportItemDownloadFileUrl.d.ts +20 -0
- package/dist/types/downloads/_internal/file-url-fetchers/fetchHubApiDownloadFileUrl.d.ts +16 -0
- package/dist/types/downloads/_internal/format-fetchers/fetchAvailableExportItemFormats.d.ts +26 -0
- package/dist/types/downloads/_internal/format-fetchers/fetchExportItemFormats.d.ts +25 -0
- package/dist/types/downloads/_internal/format-fetchers/getAllExportItemFormats.d.ts +6 -0
- package/dist/types/downloads/_internal/format-fetchers/getCreateReplicaFormats.d.ts +10 -0
- package/dist/types/downloads/_internal/format-fetchers/getExportImageFormats.d.ts +8 -0
- package/dist/types/downloads/_internal/format-fetchers/getHubDownloadApiFormats.d.ts +12 -0
- package/dist/types/downloads/_internal/format-fetchers/getPagingJobFormats.d.ts +7 -0
- package/dist/types/downloads/_internal/getExportItemDataUrl.d.ts +9 -0
- package/dist/types/downloads/build-existing-exports-portal-query.d.ts +0 -37
- package/dist/types/downloads/canUseCreateReplica.d.ts +7 -0
- package/dist/types/downloads/canUseHubDownloadApi.d.ts +9 -0
- package/dist/types/downloads/fetchDownloadFileUrl.d.ts +8 -0
- package/dist/types/downloads/fetchDownloadFormats.d.ts +7 -0
- package/dist/types/downloads/index.d.ts +5 -0
- package/dist/types/downloads/types.d.ts +152 -0
- package/package.json +1 -1
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchExportItemDownloadFileUrl = void 0;
|
|
4
|
+
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
5
|
+
const types_1 = require("../../types");
|
|
6
|
+
const getExportItemDataUrl_1 = require("../getExportItemDataUrl");
|
|
7
|
+
const HubError_1 = require("../../../HubError");
|
|
8
|
+
const get_prop_1 = require("../../../objects/get-prop");
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
* Fetches a download file url the Portal API via the item /export endpoint.
|
|
12
|
+
*
|
|
13
|
+
* NOTE: This function is incomplete and various permissions / branching paths need to be
|
|
14
|
+
* validated and implemented. It is a work in progress.
|
|
15
|
+
*
|
|
16
|
+
* NOTE: This is a last resort approach for current Enterprise environments, but it will be replaced
|
|
17
|
+
* by calling the service's /createReplica endpoint directly in the future (i.e., once the Enterprise
|
|
18
|
+
* team achieves feature parity with the Online team's implementation).
|
|
19
|
+
*
|
|
20
|
+
* This is because The item /export endpoint can only be used on Hosted Feature Services
|
|
21
|
+
* with the "Extract" capability enabled, which means the service will also have the /createReplica
|
|
22
|
+
* endpoint available. As /createReplica is a more flexible operation, /export becomes obsolete.
|
|
23
|
+
*
|
|
24
|
+
* @param options options for refining / filtering the resulting download file
|
|
25
|
+
* @returns a url to download the file
|
|
26
|
+
*/
|
|
27
|
+
async function fetchExportItemDownloadFileUrl(options) {
|
|
28
|
+
validateOptions(options);
|
|
29
|
+
const { entity, format, context, progressCallback, pollInterval } = options;
|
|
30
|
+
progressCallback && progressCallback(types_1.DownloadOperationStatus.PENDING);
|
|
31
|
+
const { exportItemId, jobId } = await arcgis_rest_portal_1.exportItem({
|
|
32
|
+
id: entity.id,
|
|
33
|
+
exportFormat: getExportFormatParam(format),
|
|
34
|
+
exportParameters: getExportParameters(options),
|
|
35
|
+
authentication: context.hubRequestOptions.authentication,
|
|
36
|
+
});
|
|
37
|
+
await pollForJobCompletion(exportItemId, jobId, context, pollInterval, progressCallback);
|
|
38
|
+
// TODO: Once the job is completed, we still need to set the special typekeywords needed to find the item later.
|
|
39
|
+
// Also, I _think_ we can only do one layer at a time (at least with the current typeKeywords schema we're using)
|
|
40
|
+
progressCallback && progressCallback(types_1.DownloadOperationStatus.COMPLETED);
|
|
41
|
+
return getExportItemDataUrl_1.getExportItemDataUrl(exportItemId, context);
|
|
42
|
+
}
|
|
43
|
+
exports.fetchExportItemDownloadFileUrl = fetchExportItemDownloadFileUrl;
|
|
44
|
+
function validateOptions(options) {
|
|
45
|
+
const { geometry, where } = options;
|
|
46
|
+
if (geometry) {
|
|
47
|
+
throw new HubError_1.default("fetchExportItemDownloadFileUrl", "Geometric filters are not supported for this type of download");
|
|
48
|
+
}
|
|
49
|
+
if (where) {
|
|
50
|
+
throw new HubError_1.default("fetchExportItemDownloadFileUrl", "Attribute filters are not supported for this type of download");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function getExportFormatParam(format) {
|
|
54
|
+
const legacyFormat = getLegacyExportItemFormat(format);
|
|
55
|
+
return get_prop_1.getProp(types_1.PORTAL_EXPORT_TYPES, `${legacyFormat}.name`);
|
|
56
|
+
}
|
|
57
|
+
function getLegacyExportItemFormat(format) {
|
|
58
|
+
return format === types_1.ServiceDownloadFormat.FILE_GDB ? "fileGeodatabase" : format;
|
|
59
|
+
}
|
|
60
|
+
function getExportParameters(options) {
|
|
61
|
+
const { layers } = options;
|
|
62
|
+
const result = {
|
|
63
|
+
layers: layers.map((id) => ({ id })),
|
|
64
|
+
};
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
async function pollForJobCompletion(exportedItemId, jobId, context, pollInterval, progressCallback) {
|
|
68
|
+
const { status } = await arcgis_rest_portal_1.getItemStatus({
|
|
69
|
+
id: exportedItemId,
|
|
70
|
+
jobId,
|
|
71
|
+
jobType: "export",
|
|
72
|
+
authentication: context.hubRequestOptions.authentication,
|
|
73
|
+
});
|
|
74
|
+
if (status === "failed") {
|
|
75
|
+
throw new HubError_1.default("fetchExportItemDownloadFileUrl", "Export job failed");
|
|
76
|
+
}
|
|
77
|
+
if (status !== "completed") {
|
|
78
|
+
progressCallback && progressCallback(types_1.DownloadOperationStatus.PROCESSING);
|
|
79
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
80
|
+
return pollForJobCompletion(exportedItemId, jobId, context, pollInterval, progressCallback);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=fetchExportItemDownloadFileUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchExportItemDownloadFileUrl.js","sourceRoot":"","sources":["../../../../../src/downloads/_internal/file-url-fetchers/fetchExportItemDownloadFileUrl.ts"],"names":[],"mappings":";;;AAAA,iEAKkC;AAClC,uCAOqB;AACrB,kEAA+D;AAC/D,gDAAyC;AAGzC,wDAAoD;AAEpD;;;;;;;;;;;;;;;;;GAiBG;AACI,KAAK,UAAU,8BAA8B,CAClD,OAAqC;IAErC,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,+BAAuB,CAAC,OAAO,CAAC,CAAC;IACtE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,MAAM,+BAAU,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;IAChH,iHAAiH;IACjH,gBAAgB,IAAI,gBAAgB,CAAC,+BAAuB,CAAC,SAAS,CAAC,CAAC;IACxE,OAAO,2CAAoB,CAAC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AAK,QAAQ,EAAE;QACvB,MAAM,IAAI,kBAAQ,CAAC,gCAAgC,EAAE,mBAAmB,CAAC,CAAC;KAC3E;IAED,IAAI,MAAM,KAAK,WAAW,EAAE;QAC1B,gBAAgB,IAAI,gBAAgB,CAAC,+BAAuB,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"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchHubApiDownloadFileUrl = void 0;
|
|
4
|
+
const HubError_1 = require("../../../HubError");
|
|
5
|
+
const get_prop_1 = require("../../../objects/get-prop");
|
|
6
|
+
const types_1 = require("../../types");
|
|
7
|
+
/**
|
|
8
|
+
* @private
|
|
9
|
+
* Fetches a download file url from the Hub Download API
|
|
10
|
+
*
|
|
11
|
+
* NOTE: The Hub Download API only works with a certain subset of Feature and Map services
|
|
12
|
+
* and performs different operations (i.e., calling createReplica or paging the service's
|
|
13
|
+
* features) depending on the service type and capabilities.
|
|
14
|
+
*
|
|
15
|
+
* This function does it's best to abstract those differences and provide a consistent
|
|
16
|
+
* interface for downloading data from any service supported by the Hub Download API.
|
|
17
|
+
*
|
|
18
|
+
* @param options options for refining / filtering the resulting download file
|
|
19
|
+
* @returns a url to download the file
|
|
20
|
+
*/
|
|
21
|
+
async function fetchHubApiDownloadFileUrl(options) {
|
|
22
|
+
validateOptions(options);
|
|
23
|
+
const requestUrl = getDownloadApiRequestUrl(options);
|
|
24
|
+
const { pollInterval, progressCallback } = options;
|
|
25
|
+
return pollDownloadApi(requestUrl, pollInterval, progressCallback);
|
|
26
|
+
}
|
|
27
|
+
exports.fetchHubApiDownloadFileUrl = fetchHubApiDownloadFileUrl;
|
|
28
|
+
function validateOptions(options) {
|
|
29
|
+
const { layers = [] } = options;
|
|
30
|
+
// The Hub Download API currently requires a target layer to be specified
|
|
31
|
+
if (layers.length === 0) {
|
|
32
|
+
throw new HubError_1.default("fetchHubApiDownloadFileUrl", "No layers provided for download");
|
|
33
|
+
}
|
|
34
|
+
// The Hub Download API currently only supports downloading one
|
|
35
|
+
// layer at a time, though it could allow multiple in the future
|
|
36
|
+
if (layers.length > 1) {
|
|
37
|
+
throw new HubError_1.default("fetchHubApiDownloadFileUrl", "Multiple layer downloads are not yet supported");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @private
|
|
42
|
+
* Generates a URL to the Hub Download API that can be polled until the download is ready
|
|
43
|
+
*
|
|
44
|
+
* @param options options for refining / filtering the resulting download file
|
|
45
|
+
* @returns a download api url that can be polled
|
|
46
|
+
*/
|
|
47
|
+
function getDownloadApiRequestUrl(options) {
|
|
48
|
+
const { entity, format, context, layers, geometry, where } = options;
|
|
49
|
+
const searchParams = new URLSearchParams({
|
|
50
|
+
redirect: "false",
|
|
51
|
+
layers: layers[0].toString(),
|
|
52
|
+
});
|
|
53
|
+
if (geometry) {
|
|
54
|
+
const geometryJSON = geometry.toJSON();
|
|
55
|
+
// Not sure why type isn't included in the toJSON() output, but our API expects it
|
|
56
|
+
geometryJSON.type = geometry.type;
|
|
57
|
+
searchParams.append("geometry", JSON.stringify(geometryJSON));
|
|
58
|
+
}
|
|
59
|
+
// GeoJSON and KML are only supported in WGS84, so we need to specify the spatial reference here
|
|
60
|
+
if ([types_1.ServiceDownloadFormat.GEOJSON, types_1.ServiceDownloadFormat.KML].includes(format)) {
|
|
61
|
+
searchParams.append("spatialRefId", "4326");
|
|
62
|
+
}
|
|
63
|
+
where && searchParams.append("where", where);
|
|
64
|
+
const token = get_prop_1.getProp(context, "hubRequestOptions.authentication.token");
|
|
65
|
+
token && searchParams.append("token", token);
|
|
66
|
+
return `${context.hubUrl}/api/download/v1/items/${entity.id}/${format}?${searchParams.toString()}`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @private
|
|
70
|
+
* Polls the Hub Download API until the download is ready, then returns the download file URL
|
|
71
|
+
*
|
|
72
|
+
* @param requestUrl Hub Download Api URL to poll
|
|
73
|
+
* @param progressCallback an optional callback to report download generation progress
|
|
74
|
+
* @returns the final file URL
|
|
75
|
+
*/
|
|
76
|
+
async function pollDownloadApi(requestUrl, pollInterval, progressCallback) {
|
|
77
|
+
const response = await fetch(requestUrl);
|
|
78
|
+
if (!response.ok) {
|
|
79
|
+
const errorBody = await response.json();
|
|
80
|
+
// TODO: Add standarized messageId when available
|
|
81
|
+
throw new types_1.ArcgisHubDownloadError({
|
|
82
|
+
rawMessage: errorBody.message,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const { status, progressInPercent, resultUrl } = await response.json();
|
|
86
|
+
const operationStatus = toDownloadOperationStatus(status);
|
|
87
|
+
if (operationStatus === types_1.DownloadOperationStatus.FAILED) {
|
|
88
|
+
throw new HubError_1.default("fetchHubApiDownloadFileUrl", "Download operation failed with a 200");
|
|
89
|
+
}
|
|
90
|
+
progressCallback && progressCallback(operationStatus, progressInPercent);
|
|
91
|
+
// Operation complete, return the download URL
|
|
92
|
+
if (resultUrl) {
|
|
93
|
+
return resultUrl;
|
|
94
|
+
}
|
|
95
|
+
// Operation still in progress, poll again
|
|
96
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
97
|
+
return pollDownloadApi(requestUrl, pollInterval, progressCallback);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @private
|
|
101
|
+
* Returns a standardized status string based on what is returned by the Hub Download API.
|
|
102
|
+
* This is necessary because the Hub Download API returns a variety of statuses that are too
|
|
103
|
+
* technical in nature that need to be translated into a more user-friendly status.
|
|
104
|
+
*
|
|
105
|
+
* @param status status returned by the Hub Download API
|
|
106
|
+
* @returns a standardized download operation status
|
|
107
|
+
*/
|
|
108
|
+
function toDownloadOperationStatus(status) {
|
|
109
|
+
// Statuses that come back if the Download API uses createReplica under the hood
|
|
110
|
+
const createReplicaStatusMap = {
|
|
111
|
+
// Statuses that we expect to see (listed in the order they could occur)
|
|
112
|
+
Pending: types_1.DownloadOperationStatus.PENDING,
|
|
113
|
+
InProgress: types_1.DownloadOperationStatus.PROCESSING,
|
|
114
|
+
ExportingData: types_1.DownloadOperationStatus.PROCESSING,
|
|
115
|
+
ExportAttachments: types_1.DownloadOperationStatus.PROCESSING,
|
|
116
|
+
Completed: types_1.DownloadOperationStatus.COMPLETED,
|
|
117
|
+
CompletedWithErrors: types_1.DownloadOperationStatus.FAILED,
|
|
118
|
+
Failed: types_1.DownloadOperationStatus.FAILED,
|
|
119
|
+
// These statuses are not expected to be returned by the API, but are included in the documentation
|
|
120
|
+
ProvisioningReplica: types_1.DownloadOperationStatus.PROCESSING,
|
|
121
|
+
ImportChanges: types_1.DownloadOperationStatus.PROCESSING,
|
|
122
|
+
ExportChanges: types_1.DownloadOperationStatus.PROCESSING,
|
|
123
|
+
ExportingSnapshot: types_1.DownloadOperationStatus.PROCESSING,
|
|
124
|
+
ImportAttachments: types_1.DownloadOperationStatus.PROCESSING,
|
|
125
|
+
UnRegisteringReplica: types_1.DownloadOperationStatus.PROCESSING,
|
|
126
|
+
};
|
|
127
|
+
// Statuses that come back if the Download API pages the service's features
|
|
128
|
+
// under the hood They are listed in the order they are expected to occur
|
|
129
|
+
const pagingJobStatusMap = {
|
|
130
|
+
Pending: types_1.DownloadOperationStatus.PENDING,
|
|
131
|
+
InProgress: types_1.DownloadOperationStatus.PROCESSING,
|
|
132
|
+
PagingData: types_1.DownloadOperationStatus.PROCESSING,
|
|
133
|
+
ConvertingData: types_1.DownloadOperationStatus.CONVERTING,
|
|
134
|
+
Failed: types_1.DownloadOperationStatus.FAILED,
|
|
135
|
+
Completed: types_1.DownloadOperationStatus.COMPLETED,
|
|
136
|
+
};
|
|
137
|
+
return (createReplicaStatusMap[status] ||
|
|
138
|
+
pagingJobStatusMap[status]);
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=fetchHubApiDownloadFileUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchHubApiDownloadFileUrl.js","sourceRoot":"","sources":["../../../../../src/downloads/_internal/file-url-fetchers/fetchHubApiDownloadFileUrl.ts"],"names":[],"mappings":";;;AAAA,gDAAyC;AACzC,wDAAoD;AACpD,uCAMqB;AAErB;;;;;;;;;;;;;GAaG;AACI,KAAK,UAAU,0BAA0B,CAC9C,OAAqC;IAErC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzB,MAAM,UAAU,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;IACrD,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IACnD,OAAO,eAAe,CAAC,UAAU,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;AACrE,CAAC;AAPD,gEAOC;AAED,SAAS,eAAe,CAAC,OAAqC;IAC5D,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAEhC,yEAAyE;IACzE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,MAAM,IAAI,kBAAQ,CAChB,4BAA4B,EAC5B,iCAAiC,CAClC,CAAC;KACH;IAED,+DAA+D;IAC/D,gEAAgE;IAChE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACrB,MAAM,IAAI,kBAAQ,CAChB,4BAA4B,EAC5B,gDAAgD,CACjD,CAAC;KACH;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,wBAAwB,CAAC,OAAqC;IACrE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC;IAErE,MAAM,YAAY,GA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AE,+BAAuB,CAAC,UAAU;QACrD,oBAAoB,EAAE,+BAAuB,CAAC,UAAU;KACzD,CAAC;IAEF,2EAA2E;IAC3E,yEAAyE;IACzE,MAAM,kBAAkB,GAAqD;QAC3E,OAAO,EAAE,+BAAuB,CAAC,OAAO;QACxC,UAAU,EAAE,+BAAuB,CAAC,UAAU;QAC9C,UAAU,EAAE,+BAAuB,CAAC,UAAU;QAC9C,cAAc,EAAE,+BAAuB,CAAC,UAAU;QAClD,MAAM,EAAE,+BAAuB,CAAC,MAAM;QACtC,SAAS,EAAE,+BAAuB,CAAC,SAAS;KAC7C,CAAC;IAEF,OAAO,CACL,sBAAsB,CAAC,MAA6B,CAAC;QACrD,kBAAkB,CAAC,MAAyB,CAAC,CAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchAvailableExportItemFormats = void 0;
|
|
4
|
+
const build_existing_exports_portal_query_1 = require("../../build-existing-exports-portal-query");
|
|
5
|
+
const types_1 = require("../../types");
|
|
6
|
+
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
7
|
+
const getExportItemDataUrl_1 = require("../getExportItemDataUrl");
|
|
8
|
+
const HubError_1 = require("../../../HubError");
|
|
9
|
+
const fetch_all_pages_1 = require("../../../items/fetch-all-pages");
|
|
10
|
+
/**
|
|
11
|
+
* @private
|
|
12
|
+
* Fetches an entity's available download formats that were previously created by the Portal API's item /export
|
|
13
|
+
* endpoint. This is useful for anonymous enterprise users who need to download data from a Hosted Feature Service,
|
|
14
|
+
* but do not have the privileges to create their own item export. As the exports have been previously created, they
|
|
15
|
+
* can be downloaded statically by anyone with the URL.
|
|
16
|
+
*
|
|
17
|
+
* NOTE: This function is a work-in-progress. Various permissions and logic branches are not yet implemented.
|
|
18
|
+
*
|
|
19
|
+
* NOTE: This is a last resort approach for current Enterprise environments, but it will be replaced
|
|
20
|
+
* with using the formats defined the service's /createReplica endpoint directly in the future (i.e.,
|
|
21
|
+
* once the Enterprise team achieves feature parity with the Online team's implementation).
|
|
22
|
+
*
|
|
23
|
+
* This is because The item /export endpoint can only be used on Hosted Feature Services with the "Extract" capability
|
|
24
|
+
* enabled, which means the service will also have the /createReplica endpoint available. As /createReplica is a more
|
|
25
|
+
* flexible operation that can be invoked by anonymous users, /export becomes obsolete.
|
|
26
|
+
*
|
|
27
|
+
* @param entity Hosted Feature Service entity to fetch download formats for
|
|
28
|
+
* @param context ArcGIS application context
|
|
29
|
+
* @param layers target layers that the download will be filtered to
|
|
30
|
+
* @returns available download formats for the entity
|
|
31
|
+
*/
|
|
32
|
+
async function fetchAvailableExportItemFormats(entity, context, layers) {
|
|
33
|
+
if (layers.length > 1) {
|
|
34
|
+
throw new HubError_1.default("fetchAvailableExportItemFormats", "Multi-layer downloads are not supported for this item");
|
|
35
|
+
}
|
|
36
|
+
// NOTE: we _need_ to pass the spatialRefId otherwise we're going to default to 4326
|
|
37
|
+
// Dang it, we'll need to pass the layerId as well... should we support multiple layers?
|
|
38
|
+
const q = build_existing_exports_portal_query_1.buildExistingExportsPortalQuery(entity.id, { layerId: layers[0] });
|
|
39
|
+
const exportItems = (await fetch_all_pages_1.fetchAllPages(arcgis_rest_portal_1.searchItems, Object.assign({ q }, context.requestOptions)));
|
|
40
|
+
// TODO: Do we need to worry about duplicates here?
|
|
41
|
+
return exportItems.map((item) => ({
|
|
42
|
+
type: "static",
|
|
43
|
+
label: null,
|
|
44
|
+
format: getExportItemFormat(item.type),
|
|
45
|
+
url: getExportItemDataUrl_1.getExportItemDataUrl(item.id, context),
|
|
46
|
+
})); // TODO: change export formats to use the ServiceDownloadFormat type
|
|
47
|
+
}
|
|
48
|
+
exports.fetchAvailableExportItemFormats = fetchAvailableExportItemFormats;
|
|
49
|
+
function getExportItemFormat(itemType) {
|
|
50
|
+
const legacyExportItemFormat = Object.keys(types_1.PORTAL_EXPORT_TYPES).find((format) => {
|
|
51
|
+
return types_1.PORTAL_EXPORT_TYPES[format].itemTypes.includes(itemType);
|
|
52
|
+
});
|
|
53
|
+
return migrateExportItemFormat(legacyExportItemFormat);
|
|
54
|
+
}
|
|
55
|
+
function migrateExportItemFormat(format) {
|
|
56
|
+
return format === "fileGeodatabase"
|
|
57
|
+
? types_1.ServiceDownloadFormat.FILE_GDB
|
|
58
|
+
: format;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=fetchAvailableExportItemFormats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchAvailableExportItemFormats.js","sourceRoot":"","sources":["../../../../../src/downloads/_internal/format-fetchers/fetchAvailableExportItemFormats.ts"],"names":[],"mappings":";;;AAAA,mGAA4F;AAC5F,uCAKqB;AACrB,iEAA8D;AAC9D,kEAA+D;AAG/D,gDAAyC;AACzC,oEAA+D;AAG/D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,KAAK,UAAU,+BAA+B,CACnD,MAA2B,EAC3B,OAAuB,EACvB,MAAgB;IAEhB,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACrB,MAAM,IAAI,kBAAQ,CAChB,iCAAiC,EACjC,uDAAuD,CACxD,CAAC;KACH;IACD,oFAAoF;IACpF,wFAAwF;IACxF,MAAM,CAAC,GAAG,qEAA+B,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7E,MAAM,WAAW,GAAG,CAAC,MAAM,+BAAa,CAAC,gCAAW,kBAClD,CAAC,IACE,OAAO,CAAC,cAAc,EACzB,CAAY,CAAC;IAEf,mDAAmD;IAEnD,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAChC,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;QACX,MAAM,EAAE,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC;QACtC,GAAG,EAAE,2CAAoB,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC;KAC5C,CAAC,CAAU,CAAC,CAAC,oEAAoE;AACpF,CAAC;AA3BD,0EA2BC;AAED,SAAS,mBAAmB,CAAC,QAAgB;IAC3C,MAAM,sBAAsB,GAC1B,MAAM,CAAC,IAAI,CAAC,2BAAmB,CAChC,CAAC,IAAI,CAAC,CAAC,MAA8B,EAAE,EAAE;QACxC,OAAO,2BAAmB,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC,CAA2B,CAAC;IAC7B,OAAO,uBAAuB,CAAC,sBAAsB,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,uBAAuB,CAC9B,MAA8B;IAE9B,OAAO,MAAM,KAAK,iBAAiB;QACjC,CAAC,CAAC,6BAAqB,CAAC,QAAQ;QAChC,CAAC,CAAE,MAA2B,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchExportItemFormats = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
* Fetches an entity's available download formats. Owners of the entity can create all formats supported by
|
|
7
|
+
* the Portal API's item /export endpoint, while users that don't have privileges to the item /export endpoint
|
|
8
|
+
* can only download formats that were previously exported by the entity's owner.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This function is a work-in-progress. Various permissions and logic branches are not yet implemented.
|
|
11
|
+
*
|
|
12
|
+
* NOTE: This is a last resort approach for current Enterprise environments, but it will be replaced
|
|
13
|
+
* with using the formats defined the service's /createReplica endpoint directly in the future (i.e.,
|
|
14
|
+
* once the Enterprise team achieves feature parity with the Online team's implementation).
|
|
15
|
+
*
|
|
16
|
+
* This is because The item /export endpoint can only be used on Hosted Feature Services with the "Extract" capability
|
|
17
|
+
* enabled, which means the service will also have the /createReplica endpoint available. As /createReplica is a more
|
|
18
|
+
* flexible operation that can be invoked by anonymous users, /export becomes obsolete.
|
|
19
|
+
*
|
|
20
|
+
* @param entity Hosted Feature Service entity to fetch download formats for
|
|
21
|
+
* @param context ArcGIS application context
|
|
22
|
+
* @param layers target layers that the download will be filtered to
|
|
23
|
+
* @returns available download formats for the entity
|
|
24
|
+
*/
|
|
25
|
+
async function fetchExportItemFormats(_entity, _context, _layers) {
|
|
26
|
+
throw new Error("Not implemented");
|
|
27
|
+
// return canCreateExport(entity, context)
|
|
28
|
+
// ? getAllExportItemFormats()
|
|
29
|
+
// : fetchAvailableExportItemFormats(entity, context, layers);
|
|
30
|
+
}
|
|
31
|
+
exports.fetchExportItemFormats = fetchExportItemFormats;
|
|
32
|
+
//# sourceMappingURL=fetchExportItemFormats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchExportItemFormats.js","sourceRoot":"","sources":["../../../../../src/downloads/_internal/format-fetchers/fetchExportItemFormats.ts"],"names":[],"mappings":";;;AAIA;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,KAAK,UAAU,sBAAsB,CAC1C,OAA4B,EAC5B,QAAwB,EACxB,OAAkB;IAElB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnC,0CAA0C;IAC1C,gCAAgC;IAChC,gEAAgE;AAClE,CAAC;AATD,wDASC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllExportItemFormats = void 0;
|
|
4
|
+
const _types_1 = require("../_types");
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
* Returns all the download formats that are available via the Portal API's item /export endpoint.
|
|
8
|
+
*/
|
|
9
|
+
function getAllExportItemFormats() {
|
|
10
|
+
return _types_1.EXPORT_ITEM_FORMATS.map((format) => ({
|
|
11
|
+
type: "dynamic",
|
|
12
|
+
format,
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
exports.getAllExportItemFormats = getAllExportItemFormats;
|
|
16
|
+
//# sourceMappingURL=getAllExportItemFormats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getAllExportItemFormats.js","sourceRoot":"","sources":["../../../../../src/downloads/_internal/format-fetchers/getAllExportItemFormats.ts"],"names":[],"mappings":";;;AACA,sCAAgD;AAEhD;;;GAGG;AACH,SAAgB,uBAAuB;IACrC,OAAO,4BAAmB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC1C,IAAI,EAAE,SAAS;QACf,MAAM;KACP,CAAC,CAAC,CAAC;AACN,CAAC;AALD,0DAKC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCreateReplicaFormats = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
* Returns all the download formats that are defined by the service's /createReplica endpoint.
|
|
7
|
+
*
|
|
8
|
+
* @param entity Hosted Feature Service entity to return download formats for
|
|
9
|
+
* @returns available download formats for the entity
|
|
10
|
+
*/
|
|
11
|
+
function getCreateReplicaFormats(entity) {
|
|
12
|
+
return (entity.serverExtractFormats || []).map((format) => ({
|
|
13
|
+
type: "dynamic",
|
|
14
|
+
format: format,
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
exports.getCreateReplicaFormats = getCreateReplicaFormats;
|
|
18
|
+
//# sourceMappingURL=getCreateReplicaFormats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCreateReplicaFormats.js","sourceRoot":"","sources":["../../../../../src/downloads/_internal/format-fetchers/getCreateReplicaFormats.ts"],"names":[],"mappings":";;;AAIA;;;;;;GAMG;AACH,SAAgB,uBAAuB,CACrC,MAA2B;IAE3B,OAAO,CAAC,MAAM,CAAC,oBAAoB,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;QAClE,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,MAA6B;KACtC,CAAC,CAAC,CAAC;AACN,CAAC;AAPD,0DAOC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExportImageFormats = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
* Returns all the download formats that are exposed by Image Services via the /exportImage operation.
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This function is a work-in-progress. Various permissions and logic branches are not yet implemented.
|
|
9
|
+
*/
|
|
10
|
+
function getExportImageFormats() {
|
|
11
|
+
throw new Error("Not implemented");
|
|
12
|
+
// return EXPORT_IMAGE_FORMATS.map((format) => ({ type: "dynamic", format }));
|
|
13
|
+
}
|
|
14
|
+
exports.getExportImageFormats = getExportImageFormats;
|
|
15
|
+
//# sourceMappingURL=getExportImageFormats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getExportImageFormats.js","sourceRoot":"","sources":["../../../../../src/downloads/_internal/format-fetchers/getExportImageFormats.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,SAAgB,qBAAqB;IACnC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnC,8EAA8E;AAChF,CAAC;AAHD,sDAGC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getHubDownloadApiFormats = void 0;
|
|
4
|
+
const getCreateReplicaFormats_1 = require("./getCreateReplicaFormats");
|
|
5
|
+
const getPagingJobFormats_1 = require("./getPagingJobFormats");
|
|
6
|
+
const canUseCreateReplica_1 = require("../../canUseCreateReplica");
|
|
7
|
+
/**
|
|
8
|
+
* @private
|
|
9
|
+
* Returns all the formats that are available for download via the Hub Download API for a given entity.
|
|
10
|
+
* Formats will vary from entity to entity depending on actual operation that the Hub Download API will
|
|
11
|
+
* perform under the hood (e.g., hitting /createReplica or paging through the service's features).
|
|
12
|
+
*
|
|
13
|
+
* @param entity Service entity to return download formats for
|
|
14
|
+
* @returns available download formats for the entity
|
|
15
|
+
*/
|
|
16
|
+
function getHubDownloadApiFormats(entity) {
|
|
17
|
+
return canUseCreateReplica_1.canUseCreateReplica(entity)
|
|
18
|
+
? getCreateReplicaFormats_1.getCreateReplicaFormats(entity)
|
|
19
|
+
: getPagingJobFormats_1.getPagingJobFormats();
|
|
20
|
+
}
|
|
21
|
+
exports.getHubDownloadApiFormats = getHubDownloadApiFormats;
|
|
22
|
+
//# sourceMappingURL=getHubDownloadApiFormats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getHubDownloadApiFormats.js","sourceRoot":"","sources":["../../../../../src/downloads/_internal/format-fetchers/getHubDownloadApiFormats.ts"],"names":[],"mappings":";;;AAAA,uEAAoE;AACpE,+DAA4D;AAG5D,mEAAgE;AAEhE;;;;;;;;GAQG;AACH,SAAgB,wBAAwB,CACtC,MAA2B;IAE3B,OAAO,yCAAmB,CAAC,MAAM,CAAC;QAChC,CAAC,CAAC,iDAAuB,CAAC,MAAM,CAAC;QACjC,CAAC,CAAC,yCAAmB,EAAE,CAAC;AAC5B,CAAC;AAND,4DAMC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPagingJobFormats = void 0;
|
|
4
|
+
const _types_1 = require("../_types");
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
* Returns all the download formats that are available for the Hub Download API's paging job operation.
|
|
8
|
+
* @returns available download formats for the paging job operation
|
|
9
|
+
*/
|
|
10
|
+
function getPagingJobFormats() {
|
|
11
|
+
return _types_1.HUB_PAGING_JOB_FORMATS.map((format) => ({ type: "dynamic", format }));
|
|
12
|
+
}
|
|
13
|
+
exports.getPagingJobFormats = getPagingJobFormats;
|
|
14
|
+
//# sourceMappingURL=getPagingJobFormats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPagingJobFormats.js","sourceRoot":"","sources":["../../../../../src/downloads/_internal/format-fetchers/getPagingJobFormats.ts"],"names":[],"mappings":";;;AACA,sCAAmD;AAEnD;;;;GAIG;AACH,SAAgB,mBAAmB;IACjC,OAAO,+BAAsB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAC/E,CAAC;AAFD,kDAEC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExportItemDataUrl = void 0;
|
|
4
|
+
const objects_1 = require("../../objects");
|
|
5
|
+
/**
|
|
6
|
+
* @private
|
|
7
|
+
* Generates a URL to download the data of an export item.
|
|
8
|
+
* @param exportItemId ID of the export item
|
|
9
|
+
* @param context ArcGIS application context
|
|
10
|
+
* @returns URL to download the data of the export item
|
|
11
|
+
*/
|
|
12
|
+
function getExportItemDataUrl(exportItemId, context) {
|
|
13
|
+
const baseUrl = `${context.portalUrl}/sharing/rest/content/items/${exportItemId}/data`;
|
|
14
|
+
const token = objects_1.getProp(context, "hubRequestOptions.authentication.token");
|
|
15
|
+
return token ? `${baseUrl}?token=${token}` : baseUrl;
|
|
16
|
+
}
|
|
17
|
+
exports.getExportItemDataUrl = getExportItemDataUrl;
|
|
18
|
+
//# sourceMappingURL=getExportItemDataUrl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getExportItemDataUrl.js","sourceRoot":"","sources":["../../../../src/downloads/_internal/getExportItemDataUrl.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AAExC;;;;;;GAMG;AACH,SAAgB,oBAAoB,CAClC,YAAoB,EACpB,OAAuB;IAEvB,MAAM,OAAO,GAAG,GAAG,OAAO,CAAC,SAAS,+BAA+B,YAAY,OAAO,CAAC;IACvF,MAAM,KAAK,GAAG,iBAAO,CAAC,OAAO,EAAE,wCAAwC,CAAC,CAAC;IACzE,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACvD,CAAC;AAPD,oDAOC"}
|
|
@@ -1,47 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExportLayerTypeKeyword = exports.getExportItemTypeKeyword = exports.getSpatialRefTypeKeyword = exports.buildExistingExportsPortalQuery = exports.serializeSpatialReference = exports.
|
|
3
|
+
exports.getExportLayerTypeKeyword = exports.getExportItemTypeKeyword = exports.getSpatialRefTypeKeyword = exports.buildExistingExportsPortalQuery = exports.serializeSpatialReference = exports.WGS84_WKID = void 0;
|
|
4
4
|
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
5
5
|
const abab_1 = require("abab");
|
|
6
6
|
const util_1 = require("../util");
|
|
7
|
+
const types_1 = require("./types");
|
|
7
8
|
exports.WGS84_WKID = "4326";
|
|
8
|
-
exports.PORTAL_EXPORT_TYPES = {
|
|
9
|
-
csv: {
|
|
10
|
-
name: "CSV",
|
|
11
|
-
itemTypes: ["CSV", "CSV Collection"],
|
|
12
|
-
supportsProjection: true,
|
|
13
|
-
},
|
|
14
|
-
kml: {
|
|
15
|
-
name: "KML",
|
|
16
|
-
itemTypes: ["KML", "KML Collection"],
|
|
17
|
-
supportsProjection: false,
|
|
18
|
-
},
|
|
19
|
-
shapefile: {
|
|
20
|
-
name: "Shapefile",
|
|
21
|
-
itemTypes: ["Shapefile"],
|
|
22
|
-
supportsProjection: true,
|
|
23
|
-
},
|
|
24
|
-
fileGeodatabase: {
|
|
25
|
-
name: "File Geodatabase",
|
|
26
|
-
itemTypes: ["File Geodatabase"],
|
|
27
|
-
supportsProjection: true,
|
|
28
|
-
},
|
|
29
|
-
geojson: {
|
|
30
|
-
name: "GeoJson",
|
|
31
|
-
itemTypes: ["GeoJson"],
|
|
32
|
-
supportsProjection: false,
|
|
33
|
-
},
|
|
34
|
-
excel: {
|
|
35
|
-
name: "Excel",
|
|
36
|
-
itemTypes: ["Microsoft Excel"],
|
|
37
|
-
supportsProjection: true,
|
|
38
|
-
},
|
|
39
|
-
featureCollection: {
|
|
40
|
-
name: "Feature Collection",
|
|
41
|
-
itemTypes: ["Feature Collection"],
|
|
42
|
-
supportsProjection: true,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
9
|
/**
|
|
46
10
|
* Puts a spatial reference into a serialized format that can be used
|
|
47
11
|
* for item typeKeywords.
|
|
@@ -94,7 +58,7 @@ function parseSpatialRefId(spatialRefId) {
|
|
|
94
58
|
*/
|
|
95
59
|
function buildExistingExportsPortalQuery(itemId, options) {
|
|
96
60
|
const { onlyTypes, layerId, spatialRefId } = maybeExtractOptions(options);
|
|
97
|
-
const formatInfos = Object.keys(
|
|
61
|
+
const formatInfos = Object.keys(types_1.PORTAL_EXPORT_TYPES).map((key) => types_1.PORTAL_EXPORT_TYPES[key]);
|
|
98
62
|
const noProjectionItemTypes = new Set(util_1.flattenArray(formatInfos
|
|
99
63
|
.filter((info) => !info.supportsProjection)
|
|
100
64
|
.map((info) => info.itemTypes)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-existing-exports-portal-query.js","sourceRoot":"","sources":["../../../src/downloads/build-existing-exports-portal-query.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAE9D,+BAA4B;AAC5B,kCAAuC;
|
|
1
|
+
{"version":3,"file":"build-existing-exports-portal-query.js","sourceRoot":"","sources":["../../../src/downloads/build-existing-exports-portal-query.ts"],"names":[],"mappings":";;;AAAA,i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AAE,CAAC,CAAC,CAAC,kBAAkB,CAAC;AAClE,CAAC;AALD,8DAKC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.canUseCreateReplica = void 0;
|
|
4
|
+
const hostedServiceUtils_1 = require("../content/hostedServiceUtils");
|
|
5
|
+
/**
|
|
6
|
+
* Determines whether Hub can perform the /createReplica operation on a given service entity.
|
|
7
|
+
* @param entity entity to check
|
|
8
|
+
* @returns whether the /createReplica operation can be used
|
|
9
|
+
*/
|
|
10
|
+
function canUseCreateReplica(entity) {
|
|
11
|
+
// NOTE: We currently do not allow Hub to perform the /createReplica operation on non-hosted
|
|
12
|
+
// feature services due to known limitations with the enterprise implementation of /createReplica.
|
|
13
|
+
// This is a temporary restriction until the enterprise implementation is improved.
|
|
14
|
+
return (hostedServiceUtils_1.isHostedFeatureServiceEntity(entity) && !!entity.serverExtractCapability);
|
|
15
|
+
}
|
|
16
|
+
exports.canUseCreateReplica = canUseCreateReplica;
|
|
17
|
+
//# sourceMappingURL=canUseCreateReplica.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canUseCreateReplica.js","sourceRoot":"","sources":["../../../src/downloads/canUseCreateReplica.ts"],"names":[],"mappings":";;;AAAA,sEAA6E;AAG7E;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,MAA2B;IAC7D,4FAA4F;IAC5F,kGAAkG;IAClG,mFAAmF;IACnF,OAAO,CACL,iDAA4B,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,uBAAuB,CACzE,CAAC;AACJ,CAAC;AAPD,kDAOC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.canUseHubDownloadApi = void 0;
|
|
4
|
+
const canUseCreateReplica_1 = require("./canUseCreateReplica");
|
|
5
|
+
/**
|
|
6
|
+
* Determines if the Hub Download API can be used for the given entity.
|
|
7
|
+
* @param entity entity to check if Hub Download API can be used
|
|
8
|
+
* @param context ArcGIS context
|
|
9
|
+
* @returns whether the Hub Download API can be used
|
|
10
|
+
*/
|
|
11
|
+
function canUseHubDownloadApi(entity, context) {
|
|
12
|
+
var _a;
|
|
13
|
+
const isDownloadApiAvailable = ((_a = context.serviceStatus) === null || _a === void 0 ? void 0 : _a["hub-downloads"]) === "online";
|
|
14
|
+
const canUsePagingJobs = ["Feature Service", "Map Service"].includes(entity.type) &&
|
|
15
|
+
entity.access === "public";
|
|
16
|
+
return (isDownloadApiAvailable && (canUsePagingJobs || canUseCreateReplica_1.canUseCreateReplica(entity)));
|
|
17
|
+
}
|
|
18
|
+
exports.canUseHubDownloadApi = canUseHubDownloadApi;
|
|
19
|
+
//# sourceMappingURL=canUseHubDownloadApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canUseHubDownloadApi.js","sourceRoot":"","sources":["../../../src/downloads/canUseHubDownloadApi.ts"],"names":[],"mappings":";;;AAEA,+DAA4D;AAE5D;;;;;GAKG;AACH,SAAgB,oBAAoB,CAClC,MAA2B,EAC3B,OAAuB;;IAEvB,MAAM,sBAAsB,GAC1B,OAAA,OAAO,CAAC,aAAa,0CAAG,eAAe,OAAM,QAAQ,CAAC;IACxD,MAAM,gBAAgB,GACpB,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC;QACxD,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC;IAE7B,OAAO,CACL,sBAAsB,IAAI,CAAC,gBAAgB,IAAI,yCAAmB,CAAC,MAAM,CAAC,CAAC,CAC5E,CAAC;AACJ,CAAC;AAbD,oDAaC"}
|