Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(getContent): fix handle un-indexed (usually private) content #345

Merged
merged 2 commits into from
Aug 31, 2020

Conversation

tomwayson
Copy link
Member

AFFECTS PACKAGES:
@esri/hub-content

ISSUES CLOSED: #341

AFFECTS PACKAGES:
@esri/hub-content

ISSUES CLOSED: #341
// TODO: inspect error?
// dataset is not in index (i.e. might be a private item)
// try fetching from portal instead
return getContentFromPortal(id, requestOptions);
Copy link
Contributor

@drewdaemon drewdaemon Aug 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the fact that we use portal to refer both to enterprise sites and to the portal API in this flow. Maybe we could consider calling this function getContentFromPortalApi or something. Anyway, your call.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I would suggest we also rename getContentFromHubApi as well then.

@drewdaemon
Copy link
Contributor

Do we need a changelog entry?

@tomwayson
Copy link
Member Author

Thanks @drewctate, changelog will be generated ;)

Comment on lines +22 to +26
return getContentFromHub(id, requestOptions).catch(() => {
// TODO: inspect error?
// dataset is not in index (i.e. might be a private item)
// try fetching from portal instead
return getContentFromPortal(id, requestOptions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supported for all item types? if somebody is selecting a feature layer dataset, a failed request would return a feature service item. is that acceptable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, but I think that is out of scope of this PR, b/c getContent() doesn't yet support feature layer/service datasets.

We should address this as part of #322

@codecov
Copy link

codecov bot commented Aug 31, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@69160cc). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             master      #345   +/-   ##
==========================================
  Coverage          ?   100.00%           
==========================================
  Files             ?       388           
  Lines             ?      4516           
  Branches          ?       603           
==========================================
  Hits              ?      4516           
  Misses            ?         0           
  Partials          ?         0           
Impacted Files Coverage Δ
packages/content/src/content.ts 100.00% <100.00%> (ø)
.../initiatives/src/migrations/upgrade-two-dot-two.ts 100.00% <0.00%> (ø)
packages/surveys/src/sharing/set-access.ts 100.00% <0.00%> (ø)
packages/common/src/items/interpolate.ts 100.00% <0.00%> (ø)
...kages/sites/src/ensure-required-site-properties.ts 100.00% <0.00%> (ø)
...es/sites/src/_ensure-optional-groups-templating.ts 100.00% <0.00%> (ø)
packages/common/src/objects/remove-empty-props.ts 100.00% <0.00%> (ø)
packages/common/src/request.ts 100.00% <0.00%> (ø)
...ackages/initiatives/src/migrations/apply-schema.ts 100.00% <0.00%> (ø)
packages/sites/src/layout/convert-row.ts 100.00% <0.00%> (ø)
... and 379 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 69160cc...804bea3. Read the comment docs.

@tomwayson tomwayson merged commit cdfa6a7 into master Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getContent() should handle un-indexed (usually private) content
3 participants