Skip to content

Commit

Permalink
fix dpid resolution to handle type correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
hubsmoke committed Mar 26, 2024
1 parent 9fad9e7 commit d78f143
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/dpid-reader/DpidReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export class DpidReader {
private static transformRaw = async (result: DpidResult, request: DpidRequest): Promise<string | DataResponse> => {
const { prefix, suffix, version } = request;
const hex = result.id16;

const output = { msg: `beta.dpid.org resolver`, params: request, hex };

const graphUrl = THE_GRAPH_RESOLVER_URL[prefix];
Expand Down Expand Up @@ -217,8 +218,9 @@ export class DpidReader {
) {
const res = await fetch(manifestLocation);
const researchObject: ResearchObjectV1 = await res.json();
const dataBucketCandidate: ResearchObjectV1Component = researchObject.components[0];
if (dataBucketCandidate && dataBucketCandidate.type === ResearchObjectComponentType.DATA_BUCKET) {
const dataBucketCandidate: ResearchObjectV1Component =
researchObject.components.find((a) => a.name == "root") || researchObject.components[0];
if (dataBucketCandidate) {
const dataBucket: DataBucketComponent = dataBucketCandidate as DataBucketComponent;
let dataSuffix;
if (versionAsData) {
Expand Down

0 comments on commit d78f143

Please sign in to comment.