Skip to content

Commit

Permalink
fix: obtain jq wrap/pair from annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
tokebe committed Oct 13, 2023
1 parent 8d7b437 commit 549e415
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export class Transformer {
// console.log(`WE DONT DO THE OP ${api}, ${this.data.edge.query_operation}`)
// }

if (this.data.edge.query_operation?.transformer?.pair_jq || this.data.edge.query_operation?.transformer?.wrap_jq) {
if (this.data.edge.query_operation?.transformer?.jq) {
// console.log("WE DO THE OP", this.data.edge.query_operation.transformer)
this.tf = new JQTransformer(this.data, {
...this.config,
wrap: this.data.edge.query_operation.transformer.wrap_jq,
pair: this.data.edge.query_operation.transformer.pair_jq,
wrap: this.data.edge.query_operation.transformer.jq.wrap,
pair: this.data.edge.query_operation.transformer.jq.pair,
});
} else if (tags.includes("bte-trapi")) {
this.tf = new TRAPITransformer(this.data, this.config);
Expand Down
16 changes: 10 additions & 6 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ interface XBTEParametersObject {
}

interface TransformerObject {
wrap_jq?: string;
pair_jq?: string;
wrap?: string;
pair?: string;
}

interface TransformerSet {
[transformerPattern: string]: TransformerObject;
}

interface QueryOperationInterface {
Expand All @@ -29,7 +33,7 @@ interface QueryOperationInterface {
request_body: object;
supportBatch: boolean;
inputSeparator: string;
transformer: TransformerObject;
transformer: TransformerSet;
}

interface SmartAPIKGOperationObject {
Expand Down Expand Up @@ -58,6 +62,6 @@ export interface BTEQueryObject {
}

export interface JQVariable {
name: string;
value: string;
}
name: string;
value: string;
}

0 comments on commit 549e415

Please sign in to comment.