Skip to content

Commit

Permalink
Add flag to override client side literal parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
lucksus committed Jul 5, 2024
1 parent 5e62eec commit dc56f8d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions core/src/expression/ExpressionClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ export class ExpressionClient {
this.#apolloClient = client
}

async get(url: string): Promise<ExpressionRendered> {
try {
let literalValue = Literal.fromUrl(url).get();
if (typeof literalValue === 'object' && literalValue !== null) {
if ('author' in literalValue && 'timestamp' in literalValue && 'data' in literalValue && 'proof' in literalValue) {
return literalValue;
async get(url: string, alwaysGet: boolean = false): Promise<ExpressionRendered> {
if(!alwaysGet){
try {
let literalValue = Literal.fromUrl(url).get();
if (typeof literalValue === 'object' && literalValue !== null) {
if ('author' in literalValue && 'timestamp' in literalValue && 'data' in literalValue && 'proof' in literalValue) {
return literalValue;
}
}
}
} catch(e) {}
} catch(e) {}
}


const { expression } = unwrapApolloResult(await this.#apolloClient.query({
query: gql`query expression($url: String!) {
Expand Down

0 comments on commit dc56f8d

Please sign in to comment.