Skip to content

Commit

Permalink
Update zeus (#137)
Browse files Browse the repository at this point in the history
* updating zeus

* removing chained options

* another try

* undefined check

* make it not optional

* hack mode

* undefined check
  • Loading branch information
CryptoGraffe authored Nov 2, 2023
1 parent 5e3bba8 commit 90c49ee
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/app/api/zeus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ export const HOST = "http://localhost:8080/v1/graphql"


export const HEADERS = {}
import { createClient, type Sink } from 'graphql-ws'; // keep
import { createClient, type Sink } from 'graphql-ws';

export const apiSubscription = (options: chainOptions) => {

// const headers : Record<string,string> = {};
const h = options[1]?.headers;
if (h === undefined) {
throw new Error('auth headers required');
}
// const passedHeaders : HeadersInit = /*options[1]?.headers ??*/ new Headers();
// const h = {'authorization':passedHeaders['authorization'] ?? '','x-hasura-role':passedHeaders['x-hasura-role'] ?? ''};
// const empty : [string, string][] = [];
// const headers : HeadersInit = passedHeaders ? passedHeaders : empty;
const client = createClient({
url: String(options[0]),
// connectionParams: Object.fromEntries(new Headers(options[1]?.headers).entries()),

connectionParams: h !== undefined ? Object.fromEntries(new Headers(h as HeadersInit).entries()) : undefined,
});

const ws = new Proxy(
Expand Down Expand Up @@ -81685,4 +81693,4 @@ type ZEUS_VARIABLES = {
["vouches_var_pop_order_by"]: ValueTypes["vouches_var_pop_order_by"];
["vouches_var_samp_order_by"]: ValueTypes["vouches_var_samp_order_by"];
["vouches_variance_order_by"]: ValueTypes["vouches_variance_order_by"];
}
}

0 comments on commit 90c49ee

Please sign in to comment.