Skip to content

Commit

Permalink
fix(content): datasetToContent should not return isProxied as that is…
Browse files Browse the repository at this point in the history
… not returned by the API

affects: @esri/hub-content
  • Loading branch information
tomwayson committed Jun 14, 2021
1 parent a46924f commit c088bfd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
20 changes: 6 additions & 14 deletions packages/content/src/hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ export function datasetToContent(dataset: DatasetResource): IHubContent {
searchDescription,
groupIds,
structuredLicense,
layer,
// map and feature server enrichments
server,
// dataset enrichments
isProxied
// recordCount
// TODO: fields, geometryType, layer?, server?, as needed
// TODO: layers, etc
// feature and raster layer enrichments
layer
// TODO: recordCount, fields, geometryType, etc
} = attributes;
content.errors = errors;
content.boundary = boundary;
Expand All @@ -151,7 +151,6 @@ export function datasetToContent(dataset: DatasetResource): IHubContent {
content.structuredLicense = structuredLicense;
content.layer = layer;
content.server = server;
content.isProxied = isProxied;
if (!item.extent.length && extent && extent.coordinates) {
// we fall back to the extent derived by the API
// which prefers layer or service extents and ultimately
Expand All @@ -166,14 +165,7 @@ export function datasetToContent(dataset: DatasetResource): IHubContent {
// overwrite default updated source
content.updatedDateSource = modifiedProvenance;
}
// type-specific enrichments
// TODO: should this be based on existence of attributes instead of hubType?
// TODO: if the latter, should we return a different subtype of IHubContent for this?
// if (content.hubType === "dataset") {
// content.recordCount = recordCount;
// // TODO: fields, geometryType, etc
// }
// TODO: any remaining enrichments
// TODO: any remaining enrichments?
return content;
}

Expand Down
2 changes: 0 additions & 2 deletions packages/content/test/hub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,10 @@ describe("hub", () => {
const dataset = cloneObject(documentsJson.data) as DatasetResource;
delete dataset.attributes.searchDescription;
delete dataset.attributes.modifiedProvenance;
dataset.attributes.isProxied = false;
const content = datasetToContent(dataset);
expect(content.summary).toBe(dataset.attributes.snippet);
expect(content.updatedDateSource).toBe("item.modified");
expect(content.extent).toEqual([]);
expect(content.isProxied).toBe(false);
});
it("has a reference to the item", () => {
const dataset = cloneObject(documentsJson.data) as DatasetResource;
Expand Down

0 comments on commit c088bfd

Please sign in to comment.