@esri/hub-common 9.25.0 → 9.25.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/es2017/content/_fetch.js +16 -3
- package/dist/es2017/content/_fetch.js.map +1 -1
- package/dist/es2017/content/fetch.js +27 -23
- package/dist/es2017/content/fetch.js.map +1 -1
- package/dist/es2017/items/_enrichments.js +29 -14
- package/dist/es2017/items/_enrichments.js.map +1 -1
- package/dist/es2017/utils/_array.js +13 -0
- package/dist/es2017/utils/_array.js.map +1 -0
- package/dist/esm/content/_fetch.js +14 -3
- package/dist/esm/content/_fetch.js.map +1 -1
- package/dist/esm/content/fetch.js +40 -31
- package/dist/esm/content/fetch.js.map +1 -1
- package/dist/esm/items/_enrichments.js +29 -14
- package/dist/esm/items/_enrichments.js.map +1 -1
- package/dist/esm/utils/_array.js +13 -0
- package/dist/esm/utils/_array.js.map +1 -0
- package/dist/node/content/_fetch.js +16 -3
- package/dist/node/content/_fetch.js.map +1 -1
- package/dist/node/content/fetch.js +27 -23
- package/dist/node/content/fetch.js.map +1 -1
- package/dist/node/items/_enrichments.js +30 -15
- package/dist/node/items/_enrichments.js.map +1 -1
- package/dist/node/utils/_array.js +16 -0
- package/dist/node/utils/_array.js.map +1 -0
- package/dist/types/content/_fetch.d.ts +9 -4
- package/dist/types/items/_enrichments.d.ts +10 -1
- package/dist/types/utils/_array.d.ts +9 -0
- package/dist/umd/common.umd.js +95 -49
- package/dist/umd/common.umd.js.map +1 -1
- package/dist/umd/common.umd.min.js +1 -1
- package/dist/umd/common.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchHubEnrichmentsById = exports.fetchHubEnrichmentsBySlug = exports.getContentEnrichments = void 0;
|
|
4
|
+
const _enrichments_1 = require("../items/_enrichments");
|
|
4
5
|
const request_1 = require("../request");
|
|
5
6
|
const urls_1 = require("../urls");
|
|
6
7
|
const util_1 = require("../util");
|
|
@@ -44,7 +45,9 @@ exports.getContentEnrichments = (item) => {
|
|
|
44
45
|
// that we fetch from the Hub API, and to optionally filter by slug
|
|
45
46
|
const getHubEnrichmentsOptions = (requestOptions, slug) => {
|
|
46
47
|
const opts = util_1.cloneObject(requestOptions);
|
|
47
|
-
opts.params = Object.assign(Object.assign({}, opts.params), {
|
|
48
|
+
opts.params = Object.assign(Object.assign({}, opts.params), {
|
|
49
|
+
// TODO: we should fetch errors too
|
|
50
|
+
"fields[datasets]": "slug,boundary,extent,searchDescription,statistics" });
|
|
48
51
|
if (slug) {
|
|
49
52
|
opts.params["filter[slug]"] = slug;
|
|
50
53
|
}
|
|
@@ -73,6 +76,9 @@ const getDatasetEnrichments = (dataset) => {
|
|
|
73
76
|
* @private
|
|
74
77
|
*/
|
|
75
78
|
exports.fetchHubEnrichmentsBySlug = async (slug, requestOptions) => {
|
|
79
|
+
// NOTE: we don't catch errors here b/c
|
|
80
|
+
// searching by slug is the first step in fetchContent()
|
|
81
|
+
// and if this fails, we don't have an id to fall back on
|
|
76
82
|
const response = await request_1.hubApiRequest(`/datasets`, getHubEnrichmentsOptions(requestOptions, slug));
|
|
77
83
|
return getDatasetEnrichments(response.data[0]);
|
|
78
84
|
};
|
|
@@ -84,7 +90,14 @@ exports.fetchHubEnrichmentsBySlug = async (slug, requestOptions) => {
|
|
|
84
90
|
* @private
|
|
85
91
|
*/
|
|
86
92
|
exports.fetchHubEnrichmentsById = async (hubId, requestOptions) => {
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
try {
|
|
94
|
+
const response = await request_1.hubApiRequest(`/datasets/${hubId}`, getHubEnrichmentsOptions(requestOptions));
|
|
95
|
+
return getDatasetEnrichments(response.data);
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
// dataset record not found, just log the error
|
|
99
|
+
// b/c we can still look up the item and enrichments by id
|
|
100
|
+
return { errors: _enrichments_1.getEnrichmentErrors(e) };
|
|
101
|
+
}
|
|
89
102
|
};
|
|
90
103
|
//# sourceMappingURL=_fetch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_fetch.js","sourceRoot":"","sources":["../../../src/content/_fetch.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"_fetch.js","sourceRoot":"","sources":["../../../src/content/_fetch.ts"],"names":[],"mappings":";;;AACA,wDAG+B;AAC/B,wCAA2C;AAO3C,kCAAkD;AAClD,kCAAsC;AACtC,oCAAoC;AACpC,uCAA8C;AAC9C,6CAAyC;AACzC,mCAAyC;AAGzC,+DAA+D;AAC/D,gDAAgD;AAChD,MAAM,eAAe,GAAG,CAAC,IAAW,EAAE,EAAE;IACtC,MAAM,IAAI,GAAG,2BAAiB,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,sBAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,YAAY,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC9C,MAAM,SAAS,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC3C,OAAO,gBAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,gBAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACrE,CAAC,CAAC;AAEF;;;;;GAKG;AACU,QAAA,qBAAqB,GAAG,CAAC,IAAW,EAAE,EAAE;IACnD,mDAAmD;IACnD,MAAM,WAAW,GAA6B;QAC5C,UAAU;QACV,UAAU;QACV,WAAW;QACX,KAAK;KACN,CAAC;IACF,yCAAyC;IACzC,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;QACzB,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAC1B;IACD,0DAA0D;IAC1D,OAAO,8BAAuB,CAAC,IAAI,CAAC,GAAG,CAAC;QACtC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,Q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CAAC;AACjD,CAAC,CAAC;AAEF;;;;;;GAMG;AACU,QAAA,uBAAuB,GAAG,KAAK,EAC1C,KAAa,EACb,cAAmC,EACnC,EAAE;IACF,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,uBAAa,CAClC,aAAa,KAAK,EAAE,EACpB,wBAAwB,CAAC,cAAc,CAAC,CACzC,CAAC;QACF,OAAO,qBAAqB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KAC7C;IAAC,OAAO,CAAC,EAAE;QACV,+CAA+C;QAC/C,0DAA0D;QAC1D,OAAO,EAAE,MAAM,EAAE,kCAAmB,CAAC,CAAU,CAAC,EAAE,CAAC;KACpD;AACH,CAAC,CAAC"}
|
|
@@ -6,6 +6,7 @@ const arcgis_rest_feature_layer_1 = require("@esri/arcgis-rest-feature-layer");
|
|
|
6
6
|
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
7
7
|
const _enrichments_1 = require("../items/_enrichments");
|
|
8
8
|
const util_1 = require("../util");
|
|
9
|
+
const _array_1 = require("../utils/_array");
|
|
9
10
|
const slugs_1 = require("./slugs");
|
|
10
11
|
const _fetch_1 = require("./_fetch");
|
|
11
12
|
const _internal_1 = require("./_internal");
|
|
@@ -23,8 +24,9 @@ const maybeFetchLayerEnrichments = async (itemAndEnrichments, options) => {
|
|
|
23
24
|
// we just fetch the item data for all layer views
|
|
24
25
|
await _enrichments_1.fetchItemEnrichments(item, ["data"], options)
|
|
25
26
|
: undefined;
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
return Object.assign(Object.assign(Object.assign({}, itemAndEnrichments), layerEnrichments), {
|
|
28
|
+
// merge error arrays
|
|
29
|
+
errors: _array_1.maybeConcat([itemAndEnrichments.errors, layerEnrichments === null || layerEnrichments === void 0 ? void 0 : layerEnrichments.errors]) });
|
|
28
30
|
};
|
|
29
31
|
const fetchItemAndEnrichments = async (itemId, options) => {
|
|
30
32
|
// fetch the item
|
|
@@ -42,14 +44,17 @@ const fetchContentById = async (hubId, options) => {
|
|
|
42
44
|
const specifiedLayerId = options && options.layerId;
|
|
43
45
|
// if this is a public item and we're not in enterprise
|
|
44
46
|
// fetch the slug and remaining enrichments from the Hub API
|
|
45
|
-
const { slug, layerId, boundary, extent, searchDescription, statistics } =
|
|
47
|
+
// const { slug, layerId, boundary, extent, searchDescription, statistics } =
|
|
48
|
+
const hubEnrichments = _internal_1.canUseHubApiForItem(item, options)
|
|
46
49
|
? await _fetch_1.fetchHubEnrichmentsById(hubId, options)
|
|
47
50
|
: {};
|
|
51
|
+
const layerId = hubEnrichments.layerId;
|
|
48
52
|
// return a new content object composed from the item and enrichments we fetched
|
|
49
|
-
return compose_1.composeContent(item, Object.assign(Object.assign({ requestOptions: options }, itemEnrichments),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
return compose_1.composeContent(item, Object.assign(Object.assign(Object.assign({ requestOptions: options }, itemEnrichments), hubEnrichments), {
|
|
54
|
+
// prefer specified layer id if any
|
|
55
|
+
layerId: util_1.isNil(specifiedLayerId) ? layerId : specifiedLayerId,
|
|
56
|
+
// merge error arrays
|
|
57
|
+
errors: _array_1.maybeConcat([itemEnrichments.errors, hubEnrichments.errors]) }));
|
|
53
58
|
};
|
|
54
59
|
const fetchContentBySlug = async (fullyQualifiedSlug, options) => {
|
|
55
60
|
// we only have a slug, not an item id, so we start by
|
|
@@ -63,24 +68,23 @@ const fetchContentBySlug = async (fullyQualifiedSlug, options) => {
|
|
|
63
68
|
// did the caller request a specific layer
|
|
64
69
|
const specifiedLayerId = options && options.layerId;
|
|
65
70
|
if (!util_1.isNil(specifiedLayerId) && specifiedLayerId !== layerId) {
|
|
66
|
-
// we fetched Hub enrichments by slug for another
|
|
67
|
-
// most likely for the parent service of this layer,
|
|
68
|
-
// we need to fetch them for the specified layer instead
|
|
71
|
+
// we fetched Hub enrichments by slug for another record,
|
|
72
|
+
// most likely the record for the parent service of this layer,
|
|
73
|
+
// so we need to fetch them for the specified layer instead
|
|
69
74
|
layerId = specifiedLayerId;
|
|
70
|
-
hubEnrichments = await _fetch_1.fetchHubEnrichmentsById(`${itemId}_${layerId}`, options);
|
|
75
|
+
hubEnrichments = Object.assign(Object.assign({}, hubEnrichments), (await _fetch_1.fetchHubEnrichmentsById(`${itemId}_${layerId}`, options)));
|
|
71
76
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
statistics }));
|
|
77
|
+
return compose_1.composeContent(item, Object.assign(Object.assign(Object.assign({ requestOptions: options }, itemEnrichments), hubEnrichments), { layerId,
|
|
78
|
+
// Note that we are not extracting the slug for the specified layer.
|
|
79
|
+
// It seems that the old client composer code always populated the slug
|
|
80
|
+
// field with the slug that was passed into the function (typically the
|
|
81
|
+
// slug of the parent service). To maintain parity, we do the same here.
|
|
82
|
+
//
|
|
83
|
+
// TODO: should we prefer the slug of the fetched layer instead?
|
|
84
|
+
// return a new content object composed from the item and enrichments we fetched
|
|
85
|
+
slug: fullyQualifiedSlug,
|
|
86
|
+
// merge error arrays
|
|
87
|
+
errors: _array_1.maybeConcat([itemEnrichments.errors, hubEnrichments.errors]) }));
|
|
84
88
|
};
|
|
85
89
|
const fetchContentRecordCount = async (content, requestOptions) => {
|
|
86
90
|
const { url, viewDefinition } = content;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/content/fetch.ts"],"names":[],"mappings":";;;;AAAA,+EAAgE;AAChE,iEAAmD;AAEnD,wDAI+B;AAE/B,kCAAgC;AAChC,mCAAmE;AACnE,
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../src/content/fetch.ts"],"names":[],"mappings":";;;;AAAA,+EAAgE;AAChE,iEAAmD;AAEnD,wDAI+B;AAE/B,kCAAgC;AAChC,4CAA8C;AAC9C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ACF,MAAM,QAAQ,GAAQ,MAAM,yCAAa,iCACpC,cAAc,KACjB,GAAG;YACH,KAAK,EACL,eAAe,EAAE,IAAI,IACrB,CAAC;QACH,OAAO,QAAQ,CAAC,KAAK,CAAC;KACvB;IAAC,WAAM;QACN,6EAA6E;QAC7E,yDAAyD;QACzD,2IAA2I;QAC3I,iFAAiF;QACjF,OAAO,QAAQ,CAAC;KACjB;AACH,CAAC,CAAC;AAEF;;;;;;;;;;;GAWG;AACU,QAAA,YAAY,GAAG,KAAK,EAC/B,UAAkB,EAClB,OAA8B,EAC9B,EAAE;IACF,MAAM,OAAO,GAAG,cAAM,CAAC,UAAU,CAAC;QAChC,CAAC,CAAC,MAAM,kBAAkB,CACtB,wBAAgB,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,OAAO,CAAC,WAAW;QACjB,CAAC,CAAC,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC;YAC1B,CAAC,CAAC,MAAM,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC;YACjD,CAAC,CAAC,SAAS,CAAC;IAChB,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchItemEnrichments = void 0;
|
|
3
|
+
exports.fetchItemEnrichments = exports.getEnrichmentErrors = void 0;
|
|
4
4
|
const arcgis_rest_portal_1 = require("@esri/arcgis-rest-portal");
|
|
5
5
|
const arcgis_rest_feature_layer_1 = require("@esri/arcgis-rest-feature-layer");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
@@ -129,29 +129,44 @@ const enrichLayers = (input) => {
|
|
|
129
129
|
const handleEnrichmentError = (error, input, opId) => {
|
|
130
130
|
const { data, stack, requestOptions } = input;
|
|
131
131
|
stack.finish(opId, { error });
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
errors.push({
|
|
138
|
-
// NOTE: for now we just return the message and type "Other"
|
|
139
|
-
// but we could later introspect for HTTP or AGO errors
|
|
140
|
-
// and/or return the status code if available
|
|
141
|
-
type: "Other",
|
|
142
|
-
message,
|
|
143
|
-
});
|
|
144
|
-
return { data: Object.assign(Object.assign({}, data), { errors }), stack, requestOptions };
|
|
132
|
+
return {
|
|
133
|
+
data: Object.assign(Object.assign({}, data), { errors: exports.getEnrichmentErrors(error, data.errors) }),
|
|
134
|
+
stack,
|
|
135
|
+
requestOptions,
|
|
136
|
+
};
|
|
145
137
|
};
|
|
146
138
|
const enrichmentOperations = {
|
|
147
139
|
groupIds: enrichGroupIds,
|
|
148
140
|
metadata: enrichMetadata,
|
|
149
141
|
ownerUser: enrichOwnerUser,
|
|
150
|
-
// TOOD: org
|
|
151
142
|
data: enrichData,
|
|
152
143
|
server: enrichServer,
|
|
153
144
|
layers: enrichLayers,
|
|
154
145
|
};
|
|
146
|
+
/**
|
|
147
|
+
* convert an error to an enrichment error info format
|
|
148
|
+
* and optionally append it to an existing array of those
|
|
149
|
+
* @param error
|
|
150
|
+
* @param errors an array of existing enrichment error info
|
|
151
|
+
* @returns a new array of enrichment error info
|
|
152
|
+
* @private
|
|
153
|
+
*/
|
|
154
|
+
exports.getEnrichmentErrors = (error, errors = []) => {
|
|
155
|
+
const message = typeof error === "string"
|
|
156
|
+
? /* istanbul ignore next our tests only throw Error objects */
|
|
157
|
+
error
|
|
158
|
+
: error.message;
|
|
159
|
+
return [
|
|
160
|
+
...errors,
|
|
161
|
+
{
|
|
162
|
+
// NOTE: for now we just return the message and type "Other"
|
|
163
|
+
// but we could later introspect for HTTP or AGO errors
|
|
164
|
+
// and/or return the status code if available
|
|
165
|
+
type: "Other",
|
|
166
|
+
message,
|
|
167
|
+
},
|
|
168
|
+
];
|
|
169
|
+
};
|
|
155
170
|
/**
|
|
156
171
|
* Fetch enrichments for an item
|
|
157
172
|
* @param item
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_enrichments.js","sourceRoot":"","sources":["../../../src/items/_enrichments.ts"],"names":[],"mappings":";;;AAAA,iEAKkC;AAClC,+EAGyC;AAGzC,oCAA8D;AAC9D,sDAA+C;AAC/C,+CAA+C;AAC/C,iEAA2D;AAC3D,qDAAwC;AAoBxC,SAAS,gBAAgB,CAAC,WAAmB;IAC3C,MAAM,IAAI,GAAG;QACX,8CAA8C;QAC9C,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EAAE,IAAI;QACzB,YAAY,EAAE,QAAQ;KACvB,CAAC;IACF,OAAO,uBAAK,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,SAAS,oBAAoB,CAC3B,EAAU,EACV,cAAmC;IAEnC,OAAO,oCAAe,CAAC,EAAE,EAAE,cAAc,CAAC;SACvC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;SACpD,KAAK,CAAC,GAAG,EAAE;QACV,0DAA0D;QAC1D,uDAAuD;QACvD,sDAAsD;QACtD,2DAA2D;QAC3D,mEAAmE;QACnE,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,cAAc,GAAG,CACrB,KAAqC,EACI,EAAE;IAC3C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC;IAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC3C,OAAO,kCAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,cAAc,CAAC;SAC/C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.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maybeConcat = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* concat an array of arrays
|
|
6
|
+
* excluding any elements of the top level array
|
|
7
|
+
* that are not actually arrays
|
|
8
|
+
* @param arrays An array of arrays
|
|
9
|
+
* @returns concatenated array
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
exports.maybeConcat = (arrays) => {
|
|
13
|
+
const result = [].concat.apply([], arrays.filter(Array.isArray));
|
|
14
|
+
return result.length ? result : undefined;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=_array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_array.js","sourceRoot":"","sources":["../../../src/utils/_array.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACU,QAAA,WAAW,GAAG,CAAC,MAAe,EAAE,EAAE;IAC7C,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IACjE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5C,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IItem } from "@esri/arcgis-rest-portal";
|
|
2
2
|
import { ItemOrServerEnrichment } from "../items/_enrichments";
|
|
3
|
-
import { BBox, IHubRequestOptions, IHubGeography } from "../types";
|
|
3
|
+
import { BBox, IHubRequestOptions, IHubGeography, IEnrichmentErrorInfo } from "../types";
|
|
4
4
|
/**
|
|
5
5
|
* get the default list of enrichments to fetch for content
|
|
6
6
|
* @param item
|
|
@@ -18,7 +18,7 @@ export interface IHubExtent {
|
|
|
18
18
|
* The set of enrichments that we fetch from the Hub API
|
|
19
19
|
*/
|
|
20
20
|
export interface IDatasetEnrichments {
|
|
21
|
-
itemId
|
|
21
|
+
itemId?: string;
|
|
22
22
|
layerId?: number;
|
|
23
23
|
slug?: string;
|
|
24
24
|
/**
|
|
@@ -41,6 +41,11 @@ export interface IDatasetEnrichments {
|
|
|
41
41
|
* Pre-computed field statistics (min, max, average, etc)
|
|
42
42
|
*/
|
|
43
43
|
statistics?: any;
|
|
44
|
+
/**
|
|
45
|
+
* Any errors encountered when fetching enrichments
|
|
46
|
+
* see https://github.com/ArcGIS/hub-indexer/blob/master/docs/errors.md#response-formatting-for-errors
|
|
47
|
+
*/
|
|
48
|
+
errors?: IEnrichmentErrorInfo[];
|
|
44
49
|
}
|
|
45
50
|
/**
|
|
46
51
|
* fetch enrichment from the Hub API by slug
|
|
@@ -49,7 +54,7 @@ export interface IDatasetEnrichments {
|
|
|
49
54
|
* @returns enrichments from the Hub API (slug, boundary, statistic, etc)
|
|
50
55
|
* @private
|
|
51
56
|
*/
|
|
52
|
-
export declare const fetchHubEnrichmentsBySlug: (slug: string, requestOptions
|
|
57
|
+
export declare const fetchHubEnrichmentsBySlug: (slug: string, requestOptions?: IHubRequestOptions) => Promise<IDatasetEnrichments>;
|
|
53
58
|
/**
|
|
54
59
|
* fetch enrichment from the Hub API by id
|
|
55
60
|
* @param slug
|
|
@@ -57,4 +62,4 @@ export declare const fetchHubEnrichmentsBySlug: (slug: string, requestOptions: I
|
|
|
57
62
|
* @returns enrichments from the Hub API (slug, boundary, statistic, etc)
|
|
58
63
|
* @private
|
|
59
64
|
*/
|
|
60
|
-
export declare const fetchHubEnrichmentsById: (hubId: string, requestOptions
|
|
65
|
+
export declare const fetchHubEnrichmentsById: (hubId: string, requestOptions?: IHubRequestOptions) => Promise<IDatasetEnrichments>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IItem } from "@esri/arcgis-rest-portal";
|
|
2
2
|
import { IItemEnrichments, IServerEnrichments } from "../core";
|
|
3
|
-
import { IHubRequestOptions } from "../types";
|
|
3
|
+
import { IEnrichmentErrorInfo, IHubRequestOptions } from "../types";
|
|
4
4
|
/**
|
|
5
5
|
* An object containing the item and fetched enrichments
|
|
6
6
|
*/
|
|
@@ -13,6 +13,15 @@ export interface IItemAndEnrichments extends IItemEnrichments, IServerEnrichment
|
|
|
13
13
|
* or from the server that the item points to
|
|
14
14
|
*/
|
|
15
15
|
export declare type ItemOrServerEnrichment = keyof IItemEnrichments | keyof IServerEnrichments;
|
|
16
|
+
/**
|
|
17
|
+
* convert an error to an enrichment error info format
|
|
18
|
+
* and optionally append it to an existing array of those
|
|
19
|
+
* @param error
|
|
20
|
+
* @param errors an array of existing enrichment error info
|
|
21
|
+
* @returns a new array of enrichment error info
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
export declare const getEnrichmentErrors: (error: Error | string, errors?: IEnrichmentErrorInfo[]) => IEnrichmentErrorInfo[];
|
|
16
25
|
/**
|
|
17
26
|
* Fetch enrichments for an item
|
|
18
27
|
* @param item
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* concat an array of arrays
|
|
3
|
+
* excluding any elements of the top level array
|
|
4
|
+
* that are not actually arrays
|
|
5
|
+
* @param arrays An array of arrays
|
|
6
|
+
* @returns concatenated array
|
|
7
|
+
* @private
|
|
8
|
+
*/
|
|
9
|
+
export declare const maybeConcat: (arrays: any[][]) => any[];
|
package/dist/umd/common.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/hub-common - v9.
|
|
2
|
+
* @esri/hub-common - v9.25.0 - Thu Mar 24 2022 17:15:40 GMT+0000 (Coordinated Universal Time)
|
|
3
3
|
* Copyright (c) 2022 Environmental Systems Research Institute, Inc.
|
|
4
4
|
* Apache-2.0
|
|
5
5
|
*/
|
|
@@ -8755,29 +8755,44 @@
|
|
|
8755
8755
|
var handleEnrichmentError = function (error, input, opId) {
|
|
8756
8756
|
var data = input.data, stack = input.stack, requestOptions = input.requestOptions;
|
|
8757
8757
|
stack.finish(opId, { error: error });
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
:
|
|
8762
|
-
|
|
8763
|
-
errors.push({
|
|
8764
|
-
// NOTE: for now we just return the message and type "Other"
|
|
8765
|
-
// but we could later introspect for HTTP or AGO errors
|
|
8766
|
-
// and/or return the status code if available
|
|
8767
|
-
type: "Other",
|
|
8768
|
-
message: message,
|
|
8769
|
-
});
|
|
8770
|
-
return { data: __assign(__assign({}, data), { errors: errors }), stack: stack, requestOptions: requestOptions };
|
|
8758
|
+
return {
|
|
8759
|
+
data: __assign(__assign({}, data), { errors: getEnrichmentErrors(error, data.errors) }),
|
|
8760
|
+
stack: stack,
|
|
8761
|
+
requestOptions: requestOptions,
|
|
8762
|
+
};
|
|
8771
8763
|
};
|
|
8772
8764
|
var enrichmentOperations = {
|
|
8773
8765
|
groupIds: enrichGroupIds,
|
|
8774
8766
|
metadata: enrichMetadata,
|
|
8775
8767
|
ownerUser: enrichOwnerUser,
|
|
8776
|
-
// TOOD: org
|
|
8777
8768
|
data: enrichData,
|
|
8778
8769
|
server: enrichServer,
|
|
8779
8770
|
layers: enrichLayers,
|
|
8780
8771
|
};
|
|
8772
|
+
/**
|
|
8773
|
+
* convert an error to an enrichment error info format
|
|
8774
|
+
* and optionally append it to an existing array of those
|
|
8775
|
+
* @param error
|
|
8776
|
+
* @param errors an array of existing enrichment error info
|
|
8777
|
+
* @returns a new array of enrichment error info
|
|
8778
|
+
* @private
|
|
8779
|
+
*/
|
|
8780
|
+
var getEnrichmentErrors = function (error, errors) {
|
|
8781
|
+
if (errors === void 0) { errors = []; }
|
|
8782
|
+
var message = typeof error === "string"
|
|
8783
|
+
? /* istanbul ignore next our tests only throw Error objects */
|
|
8784
|
+
error
|
|
8785
|
+
: error.message;
|
|
8786
|
+
return __spreadArrays(errors, [
|
|
8787
|
+
{
|
|
8788
|
+
// NOTE: for now we just return the message and type "Other"
|
|
8789
|
+
// but we could later introspect for HTTP or AGO errors
|
|
8790
|
+
// and/or return the status code if available
|
|
8791
|
+
type: "Other",
|
|
8792
|
+
message: message,
|
|
8793
|
+
},
|
|
8794
|
+
]);
|
|
8795
|
+
};
|
|
8781
8796
|
/**
|
|
8782
8797
|
* Fetch enrichments for an item
|
|
8783
8798
|
* @param item
|
|
@@ -8803,6 +8818,19 @@
|
|
|
8803
8818
|
}).then(function (output) { return output.data; });
|
|
8804
8819
|
};
|
|
8805
8820
|
|
|
8821
|
+
/**
|
|
8822
|
+
* concat an array of arrays
|
|
8823
|
+
* excluding any elements of the top level array
|
|
8824
|
+
* that are not actually arrays
|
|
8825
|
+
* @param arrays An array of arrays
|
|
8826
|
+
* @returns concatenated array
|
|
8827
|
+
* @private
|
|
8828
|
+
*/
|
|
8829
|
+
var maybeConcat = function (arrays) {
|
|
8830
|
+
var result = [].concat.apply([], arrays.filter(Array.isArray));
|
|
8831
|
+
return result.length ? result : undefined;
|
|
8832
|
+
};
|
|
8833
|
+
|
|
8806
8834
|
/**
|
|
8807
8835
|
* remote server error
|
|
8808
8836
|
*/
|
|
@@ -8906,7 +8934,9 @@
|
|
|
8906
8934
|
// that we fetch from the Hub API, and to optionally filter by slug
|
|
8907
8935
|
var getHubEnrichmentsOptions = function (requestOptions, slug) {
|
|
8908
8936
|
var opts = cloneObject$1(requestOptions);
|
|
8909
|
-
opts.params = __assign(__assign({}, opts.params), {
|
|
8937
|
+
opts.params = __assign(__assign({}, opts.params), {
|
|
8938
|
+
// TODO: we should fetch errors too
|
|
8939
|
+
"fields[datasets]": "slug,boundary,extent,searchDescription,statistics" });
|
|
8910
8940
|
if (slug) {
|
|
8911
8941
|
opts.params["filter[slug]"] = slug;
|
|
8912
8942
|
}
|
|
@@ -8953,13 +8983,21 @@
|
|
|
8953
8983
|
* @private
|
|
8954
8984
|
*/
|
|
8955
8985
|
var fetchHubEnrichmentsById = function (hubId, requestOptions) { return __awaiter(void 0, void 0, void 0, function () {
|
|
8956
|
-
var response;
|
|
8986
|
+
var response, e_1;
|
|
8957
8987
|
return __generator(this, function (_a) {
|
|
8958
8988
|
switch (_a.label) {
|
|
8959
|
-
case 0:
|
|
8989
|
+
case 0:
|
|
8990
|
+
_a.trys.push([0, 2, , 3]);
|
|
8991
|
+
return [4 /*yield*/, hubApiRequest("/datasets/" + hubId, getHubEnrichmentsOptions(requestOptions))];
|
|
8960
8992
|
case 1:
|
|
8961
8993
|
response = _a.sent();
|
|
8962
8994
|
return [2 /*return*/, getDatasetEnrichments(response.data)];
|
|
8995
|
+
case 2:
|
|
8996
|
+
e_1 = _a.sent();
|
|
8997
|
+
// dataset record not found, just log the error
|
|
8998
|
+
// b/c we can still look up the item and enrichments by id
|
|
8999
|
+
return [2 /*return*/, { errors: getEnrichmentErrors(e_1) }];
|
|
9000
|
+
case 3: return [2 /*return*/];
|
|
8963
9001
|
}
|
|
8964
9002
|
});
|
|
8965
9003
|
}); };
|
|
@@ -8990,8 +9028,9 @@
|
|
|
8990
9028
|
_b.label = 3;
|
|
8991
9029
|
case 3:
|
|
8992
9030
|
layerEnrichments = _a;
|
|
8993
|
-
|
|
8994
|
-
|
|
9031
|
+
return [2 /*return*/, __assign(__assign(__assign({}, itemAndEnrichments), layerEnrichments), {
|
|
9032
|
+
// merge error arrays
|
|
9033
|
+
errors: maybeConcat([itemAndEnrichments.errors, layerEnrichments === null || layerEnrichments === void 0 ? void 0 : layerEnrichments.errors]) })];
|
|
8995
9034
|
}
|
|
8996
9035
|
});
|
|
8997
9036
|
}); };
|
|
@@ -9011,62 +9050,69 @@
|
|
|
9011
9050
|
});
|
|
9012
9051
|
}); };
|
|
9013
9052
|
var fetchContentById = function (hubId, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9014
|
-
var itemId, _a, item, itemEnrichments, specifiedLayerId,
|
|
9015
|
-
return __generator(this, function (
|
|
9016
|
-
switch (
|
|
9053
|
+
var itemId, _a, item, itemEnrichments, specifiedLayerId, hubEnrichments, _b, layerId;
|
|
9054
|
+
return __generator(this, function (_c) {
|
|
9055
|
+
switch (_c.label) {
|
|
9017
9056
|
case 0:
|
|
9018
9057
|
itemId = parseDatasetId(hubId).itemId;
|
|
9019
9058
|
return [4 /*yield*/, fetchItemAndEnrichments(itemId, options)];
|
|
9020
9059
|
case 1:
|
|
9021
|
-
_a =
|
|
9060
|
+
_a = _c.sent(), item = _a.item, itemEnrichments = __rest(_a, ["item"]);
|
|
9022
9061
|
specifiedLayerId = options && options.layerId;
|
|
9023
9062
|
if (!canUseHubApiForItem(item, options)) return [3 /*break*/, 3];
|
|
9024
9063
|
return [4 /*yield*/, fetchHubEnrichmentsById(hubId, options)];
|
|
9025
9064
|
case 2:
|
|
9026
|
-
|
|
9065
|
+
_b = _c.sent();
|
|
9027
9066
|
return [3 /*break*/, 4];
|
|
9028
9067
|
case 3:
|
|
9029
|
-
|
|
9030
|
-
|
|
9068
|
+
_b = {};
|
|
9069
|
+
_c.label = 4;
|
|
9031
9070
|
case 4:
|
|
9032
|
-
|
|
9071
|
+
hubEnrichments = _b;
|
|
9072
|
+
layerId = hubEnrichments.layerId;
|
|
9033
9073
|
// return a new content object composed from the item and enrichments we fetched
|
|
9034
|
-
return [2 /*return*/, composeContent(item, __assign(__assign({ requestOptions: options }, itemEnrichments),
|
|
9035
|
-
|
|
9036
|
-
|
|
9037
|
-
|
|
9074
|
+
return [2 /*return*/, composeContent(item, __assign(__assign(__assign({ requestOptions: options }, itemEnrichments), hubEnrichments), {
|
|
9075
|
+
// prefer specified layer id if any
|
|
9076
|
+
layerId: isNil(specifiedLayerId) ? layerId : specifiedLayerId,
|
|
9077
|
+
// merge error arrays
|
|
9078
|
+
errors: maybeConcat([itemEnrichments.errors, hubEnrichments.errors]) }))];
|
|
9038
9079
|
}
|
|
9039
9080
|
});
|
|
9040
9081
|
}); };
|
|
9041
9082
|
var fetchContentBySlug = function (fullyQualifiedSlug, options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
9042
|
-
var hubEnrichments, itemId, layerId, _a, item, itemEnrichments, specifiedLayerId,
|
|
9043
|
-
return __generator(this, function (
|
|
9044
|
-
switch (
|
|
9083
|
+
var hubEnrichments, itemId, layerId, _a, item, itemEnrichments, specifiedLayerId, _b;
|
|
9084
|
+
return __generator(this, function (_c) {
|
|
9085
|
+
switch (_c.label) {
|
|
9045
9086
|
case 0: return [4 /*yield*/, fetchHubEnrichmentsBySlug(fullyQualifiedSlug, options)];
|
|
9046
9087
|
case 1:
|
|
9047
|
-
hubEnrichments =
|
|
9088
|
+
hubEnrichments = _c.sent();
|
|
9048
9089
|
itemId = hubEnrichments.itemId;
|
|
9049
9090
|
layerId = hubEnrichments.layerId;
|
|
9050
9091
|
return [4 /*yield*/, fetchItemAndEnrichments(itemId, options)];
|
|
9051
9092
|
case 2:
|
|
9052
|
-
_a =
|
|
9093
|
+
_a = _c.sent(), item = _a.item, itemEnrichments = __rest(_a, ["item"]);
|
|
9053
9094
|
specifiedLayerId = options && options.layerId;
|
|
9054
9095
|
if (!(!isNil(specifiedLayerId) && specifiedLayerId !== layerId)) return [3 /*break*/, 4];
|
|
9055
|
-
// we fetched Hub enrichments by slug for another
|
|
9056
|
-
// most likely for the parent service of this layer,
|
|
9057
|
-
// we need to fetch them for the specified layer instead
|
|
9096
|
+
// we fetched Hub enrichments by slug for another record,
|
|
9097
|
+
// most likely the record for the parent service of this layer,
|
|
9098
|
+
// so we need to fetch them for the specified layer instead
|
|
9058
9099
|
layerId = specifiedLayerId;
|
|
9100
|
+
_b = [__assign({}, hubEnrichments)];
|
|
9059
9101
|
return [4 /*yield*/, fetchHubEnrichmentsById(itemId + "_" + layerId, options)];
|
|
9060
9102
|
case 3:
|
|
9061
|
-
hubEnrichments = _b.sent();
|
|
9062
|
-
|
|
9063
|
-
case 4:
|
|
9064
|
-
|
|
9065
|
-
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9103
|
+
hubEnrichments = __assign.apply(void 0, _b.concat([(_c.sent())]));
|
|
9104
|
+
_c.label = 4;
|
|
9105
|
+
case 4: return [2 /*return*/, composeContent(item, __assign(__assign(__assign({ requestOptions: options }, itemEnrichments), hubEnrichments), { layerId: layerId,
|
|
9106
|
+
// Note that we are not extracting the slug for the specified layer.
|
|
9107
|
+
// It seems that the old client composer code always populated the slug
|
|
9108
|
+
// field with the slug that was passed into the function (typically the
|
|
9109
|
+
// slug of the parent service). To maintain parity, we do the same here.
|
|
9110
|
+
//
|
|
9111
|
+
// TODO: should we prefer the slug of the fetched layer instead?
|
|
9112
|
+
// return a new content object composed from the item and enrichments we fetched
|
|
9113
|
+
slug: fullyQualifiedSlug,
|
|
9114
|
+
// merge error arrays
|
|
9115
|
+
errors: maybeConcat([itemEnrichments.errors, hubEnrichments.errors]) }))];
|
|
9070
9116
|
}
|
|
9071
9117
|
});
|
|
9072
9118
|
}); };
|