@0xsequence/api 0.0.0-20231120152332 → 0.0.0-20231121142317
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -600,27 +600,21 @@ const buildResponse = res => {
|
|
|
600
600
|
|
|
601
601
|
const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
602
602
|
class SequenceAPIClient extends API {
|
|
603
|
-
constructor(hostname,
|
|
603
|
+
constructor(hostname, jwtAuth) {
|
|
604
604
|
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
605
605
|
this._fetch = (input, init) => {
|
|
606
|
-
// automatically include jwt
|
|
606
|
+
// automatically include jwt auth header to requests
|
|
607
607
|
// if its been set on the api client
|
|
608
608
|
const headers = {};
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
if (jwtAuth && jwtAuth.length > 0) {
|
|
612
|
-
headers['Authorization'] = `BEARER ${jwtAuth}`;
|
|
613
|
-
}
|
|
614
|
-
if (projectAccessKey && projectAccessKey.length > 0) {
|
|
615
|
-
headers['X-Access-Key'] = projectAccessKey;
|
|
609
|
+
if (this.jwtAuth && this.jwtAuth.length > 0) {
|
|
610
|
+
headers['Authorization'] = `BEARER ${this.jwtAuth}`;
|
|
616
611
|
}
|
|
617
612
|
|
|
618
613
|
// before the request is made
|
|
619
614
|
init.headers = _extends({}, init.headers, headers);
|
|
620
615
|
return fetch(input, init);
|
|
621
616
|
};
|
|
622
|
-
this.
|
|
623
|
-
this.jwtAuth = _jwtAuth;
|
|
617
|
+
this.jwtAuth = jwtAuth;
|
|
624
618
|
this.fetch = this._fetch;
|
|
625
619
|
}
|
|
626
620
|
}
|
|
@@ -600,27 +600,21 @@ const buildResponse = res => {
|
|
|
600
600
|
|
|
601
601
|
const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
602
602
|
class SequenceAPIClient extends API {
|
|
603
|
-
constructor(hostname,
|
|
603
|
+
constructor(hostname, jwtAuth) {
|
|
604
604
|
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
605
605
|
this._fetch = (input, init) => {
|
|
606
|
-
// automatically include jwt
|
|
606
|
+
// automatically include jwt auth header to requests
|
|
607
607
|
// if its been set on the api client
|
|
608
608
|
const headers = {};
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
if (jwtAuth && jwtAuth.length > 0) {
|
|
612
|
-
headers['Authorization'] = `BEARER ${jwtAuth}`;
|
|
613
|
-
}
|
|
614
|
-
if (projectAccessKey && projectAccessKey.length > 0) {
|
|
615
|
-
headers['X-Access-Key'] = projectAccessKey;
|
|
609
|
+
if (this.jwtAuth && this.jwtAuth.length > 0) {
|
|
610
|
+
headers['Authorization'] = `BEARER ${this.jwtAuth}`;
|
|
616
611
|
}
|
|
617
612
|
|
|
618
613
|
// before the request is made
|
|
619
614
|
init.headers = _extends({}, init.headers, headers);
|
|
620
615
|
return fetch(input, init);
|
|
621
616
|
};
|
|
622
|
-
this.
|
|
623
|
-
this.jwtAuth = _jwtAuth;
|
|
617
|
+
this.jwtAuth = jwtAuth;
|
|
624
618
|
this.fetch = this._fetch;
|
|
625
619
|
}
|
|
626
620
|
}
|
|
@@ -596,27 +596,21 @@ const buildResponse = res => {
|
|
|
596
596
|
|
|
597
597
|
const fetch = typeof global === 'object' ? global.fetch : window.fetch;
|
|
598
598
|
class SequenceAPIClient extends API {
|
|
599
|
-
constructor(hostname,
|
|
599
|
+
constructor(hostname, jwtAuth) {
|
|
600
600
|
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
|
|
601
601
|
this._fetch = (input, init) => {
|
|
602
|
-
// automatically include jwt
|
|
602
|
+
// automatically include jwt auth header to requests
|
|
603
603
|
// if its been set on the api client
|
|
604
604
|
const headers = {};
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
if (jwtAuth && jwtAuth.length > 0) {
|
|
608
|
-
headers['Authorization'] = `BEARER ${jwtAuth}`;
|
|
609
|
-
}
|
|
610
|
-
if (projectAccessKey && projectAccessKey.length > 0) {
|
|
611
|
-
headers['X-Access-Key'] = projectAccessKey;
|
|
605
|
+
if (this.jwtAuth && this.jwtAuth.length > 0) {
|
|
606
|
+
headers['Authorization'] = `BEARER ${this.jwtAuth}`;
|
|
612
607
|
}
|
|
613
608
|
|
|
614
609
|
// before the request is made
|
|
615
610
|
init.headers = _extends({}, init.headers, headers);
|
|
616
611
|
return fetch(input, init);
|
|
617
612
|
};
|
|
618
|
-
this.
|
|
619
|
-
this.jwtAuth = _jwtAuth;
|
|
613
|
+
this.jwtAuth = jwtAuth;
|
|
620
614
|
this.fetch = this._fetch;
|
|
621
615
|
}
|
|
622
616
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export * from "./api.gen.js";
|
|
2
2
|
import { API as ApiRpc } from "./api.gen.js";
|
|
3
3
|
export declare class SequenceAPIClient extends ApiRpc {
|
|
4
|
-
projectAccessKey?: string | undefined;
|
|
5
4
|
jwtAuth?: string | undefined;
|
|
6
|
-
constructor(hostname: string,
|
|
5
|
+
constructor(hostname: string, jwtAuth?: string | undefined);
|
|
7
6
|
_fetch: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
8
7
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -7,7 +7,6 @@ const fetch = typeof global === 'object' ? global.fetch : window.fetch
|
|
|
7
7
|
export class SequenceAPIClient extends ApiRpc {
|
|
8
8
|
constructor(
|
|
9
9
|
hostname: string,
|
|
10
|
-
public projectAccessKey?: string,
|
|
11
10
|
public jwtAuth?: string
|
|
12
11
|
) {
|
|
13
12
|
super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch)
|
|
@@ -15,19 +14,11 @@ export class SequenceAPIClient extends ApiRpc {
|
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
_fetch = (input: RequestInfo, init?: RequestInit): Promise<Response> => {
|
|
18
|
-
// automatically include jwt
|
|
17
|
+
// automatically include jwt auth header to requests
|
|
19
18
|
// if its been set on the api client
|
|
20
19
|
const headers: { [key: string]: any } = {}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const projectAccessKey = this.projectAccessKey
|
|
24
|
-
|
|
25
|
-
if (jwtAuth && jwtAuth.length > 0) {
|
|
26
|
-
headers['Authorization'] = `BEARER ${jwtAuth}`
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (projectAccessKey && projectAccessKey.length > 0) {
|
|
30
|
-
headers['X-Access-Key'] = projectAccessKey
|
|
20
|
+
if (this.jwtAuth && this.jwtAuth.length > 0) {
|
|
21
|
+
headers['Authorization'] = `BEARER ${this.jwtAuth}`
|
|
31
22
|
}
|
|
32
23
|
|
|
33
24
|
// before the request is made
|